mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
op/paint: remove support for PaintOp.Rect
PaintOp.Rect is the wrong abstraction; it implies a clip operation better handled by package clip, and not all paints need it (colors). Furthermore, it's awkward to specify a PaintOp that fills up the current clip area, regardless of its size. Redefine PathOp to mean "fill current clip area". API change. Replace uses of PaintOp.Rect with a TransformOp applied before the PaintOp. Leave a TODO for the PathOp infinity area. Fixes gio#167 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -81,7 +81,8 @@ func TestPaintArc(t *testing.T) {
|
||||
func TestPaintTexture(t *testing.T) {
|
||||
run(t, func(o *op.Ops) {
|
||||
squares.Add(o)
|
||||
paint.PaintOp{Rect: f32.Rect(0, 0, 80, 80)}.Add(o)
|
||||
scale(80.0/512, 80.0/512).Add(o)
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
r.expect(0, 0, colornames.Blue)
|
||||
r.expect(79, 10, colornames.Green)
|
||||
@@ -94,7 +95,8 @@ func TestPaintClippedTexture(t *testing.T) {
|
||||
run(t, func(o *op.Ops) {
|
||||
squares.Add(o)
|
||||
clip.RRect{Rect: f32.Rect(0, 0, 40, 40)}.Add(o)
|
||||
paint.PaintOp{Rect: f32.Rect(0, 0, 80, 80)}.Add(o)
|
||||
scale(80.0/512, 80.0/512).Add(o)
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
r.expect(40, 40, colornames.White)
|
||||
r.expect(25, 35, colornames.Blue)
|
||||
|
||||
Reference in New Issue
Block a user