font/opentype,text,widget: use clip.Op for text shapes, not a macro

This change avoids a macro wrapping every text shape, and prepares text
shaping for scoped clip operations.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-10-02 18:11:31 +02:00
parent cd5a78f3d8
commit c1298cd755
7 changed files with 26 additions and 29 deletions
+5 -6
View File
@@ -3,9 +3,8 @@
package text
import (
"gioui.org/op/clip"
"golang.org/x/image/math/fixed"
"gioui.org/op"
)
type layoutCache struct {
@@ -27,7 +26,7 @@ type layoutElem struct {
type path struct {
next, prev *path
key pathKey
val op.CallOp
val clip.Op
}
type layoutKey struct {
@@ -82,16 +81,16 @@ func (l *layoutCache) insert(lt *layoutElem) {
lt.next.prev = lt
}
func (c *pathCache) Get(k pathKey) (op.CallOp, 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 op.CallOp{}, false
return clip.Op{}, false
}
func (c *pathCache) Put(k pathKey, v op.CallOp) {
func (c *pathCache) Put(k pathKey, v clip.Op) {
if c.m == nil {
c.m = make(map[pathKey]*path)
c.head = new(path)