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:
@@ -43,14 +43,9 @@ func TestClipping(t *testing.T) {
|
||||
w, release := newTestWindow(t)
|
||||
defer release()
|
||||
|
||||
sz := w.size
|
||||
col := color.RGBA{A: 0xff, R: 0xca, G: 0xfe}
|
||||
col2 := color.RGBA{A: 0xff, R: 0x00, G: 0xfe}
|
||||
var ops op.Ops
|
||||
pop := paint.PaintOp{Rect: f32.Rectangle{Max: f32.Point{
|
||||
X: float32(sz.X),
|
||||
Y: float32(sz.Y),
|
||||
}}}
|
||||
paint.ColorOp{Color: col}.Add(&ops)
|
||||
clip.RRect{
|
||||
Rect: f32.Rectangle{
|
||||
@@ -59,7 +54,7 @@ func TestClipping(t *testing.T) {
|
||||
},
|
||||
SE: 75,
|
||||
}.Add(&ops)
|
||||
pop.Add(&ops)
|
||||
paint.PaintOp{}.Add(&ops)
|
||||
paint.ColorOp{Color: col2}.Add(&ops)
|
||||
clip.RRect{
|
||||
Rect: f32.Rectangle{
|
||||
@@ -68,7 +63,7 @@ func TestClipping(t *testing.T) {
|
||||
},
|
||||
NW: 75,
|
||||
}.Add(&ops)
|
||||
pop.Add(&ops)
|
||||
paint.PaintOp{}.Add(&ops)
|
||||
if err := w.Frame(&ops); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user