mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 16:35:36 +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:
@@ -171,7 +171,7 @@ func draw1000CirclesInstanced(gtx layout.Context) {
|
||||
|
||||
r := op.Record(ops)
|
||||
clip.RRect{Rect: f32.Rect(0, 0, 10, 10), NE: 5, SE: 5, SW: 5, NW: 5}.Add(ops)
|
||||
paint.PaintOp{Rect: f32.Rect(0, 0, 10, 10)}.Add(ops)
|
||||
paint.PaintOp{}.Add(ops)
|
||||
c := r.Stop()
|
||||
|
||||
for x := 0; x < 100; x++ {
|
||||
@@ -228,7 +228,7 @@ func drawShapeInstances(gtx layout.Context, th *material.Theme) chan op.CallOp {
|
||||
|
||||
r := op.Record(ops)
|
||||
clip.RRect{Rect: f32.Rect(0, 0, 25, 25), NE: 10, SE: 10, SW: 10, NW: 10}.Add(ops)
|
||||
paint.PaintOp{Rect: f32.Rect(0, 0, 25, 25)}.Add(ops)
|
||||
paint.PaintOp{}.Add(ops)
|
||||
c := r.Stop()
|
||||
|
||||
squares.Add(ops)
|
||||
|
||||
Reference in New Issue
Block a user