mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
op/clip: split clip operations into its own package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-5
@@ -3,7 +3,7 @@
|
||||
package text
|
||||
|
||||
import (
|
||||
"gioui.org/op/paint"
|
||||
"gioui.org/op/clip"
|
||||
"golang.org/x/image/math/fixed"
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ type layoutElem struct {
|
||||
type path struct {
|
||||
next, prev *path
|
||||
key pathKey
|
||||
val paint.ClipOp
|
||||
val clip.Op
|
||||
}
|
||||
|
||||
type layoutKey struct {
|
||||
@@ -81,16 +81,16 @@ func (l *layoutCache) insert(lt *layoutElem) {
|
||||
lt.next.prev = lt
|
||||
}
|
||||
|
||||
func (c *pathCache) Get(k pathKey) (paint.ClipOp, bool) {
|
||||
func (c *pathCache) Get(k pathKey) (clip.Op, bool) {
|
||||
if v, ok := c.m[k]; ok {
|
||||
c.remove(v)
|
||||
c.insert(v)
|
||||
return v.val, true
|
||||
}
|
||||
return paint.ClipOp{}, false
|
||||
return clip.Op{}, false
|
||||
}
|
||||
|
||||
func (c *pathCache) Put(k pathKey, v paint.ClipOp) {
|
||||
func (c *pathCache) Put(k pathKey, v clip.Op) {
|
||||
if c.m == nil {
|
||||
c.m = make(map[pathKey]*path)
|
||||
c.head = new(path)
|
||||
|
||||
Reference in New Issue
Block a user