aboutsummaryrefslogtreecommitdiff
path: root/vendor/gioui.org/gpu/caches.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gioui.org/gpu/caches.go')
-rw-r--r--vendor/gioui.org/gpu/caches.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/vendor/gioui.org/gpu/caches.go b/vendor/gioui.org/gpu/caches.go
index cefba83..c6a71bc 100644
--- a/vendor/gioui.org/gpu/caches.go
+++ b/vendor/gioui.org/gpu/caches.go
@@ -6,7 +6,6 @@ import (
"fmt"
"gioui.org/f32"
- "gioui.org/internal/ops"
)
type resourceCache struct {
@@ -19,17 +18,18 @@ type resourceCache struct {
// since benchmarking showed them as a bottleneck.
type opCache struct {
// store the index + 1 in cache this key is stored in
- index map[ops.Key]int
+ index map[opKey]int
// list of indexes in cache that are free and can be used
freelist []int
cache []opCacheValue
}
type opCacheValue struct {
- data pathData
+ data pathData
+
bounds f32.Rectangle
// the fields below are handled by opCache
- key ops.Key
+ key opKey
keep bool
}
@@ -70,7 +70,8 @@ func (r *resourceCache) frame() {
}
func (r *resourceCache) release() {
- for _, v := range r.newRes {
+ r.frame()
+ for _, v := range r.res {
v.release()
}
r.newRes = nil
@@ -79,13 +80,13 @@ func (r *resourceCache) release() {
func newOpCache() *opCache {
return &opCache{
- index: make(map[ops.Key]int),
+ index: make(map[opKey]int),
freelist: make([]int, 0),
cache: make([]opCacheValue, 0),
}
}
-func (r *opCache) get(key ops.Key) (o opCacheValue, exist bool) {
+func (r *opCache) get(key opKey) (o opCacheValue, exist bool) {
v := r.index[key]
if v == 0 {
return
@@ -94,7 +95,7 @@ func (r *opCache) get(key ops.Key) (o opCacheValue, exist bool) {
return r.cache[v-1], true
}
-func (r *opCache) put(key ops.Key, val opCacheValue) {
+func (r *opCache) put(key opKey, val opCacheValue) {
v := r.index[key]
val.keep = true
val.key = key