mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
all: [API] change op.Offset to take integer coordinates
op.Offset is a convenience function most often used by layouts. Layouts usually operate in integer coordinates, and the float32 version of op.Offset needlessly force conversions from int to float32. This change makes op.Offset take integer coordinates, to better match its intended use. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -124,13 +124,13 @@ func TestPaintTexture(t *testing.T) {
|
||||
func TestTexturedStrokeClipped(t *testing.T) {
|
||||
run(t, func(o *op.Ops) {
|
||||
smallSquares.Add(o)
|
||||
defer op.Offset(f32.Pt(50, 50)).Push(o).Pop()
|
||||
defer op.Offset(image.Pt(50, 50)).Push(o).Pop()
|
||||
defer clip.Stroke{
|
||||
Path: clip.RRect{Rect: f32.Rect(0, 0, 30, 30)}.Path(o),
|
||||
Width: 10,
|
||||
}.Op().Push(o).Pop()
|
||||
defer clip.RRect{Rect: f32.Rect(-30, -30, 60, 60)}.Push(o).Pop()
|
||||
defer op.Offset(f32.Pt(-10, -10)).Push(o).Pop()
|
||||
defer op.Offset(image.Pt(-10, -10)).Push(o).Pop()
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
})
|
||||
@@ -139,12 +139,12 @@ func TestTexturedStrokeClipped(t *testing.T) {
|
||||
func TestTexturedStroke(t *testing.T) {
|
||||
run(t, func(o *op.Ops) {
|
||||
smallSquares.Add(o)
|
||||
defer op.Offset(f32.Pt(50, 50)).Push(o).Pop()
|
||||
defer op.Offset(image.Pt(50, 50)).Push(o).Pop()
|
||||
defer clip.Stroke{
|
||||
Path: clip.RRect{Rect: f32.Rect(0, 0, 30, 30)}.Path(o),
|
||||
Width: 10,
|
||||
}.Op().Push(o).Pop()
|
||||
defer op.Offset(f32.Pt(-10, -10)).Push(o).Pop()
|
||||
defer op.Offset(image.Pt(-10, -10)).Push(o).Pop()
|
||||
paint.PaintOp{}.Add(o)
|
||||
}, func(r result) {
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user