internal/ui: compute antialias region size correctly. (#2681)

Closes #2679
This commit is contained in:
divVerent 2023-06-23 13:25:19 -04:00 committed by Hajime Hoshi
parent 038cacf97f
commit 2942fa56c1

View File

@ -381,14 +381,16 @@ func (i *bigOffscreenImage) drawTriangles(srcs [graphics.ShaderImageCount]*Image
vertices[idx+1] = (vertices[idx+1] - i.region.Y) * bigOffscreenScale
}
// Compute corners in dst coordinate space.
x0 := dstRegion.X
y0 := dstRegion.Y
x1 := dstRegion.X + dstRegion.Width
y1 := dstRegion.Y + dstRegion.Height
// Translate to i.region coordinate space, and clamp against region size.
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)
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,