ebiten: Panic when a sub-image is specified at DrawRectangleWithImage and DrawTrianglesWithShader

Updates #1168
This commit is contained in:
Hajime Hoshi 2020-07-20 23:02:48 +09:00
parent 63f83ceeaa
commit 65783489a5

View File

@ -437,6 +437,10 @@ func (i *Image) DrawRectangleWithShader(width, height int, shader *Shader, optio
if img.isDisposed() {
panic("ebiten: the given image to DrawRectangleWithShader must not be disposed")
}
if img.isSubImage() {
// TODO: Implement this.
panic("ebiten: rendering a sub-image is not implemented (DrawRectangleWithShader)")
}
if w, h := img.Size(); width != w || height != h {
panic("ebiten: all the source images must be the same size with the rectangle")
}
@ -517,6 +521,10 @@ func (i *Image) DrawTrianglesWithShader(vertices []Vertex, indices []uint16, sha
if img.isDisposed() {
panic("ebiten: the given image to DrawTrianglesWithShader must not be disposed")
}
if img.isSubImage() {
// TODO: Implement this.
panic("ebiten: rendering a sub-image is not implemented (DrawTrianglesWithShader)")
}
if imgw == 0 || imgh == 0 {
imgw, imgh = img.Size()
} else if w, h := img.Size(); imgw != w || imgh != h {