text: convert clip.Ops to op.CallOp

MacroOp is about to lose the ability to run a different operation list
than the one it was recorded on. Text shape caches rely on that property,
and must use the new CallOp operation added for purpose.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-12-11 22:58:08 +01:00
parent 06217c5320
commit 0768fbe590
6 changed files with 18 additions and 18 deletions
+5 -5
View File
@@ -3,7 +3,7 @@
package text
import (
"gioui.org/op/clip"
"gioui.org/op"
"golang.org/x/image/math/fixed"
)
@@ -26,7 +26,7 @@ type layoutElem struct {
type path struct {
next, prev *path
key pathKey
val clip.Op
val op.CallOp
}
type layoutKey struct {
@@ -81,16 +81,16 @@ func (l *layoutCache) insert(lt *layoutElem) {
lt.next.prev = lt
}
func (c *pathCache) Get(k pathKey) (clip.Op, bool) {
func (c *pathCache) Get(k pathKey) (op.CallOp, bool) {
if v, ok := c.m[k]; ok {
c.remove(v)
c.insert(v)
return v.val, true
}
return clip.Op{}, false
return op.CallOp{}, false
}
func (c *pathCache) Put(k pathKey, v clip.Op) {
func (c *pathCache) Put(k pathKey, v op.CallOp) {
if c.m == nil {
c.m = make(map[pathKey]*path)
c.head = new(path)