ui/draw: rename ColorOp.Col to Color

This commit is contained in:
Elias Naur
2019-07-05 17:14:57 +02:00
parent 0f576cf625
commit 38ec6a8831
4 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -699,7 +699,7 @@ loop:
var op gdraw.ColorOp var op gdraw.ColorOp
op.Decode(encOp.Data, encOp.Refs) op.Decode(encOp.Data, encOp.Refs)
state.img = nil state.img = nil
state.color = op.Col state.color = op.Color
case ops.TypeImage: case ops.TypeImage:
var op gdraw.ImageOp var op gdraw.ImageOp
op.Decode(encOp.Data, encOp.Refs) op.Decode(encOp.Data, encOp.Refs)
+6 -6
View File
@@ -19,7 +19,7 @@ type ImageOp struct {
} }
type ColorOp struct { type ColorOp struct {
Col color.RGBA Color color.RGBA
} }
type DrawOp struct { type DrawOp struct {
@@ -61,10 +61,10 @@ func (i *ImageOp) Decode(data []byte, refs []interface{}) {
func (c ColorOp) Add(o *ui.Ops) { func (c ColorOp) Add(o *ui.Ops) {
data := make([]byte, ops.TypeColorLen) data := make([]byte, ops.TypeColorLen)
data[0] = byte(ops.TypeColor) data[0] = byte(ops.TypeColor)
data[1] = c.Col.R data[1] = c.Color.R
data[2] = c.Col.G data[2] = c.Color.G
data[3] = c.Col.B data[3] = c.Color.B
data[4] = c.Col.A data[4] = c.Color.A
o.Write(data) o.Write(data)
} }
@@ -73,7 +73,7 @@ func (c *ColorOp) Decode(data []byte, refs []interface{}) {
panic("invalid op") panic("invalid op")
} }
*c = ColorOp{ *c = ColorOp{
Col: color.RGBA{ Color: color.RGBA{
R: data[1], R: data[1],
G: data[2], G: data[2],
B: data[3], B: data[3],
+2 -2
View File
@@ -206,10 +206,10 @@ func (e *Editor) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
ui.PushOp{}.Add(ops) ui.PushOp{}.Add(ops)
// Apply material. Set a default color in case the material is empty. // Apply material. Set a default color in case the material is empty.
if e.rr.len() > 0 { if e.rr.len() > 0 {
draw.ColorOp{Col: color.RGBA{A: 0xff}}.Add(ops) draw.ColorOp{Color: color.RGBA{A: 0xff}}.Add(ops)
e.Material.Add(ops) e.Material.Add(ops)
} else { } else {
draw.ColorOp{Col: color.RGBA{A: 0xaa}}.Add(ops) draw.ColorOp{Color: color.RGBA{A: 0xaa}}.Add(ops)
e.HintMaterial.Add(ops) e.HintMaterial.Add(ops)
} }
for { for {
+1 -1
View File
@@ -111,7 +111,7 @@ func (l Label) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
ui.TransformOp{Transform: ui.Offset(off)}.Add(ops) ui.TransformOp{Transform: ui.Offset(off)}.Add(ops)
l.Face.Path(str).Add(ops) l.Face.Path(str).Add(ops)
// Set a default color in case the material is empty. // Set a default color in case the material is empty.
draw.ColorOp{Col: color.RGBA{A: 0xff}}.Add(ops) draw.ColorOp{Color: color.RGBA{A: 0xff}}.Add(ops)
l.Material.Add(ops) l.Material.Add(ops)
draw.DrawOp{Rect: lclip}.Add(ops) draw.DrawOp{Rect: lclip}.Add(ops)
ui.PopOp{}.Add(ops) ui.PopOp{}.Add(ops)