gpu: avoid pointers of pathData

Save allocations by using pathData instead of *pathData.

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
This commit is contained in:
Viktor
2020-06-20 23:30:00 +02:00
committed by Elias Naur
parent 42f07ca538
commit 901478d102
3 changed files with 9 additions and 9 deletions
+5 -5
View File
@@ -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())}