internal/ops,gpu: remove transform fields from ops.Key

The transformation information in ops.Key is a layer violation.
Introduce a key type specific to package gpu and use that instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-07-19 16:37:06 +02:00
parent e4fe56c456
commit 62a8b80c81
3 changed files with 31 additions and 28 deletions
+3 -14
View File
@@ -5,7 +5,6 @@ package ops
import (
"encoding/binary"
"gioui.org/f32"
"gioui.org/internal/opconst"
"gioui.org/op"
)
@@ -29,10 +28,9 @@ type EncodedOp struct {
// Key is a unique key for a given op.
type Key struct {
ops *op.Ops
pc int
version int
sx, hx, sy, hy float32
ops *op.Ops
pc int
version int
}
// Shadow of op.MacroOp.
@@ -80,15 +78,6 @@ func NewPC(ops *op.Ops) PC {
}
}
func (k Key) SetTransform(t f32.Affine2D) Key {
sx, hx, _, hy, sy, _ := t.Elems()
k.sx = sx
k.hx = hx
k.hy = hy
k.sy = sy
return k
}
func (r *Reader) Decode() (EncodedOp, bool) {
if r.ops == nil {
return EncodedOp{}, false