mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 09:25:38 +00:00
text,widget,opentype: change text.Face.Shape to return a clip.PathSpec
With this change, the Shape function returns a clip.PathSpec instead of a clip.Outline op. It is then possible to create a clip.Outline or clip.Stroke op to fill the text path or draw its stroke. Signed-off-by: Christophe Meessen <meessen@cppm.in2p3.fr>
This commit is contained in:
committed by
Elias Naur
parent
3db11cbaad
commit
a34e239c04
+4
-4
@@ -26,7 +26,7 @@ type layoutElem struct {
|
||||
type path struct {
|
||||
next, prev *path
|
||||
key pathKey
|
||||
val clip.Op
|
||||
val clip.PathSpec
|
||||
}
|
||||
|
||||
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) (clip.PathSpec, bool) {
|
||||
if v, ok := c.m[k]; ok {
|
||||
c.remove(v)
|
||||
c.insert(v)
|
||||
return v.val, true
|
||||
}
|
||||
return clip.Op{}, false
|
||||
return clip.PathSpec{}, false
|
||||
}
|
||||
|
||||
func (c *pathCache) Put(k pathKey, v clip.Op) {
|
||||
func (c *pathCache) Put(k pathKey, v clip.PathSpec) {
|
||||
if c.m == nil {
|
||||
c.m = make(map[pathKey]*path)
|
||||
c.head = new(path)
|
||||
|
||||
Reference in New Issue
Block a user