forked from joejulian/gio
gpu: don't store transformed rectangle paths under the same cache key
Fixes incorrect rendering of multiple transformed instances of a rectangle. Fixes: https://todo.sr.ht/~eliasnaur/gio/635 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-1
@@ -1055,6 +1055,7 @@ loop:
|
||||
} else {
|
||||
quads.aux, bounds, _ = d.boundsForTransformedRect(bounds, trans)
|
||||
quads.key = opKey{Key: encOp.Key}
|
||||
quads.key = quads.key.SetTransform(trans)
|
||||
}
|
||||
d.addClipPath(&state, quads.aux, quads.key, bounds, off)
|
||||
quads = quadsOp{}
|
||||
@@ -1100,7 +1101,7 @@ loop:
|
||||
// The paint operation is sheared or rotated, add a clip path representing
|
||||
// this transformed rectangle.
|
||||
k := opKey{Key: encOp.Key}
|
||||
k.SetTransform(t) // TODO: This call has no effect.
|
||||
k = k.SetTransform(t)
|
||||
d.addClipPath(&state, clipData, k, bnd, off)
|
||||
}
|
||||
|
||||
|
||||
@@ -293,3 +293,20 @@ func TestStrokedRect(t *testing.T) {
|
||||
}, func(r result) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestInstancedRects(t *testing.T) {
|
||||
run(t, func(o *op.Ops) {
|
||||
macro := op.Record(o)
|
||||
clip := clip.Rect{Max: image.Pt(20, 20)}.Push(o)
|
||||
paint.ColorOp{Color: color.NRGBA{R: 0x80, A: 0xFF}}.Add(o)
|
||||
paint.PaintOp{}.Add(o)
|
||||
clip.Pop()
|
||||
c := macro.Stop()
|
||||
|
||||
for i := 0; i < 2; i++ {
|
||||
op.Affine(f32.Affine2D{}.Rotate(f32.Pt(0, 0), .2)).Add(o)
|
||||
c.Add(o)
|
||||
op.Offset(image.Pt(20, 20)).Add(o)
|
||||
}
|
||||
}, nil)
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 787 B |
Reference in New Issue
Block a user