From b96aea70f1559d8a35856bf6a7c814ae168dcce4 Mon Sep 17 00:00:00 2001 From: divVerent Date: Fri, 23 Jun 2023 13:25:19 -0400 Subject: [PATCH] internal/ui: compute antialias region size correctly. (#2681) Closes #2679 --- internal/ui/image.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/ui/image.go b/internal/ui/image.go index 03e2dc6ea..116e17854 100644 --- a/internal/ui/image.go +++ b/internal/ui/image.go @@ -382,14 +382,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,