op/paint: fix subimage rendering by ImageOp

This change is a follow-up to bcf3ff77ff, fixing the two renderers to
properly render images with non-zero origins.

Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
Pierre Curto
2021-11-10 22:18:59 +01:00
committed by Elias Naur
parent 86c4947ccd
commit 9d05f35341
4 changed files with 13 additions and 11 deletions
+3 -2
View File
@@ -1802,8 +1802,9 @@ func (c *collector) collect(root *op.Ops, viewport image.Point, texOps *[]textur
paintState := state
if paintState.matType == materialTexture {
// Clip to the bounds of the image, to hide other images in the atlas.
bounds := paintState.image.src.Bounds()
c.addClip(&paintState, fview, layout.FRect(bounds), nil, ops.Key{}, 0, 0, false)
sz := state.image.src.Rect.Size()
bounds := f32.Rectangle{Max: layout.FPt(sz)}
c.addClip(&paintState, fview, bounds, nil, ops.Key{}, 0, 0, false)
}
intersect := paintState.clip.intersect
if intersect.Empty() {