mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
internal/ui: bug fix: dstRegion should not exceed the image region
Closes #2577
This commit is contained in:
parent
ad7d5a86f9
commit
ea7d007df9
@ -377,10 +377,20 @@ func (i *bigOffscreenImage) drawTriangles(srcs [graphics.ShaderImageCount]*Image
|
|||||||
vertices[idx+1] = (vertices[idx+1] - i.region.Y) * bigOffscreenScale
|
vertices[idx+1] = (vertices[idx+1] - i.region.Y) * bigOffscreenScale
|
||||||
}
|
}
|
||||||
|
|
||||||
dstRegion.X *= bigOffscreenScale
|
x0 := dstRegion.X
|
||||||
dstRegion.Y *= bigOffscreenScale
|
y0 := dstRegion.Y
|
||||||
dstRegion.Width *= bigOffscreenScale
|
x1 := dstRegion.X + dstRegion.Width
|
||||||
dstRegion.Height *= bigOffscreenScale
|
y1 := dstRegion.Y + dstRegion.Height
|
||||||
|
x0 = max(x0-i.region.X, 0)
|
||||||
|
y0 = max(y0-i.region.Y, 0)
|
||||||
|
x1 = min(x1, i.region.X+i.region.Width)
|
||||||
|
y1 = min(y1, i.region.Y+i.region.Height)
|
||||||
|
dstRegion = graphicsdriver.Region{
|
||||||
|
X: x0 * bigOffscreenScale,
|
||||||
|
Y: y0 * bigOffscreenScale,
|
||||||
|
Width: (x1 - x0) * bigOffscreenScale,
|
||||||
|
Height: (y1 - y0) * bigOffscreenScale,
|
||||||
|
}
|
||||||
|
|
||||||
i.image.DrawTriangles(srcs, vertices, indices, blend, dstRegion, srcRegion, subimageOffsets, shader, uniforms, evenOdd, canSkipMipmap, false)
|
i.image.DrawTriangles(srcs, vertices, indices, blend, dstRegion, srcRegion, subimageOffsets, shader, uniforms, evenOdd, canSkipMipmap, false)
|
||||||
i.dirty = true
|
i.dirty = true
|
||||||
|
Loading…
Reference in New Issue
Block a user