mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
op: move Ops internal methods and state to internal package ops
Merge package opconsts into ops as well; it only existed to break import cycles. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+9
-9
@@ -10,7 +10,7 @@ import (
|
||||
"math"
|
||||
|
||||
"gioui.org/f32"
|
||||
"gioui.org/internal/opconst"
|
||||
"gioui.org/internal/ops"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/clip"
|
||||
)
|
||||
@@ -96,13 +96,13 @@ func (i ImageOp) Add(o *op.Ops) {
|
||||
} else if i.src == nil || i.src.Bounds().Empty() {
|
||||
return
|
||||
}
|
||||
data := o.Write2(opconst.TypeImageLen, i.src, i.handle)
|
||||
data[0] = byte(opconst.TypeImage)
|
||||
data := o.Internal.Write2(ops.TypeImageLen, i.src, i.handle)
|
||||
data[0] = byte(ops.TypeImage)
|
||||
}
|
||||
|
||||
func (c ColorOp) Add(o *op.Ops) {
|
||||
data := o.Write(opconst.TypeColorLen)
|
||||
data[0] = byte(opconst.TypeColor)
|
||||
data := o.Internal.Write(ops.TypeColorLen)
|
||||
data[0] = byte(ops.TypeColor)
|
||||
data[1] = c.Color.R
|
||||
data[2] = c.Color.G
|
||||
data[3] = c.Color.B
|
||||
@@ -110,8 +110,8 @@ func (c ColorOp) Add(o *op.Ops) {
|
||||
}
|
||||
|
||||
func (c LinearGradientOp) Add(o *op.Ops) {
|
||||
data := o.Write(opconst.TypeLinearGradientLen)
|
||||
data[0] = byte(opconst.TypeLinearGradient)
|
||||
data := o.Internal.Write(ops.TypeLinearGradientLen)
|
||||
data[0] = byte(ops.TypeLinearGradient)
|
||||
|
||||
bo := binary.LittleEndian
|
||||
bo.PutUint32(data[1:], math.Float32bits(c.Stop1.X))
|
||||
@@ -130,8 +130,8 @@ func (c LinearGradientOp) Add(o *op.Ops) {
|
||||
}
|
||||
|
||||
func (d PaintOp) Add(o *op.Ops) {
|
||||
data := o.Write(opconst.TypePaintLen)
|
||||
data[0] = byte(opconst.TypePaint)
|
||||
data := o.Internal.Write(ops.TypePaintLen)
|
||||
data[0] = byte(ops.TypePaint)
|
||||
}
|
||||
|
||||
// FillShape fills the clip shape with a color.
|
||||
|
||||
Reference in New Issue
Block a user