mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
ebiten: Add a restriction that all the source image sizes are same
Updates #1193
This commit is contained in:
parent
52773e1d12
commit
0c13fff62a
6
image.go
6
image.go
@ -380,11 +380,17 @@ func (i *Image) DrawTrianglesWithShader(vertices []Vertex, indices []uint16, sha
|
|||||||
// The actual value is set at graphicscommand package.
|
// The actual value is set at graphicscommand package.
|
||||||
us := append([]interface{}{[]float32{0, 0}}, options.Uniforms...)
|
us := append([]interface{}{[]float32{0, 0}}, options.Uniforms...)
|
||||||
|
|
||||||
|
var imgw, imgh int
|
||||||
var imgs []*buffered.Image
|
var imgs []*buffered.Image
|
||||||
for _, img := range options.Images {
|
for _, img := range options.Images {
|
||||||
if img.isDisposed() {
|
if img.isDisposed() {
|
||||||
panic("ebiten: the given image to DrawTriangles must not be disposed")
|
panic("ebiten: the given image to DrawTriangles must not be disposed")
|
||||||
}
|
}
|
||||||
|
if imgw == 0 || imgh == 0 {
|
||||||
|
imgw, imgh = img.Size()
|
||||||
|
} else if w, h := img.Size(); imgw != w || imgh != h {
|
||||||
|
panic("ebiten: all the source images must be the same size")
|
||||||
|
}
|
||||||
imgs = append(imgs, img.buffered)
|
imgs = append(imgs, img.buffered)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user