mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +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:
@@ -14,6 +14,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"gioui.org/app/headless"
|
||||
"gioui.org/f32"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/paint"
|
||||
"golang.org/x/image/colornames"
|
||||
@@ -210,3 +211,7 @@ func newWindow(t testing.TB, width, height int) *headless.Window {
|
||||
t.Cleanup(w.Release)
|
||||
return w
|
||||
}
|
||||
|
||||
func scale(sx, sy float32) op.TransformOp {
|
||||
return op.Affine(f32.Affine2D{}.Scale(f32.Point{}, f32.Pt(sx, sy)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user