mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
ui: build paths as ops
Instead of allocating and constructing a clip path, store path data directly in op lists. Use separate op lists for cached text layout paths. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+3
-8
@@ -11,7 +11,6 @@ import (
|
||||
"gioui.org/ui"
|
||||
"gioui.org/ui/f32"
|
||||
"gioui.org/ui/internal/ops"
|
||||
"gioui.org/ui/internal/path"
|
||||
)
|
||||
|
||||
type OpImage struct {
|
||||
@@ -114,14 +113,10 @@ func (d *OpDraw) Decode(data []byte, refs []interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
// RectPath constructs a path corresponding to
|
||||
// RectClip append a clip op corresponding to
|
||||
// a pixel aligned rectangular area.
|
||||
func RectPath(r image.Rectangle) *Path {
|
||||
return &Path{
|
||||
data: &path.Path{
|
||||
Bounds: toRectF(r),
|
||||
},
|
||||
}
|
||||
func RectClip(ops *ui.Ops, r image.Rectangle) {
|
||||
opClip{bounds: toRectF(r)}.Add(ops)
|
||||
}
|
||||
|
||||
func itof(i int) float32 {
|
||||
|
||||
Reference in New Issue
Block a user