diff --git a/gpu/caches.go b/gpu/caches.go index 4ed461b1..7a383c20 100644 --- a/gpu/caches.go +++ b/gpu/caches.go @@ -26,7 +26,7 @@ type opCache struct { } type opCacheValue struct { - data *pathData + data pathData bounds f32.Rectangle key ops.Key keep bool @@ -120,9 +120,9 @@ func (r *opCache) frame() { if v.keep { continue } - if v.data != nil { + if v.data.data != nil { v.data.release() - r.cache[i].data = nil + r.cache[i].data.data = nil } delete(r.index, v.key) r.freelist = append(r.freelist, i) diff --git a/gpu/gpu.go b/gpu/gpu.go index cd87f2a2..0f5874d9 100644 --- a/gpu/gpu.go +++ b/gpu/gpu.go @@ -318,7 +318,7 @@ func (g *GPU) Collect(viewport image.Point, frameOps *op.Ops) { g.cleanupTimer = g.timers.newTimer() } for _, p := range g.drawOps.pathOps { - if v, exists := g.drawOps.pathCache.get(p.pathKey); !exists || v.data == nil { + if v, exists := g.drawOps.pathCache.get(p.pathKey); !exists || v.data.data == nil { data := buildPath(g.ctx, p.pathVerts) g.drawOps.pathCache.put(p.pathKey, opCacheValue{ data: data, diff --git a/gpu/path.go b/gpu/path.go index 14d0b9fc..2dd58755 100644 --- a/gpu/path.go +++ b/gpu/path.go @@ -289,18 +289,18 @@ func (c *coverer) release() { c.layout.Release() } -func buildPath(ctx backend.Device, p []byte) *pathData { +func buildPath(ctx backend.Device, p []byte) pathData { buf, err := ctx.NewImmutableBuffer(backend.BufferBindingVertices, p) if err != nil { panic(err) } - return &pathData{ + return pathData{ ncurves: len(p) / vertStride, data: buf, } } -func (p *pathData) release() { +func (p pathData) release() { p.data.Release() } @@ -308,7 +308,7 @@ func (p *pather) begin(sizes []image.Point) { p.stenciler.begin(sizes) } -func (p *pather) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data *pathData) { +func (p *pather) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data pathData) { p.stenciler.stencilPath(bounds, offset, uv, data) } @@ -338,7 +338,7 @@ func (s *stenciler) begin(sizes []image.Point) { s.ctx.BindIndexBuffer(s.indexBuf) } -func (s *stenciler) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data *pathData) { +func (s *stenciler) stencilPath(bounds image.Rectangle, offset f32.Point, uv image.Point, data pathData) { s.ctx.Viewport(uv.X, uv.Y, bounds.Dx(), bounds.Dy()) // Transform UI coordinates to OpenGL coordinates. texSize := f32.Point{X: float32(bounds.Dx()), Y: float32(bounds.Dy())}