ui: make the reference list argument to Ops.Write variadic

Makes the code nicer.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-03 14:07:56 +02:00
parent 402837bbfa
commit 955fe1bc77
6 changed files with 25 additions and 21 deletions
+3 -3
View File
@@ -34,7 +34,7 @@ func (i OpImage) Add(o *ui.Ops) {
bo.PutUint32(data[5:], uint32(i.Rect.Min.Y))
bo.PutUint32(data[9:], uint32(i.Rect.Max.X))
bo.PutUint32(data[13:], uint32(i.Rect.Max.Y))
o.Write(data, []interface{}{i.Img})
o.Write(data, i.Img)
}
func (i *OpImage) Decode(data []byte, refs []interface{}) {
@@ -65,7 +65,7 @@ func (c OpColor) Add(o *ui.Ops) {
data[2] = c.Col.G
data[3] = c.Col.B
data[4] = c.Col.A
o.Write(data, nil)
o.Write(data)
}
func (c *OpColor) Decode(data []byte, refs []interface{}) {
@@ -90,7 +90,7 @@ func (d OpDraw) Add(o *ui.Ops) {
bo.PutUint32(data[5:], math.Float32bits(d.Rect.Min.Y))
bo.PutUint32(data[9:], math.Float32bits(d.Rect.Max.X))
bo.PutUint32(data[13:], math.Float32bits(d.Rect.Max.Y))
o.Write(data, nil)
o.Write(data)
}
func (d *OpDraw) Decode(data []byte, refs []interface{}) {
+2 -2
View File
@@ -35,7 +35,7 @@ func (p opClip) Add(o *ui.Ops) {
bo.PutUint32(data[5:], math.Float32bits(p.bounds.Min.Y))
bo.PutUint32(data[9:], math.Float32bits(p.bounds.Max.X))
bo.PutUint32(data[13:], math.Float32bits(p.bounds.Max.Y))
o.Write(data, nil)
o.Write(data)
}
// MoveTo moves the pen to the given position.
@@ -246,7 +246,7 @@ func (p *PathBuilder) vertex(o *ui.Ops, cornerx, cornery int16, ctrl, to f32.Poi
bo.PutUint32(data[21:], math.Float32bits(v.CtrlY))
bo.PutUint32(data[25:], math.Float32bits(v.ToX))
bo.PutUint32(data[29:], math.Float32bits(v.ToY))
o.Write(data, nil)
o.Write(data)
}
func (p *PathBuilder) simpleQuadTo(ops *ui.Ops, ctrl, to f32.Point) {