mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
internal/ops: remove Data, Version, Refs methods from Ops
They're only used internally. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -141,18 +141,6 @@ func (o *Ops) Reset() {
|
||||
o.version++
|
||||
}
|
||||
|
||||
func (o *Ops) Data() []byte {
|
||||
return o.data
|
||||
}
|
||||
|
||||
func (o *Ops) Refs() []interface{} {
|
||||
return o.refs
|
||||
}
|
||||
|
||||
func (o *Ops) Version() int {
|
||||
return o.version
|
||||
}
|
||||
|
||||
func (o *Ops) Write(n int) []byte {
|
||||
o.data = append(o.data, make([]byte, n)...)
|
||||
return o.data[len(o.data)-n:]
|
||||
|
||||
@@ -81,9 +81,9 @@ func (r *Reader) Decode() (EncodedOp, bool) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
data := r.ops.Data()
|
||||
data := r.ops.data
|
||||
data = data[r.pc.data:]
|
||||
refs := r.ops.Refs()
|
||||
refs := r.ops.refs
|
||||
if len(data) == 0 {
|
||||
if r.deferDone {
|
||||
return EncodedOp{}, false
|
||||
@@ -94,7 +94,7 @@ func (r *Reader) Decode() (EncodedOp, bool) {
|
||||
r.pc = PC{}
|
||||
continue
|
||||
}
|
||||
key := Key{ops: r.ops, pc: r.pc.data, version: r.ops.Version()}
|
||||
key := Key{ops: r.ops, pc: r.pc.data, version: r.ops.version}
|
||||
t := OpType(data[0])
|
||||
n := t.Size()
|
||||
nrefs := t.NumRefs()
|
||||
@@ -128,7 +128,7 @@ func (r *Reader) Decode() (EncodedOp, bool) {
|
||||
}
|
||||
var op macroOp
|
||||
op.decode(data, refs)
|
||||
macroData := op.ops.Data()[op.pc.data:]
|
||||
macroData := op.ops.data[op.pc.data:]
|
||||
if OpType(macroData[0]) != TypeMacro {
|
||||
panic("invalid macro reference")
|
||||
}
|
||||
|
||||
@@ -754,22 +754,3 @@ func BenchmarkRouterAdd(b *testing.B) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var benchAreaOp areaOp
|
||||
|
||||
func BenchmarkAreaOp_Decode(b *testing.B) {
|
||||
ops := new(op.Ops)
|
||||
pointer.Rect(image.Rectangle{Max: image.Pt(100, 100)}).Push(ops).Pop()
|
||||
for i := 0; i < b.N; i++ {
|
||||
benchAreaOp.Decode(ops.Internal.Data())
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkAreaOp_Hit(b *testing.B) {
|
||||
ops := new(op.Ops)
|
||||
pointer.Rect(image.Rectangle{Max: image.Pt(100, 100)}).Push(ops).Pop()
|
||||
benchAreaOp.Decode(ops.Internal.Data())
|
||||
for i := 0; i < b.N; i++ {
|
||||
benchAreaOp.Hit(f32.Pt(50, 50))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user