Skip to content

Commit 80a7315

Browse files
ryomakgopherbot
authored andcommitted
image/draw: replace deprecated image.ZP and image.ZR in xx_test.go
Change-Id: I87545a46e5871452075152b4c99ba85089ef86b8 Reviewed-on: https://go-review.googlesource.com/c/go/+/506735 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Run-TryBot: Bryan Mills <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
1 parent 1136dea commit 80a7315

File tree

4 files changed

+43
-43
lines changed

4 files changed

+43
-43
lines changed

src/image/draw/bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func bench(b *testing.B, dcm, scm, mcm color.Model, op Op) {
186186
x := 3 * i % (dstw - srcw)
187187
y := 7 * i % (dsth - srch)
188188

189-
DrawMask(dst, dst.Bounds().Add(image.Pt(x, y)), src, image.ZP, mask, image.ZP, op)
189+
DrawMask(dst, dst.Bounds().Add(image.Pt(x, y)), src, image.Point{}, mask, image.Point{}, op)
190190
}
191191
}
192192

src/image/draw/clip_test.go

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -25,104 +25,104 @@ var clipTests = []clipTest{
2525
image.Rect(0, 0, 100, 100),
2626
image.Rect(0, 0, 100, 100),
2727
image.Rect(0, 0, 100, 100),
28-
image.ZR,
29-
image.ZP,
30-
image.ZP,
28+
image.Rectangle{},
29+
image.Point{},
30+
image.Point{},
3131
true,
3232
image.Rect(0, 0, 100, 100),
33-
image.ZP,
34-
image.ZP,
33+
image.Point{},
34+
image.Point{},
3535
},
3636
{
3737
"clip dr",
3838
image.Rect(0, 0, 100, 100),
3939
image.Rect(40, 40, 60, 60),
4040
image.Rect(0, 0, 100, 100),
41-
image.ZR,
42-
image.ZP,
43-
image.ZP,
41+
image.Rectangle{},
42+
image.Point{},
43+
image.Point{},
4444
true,
4545
image.Rect(40, 40, 60, 60),
4646
image.Pt(40, 40),
47-
image.ZP,
47+
image.Point{},
4848
},
4949
{
5050
"clip sr",
5151
image.Rect(0, 0, 100, 100),
5252
image.Rect(0, 0, 100, 100),
5353
image.Rect(20, 20, 80, 80),
54-
image.ZR,
55-
image.ZP,
56-
image.ZP,
54+
image.Rectangle{},
55+
image.Point{},
56+
image.Point{},
5757
true,
5858
image.Rect(20, 20, 80, 80),
5959
image.Pt(20, 20),
60-
image.ZP,
60+
image.Point{},
6161
},
6262
{
6363
"clip dr and sr",
6464
image.Rect(0, 0, 100, 100),
6565
image.Rect(0, 0, 50, 100),
6666
image.Rect(20, 20, 80, 80),
67-
image.ZR,
68-
image.ZP,
69-
image.ZP,
67+
image.Rectangle{},
68+
image.Point{},
69+
image.Point{},
7070
true,
7171
image.Rect(20, 20, 50, 80),
7272
image.Pt(20, 20),
73-
image.ZP,
73+
image.Point{},
7474
},
7575
{
7676
"clip dr and sr, sp outside sr (top-left)",
7777
image.Rect(0, 0, 100, 100),
7878
image.Rect(0, 0, 50, 100),
7979
image.Rect(20, 20, 80, 80),
80-
image.ZR,
80+
image.Rectangle{},
8181
image.Pt(15, 8),
82-
image.ZP,
82+
image.Point{},
8383
true,
8484
image.Rect(5, 12, 50, 72),
8585
image.Pt(20, 20),
86-
image.ZP,
86+
image.Point{},
8787
},
8888
{
8989
"clip dr and sr, sp outside sr (middle-left)",
9090
image.Rect(0, 0, 100, 100),
9191
image.Rect(0, 0, 50, 100),
9292
image.Rect(20, 20, 80, 80),
93-
image.ZR,
93+
image.Rectangle{},
9494
image.Pt(15, 66),
95-
image.ZP,
95+
image.Point{},
9696
true,
9797
image.Rect(5, 0, 50, 14),
9898
image.Pt(20, 66),
99-
image.ZP,
99+
image.Point{},
100100
},
101101
{
102102
"clip dr and sr, sp outside sr (bottom-left)",
103103
image.Rect(0, 0, 100, 100),
104104
image.Rect(0, 0, 50, 100),
105105
image.Rect(20, 20, 80, 80),
106-
image.ZR,
106+
image.Rectangle{},
107107
image.Pt(15, 91),
108-
image.ZP,
108+
image.Point{},
109109
true,
110-
image.ZR,
110+
image.Rectangle{},
111111
image.Pt(15, 91),
112-
image.ZP,
112+
image.Point{},
113113
},
114114
{
115115
"clip dr and sr, sp inside sr",
116116
image.Rect(0, 0, 100, 100),
117117
image.Rect(0, 0, 50, 100),
118118
image.Rect(20, 20, 80, 80),
119-
image.ZR,
119+
image.Rectangle{},
120120
image.Pt(44, 33),
121-
image.ZP,
121+
image.Point{},
122122
true,
123123
image.Rect(0, 0, 36, 47),
124124
image.Pt(44, 33),
125-
image.ZP,
125+
image.Point{},
126126
},
127127

128128
// The following tests all have a non-nil mask.
@@ -132,8 +132,8 @@ var clipTests = []clipTest{
132132
image.Rect(20, 0, 100, 80),
133133
image.Rect(0, 0, 50, 49),
134134
image.Rect(0, 0, 46, 47),
135-
image.ZP,
136-
image.ZP,
135+
image.Point{},
136+
image.Point{},
137137
false,
138138
image.Rect(20, 0, 46, 47),
139139
image.Pt(20, 0),

src/image/draw/draw_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"testing/quick"
1414
)
1515

16-
// slowestRGBA is a draw.Image like image.RGBA but it is a different type and
16+
// slowestRGBA is a draw.Image like image.RGBA, but it is a different type and
1717
// therefore does not trigger the draw.go fastest code paths.
1818
//
1919
// Unlike slowerRGBA, it does not implement the draw.RGBA64Image interface.
@@ -484,15 +484,15 @@ func TestDraw(t *testing.T) {
484484
}
485485

486486
// Draw the (src, mask, op) onto a copy of dst using a slow but obviously correct implementation.
487-
golden := makeGolden(dst, image.Rect(0, 0, 16, 16), test.src, image.ZP, test.mask, image.ZP, test.op)
487+
golden := makeGolden(dst, image.Rect(0, 0, 16, 16), test.src, image.Point{}, test.mask, image.Point{}, test.op)
488488
b := dst.Bounds()
489489
if !b.Eq(golden.Bounds()) {
490490
t.Errorf("draw %v %s on %T: bounds %v versus %v",
491491
r, test.desc, dst, dst.Bounds(), golden.Bounds())
492492
continue
493493
}
494494
// Draw the same combination onto the actual dst using the optimized DrawMask implementation.
495-
DrawMask(dst, image.Rect(0, 0, 16, 16), test.src, image.ZP, test.mask, image.ZP, test.op)
495+
DrawMask(dst, image.Rect(0, 0, 16, 16), test.src, image.Point{}, test.mask, image.Point{}, test.op)
496496
if image.Pt(8, 8).In(r) {
497497
// Check that the resultant pixel at (8, 8) matches what we expect
498498
// (the expected value can be verified by hand).
@@ -527,13 +527,13 @@ func TestDrawOverlap(t *testing.T) {
527527
src := m.SubImage(image.Rect(5+xoff, 5+yoff, 10+xoff, 10+yoff)).(*image.RGBA)
528528
b := dst.Bounds()
529529
// Draw the (src, mask, op) onto a copy of dst using a slow but obviously correct implementation.
530-
golden := makeGolden(dst, b, src, src.Bounds().Min, nil, image.ZP, op)
530+
golden := makeGolden(dst, b, src, src.Bounds().Min, nil, image.Point{}, op)
531531
if !b.Eq(golden.Bounds()) {
532532
t.Errorf("drawOverlap xoff=%d,yoff=%d: bounds %v versus %v", xoff, yoff, dst.Bounds(), golden.Bounds())
533533
continue
534534
}
535535
// Draw the same combination onto the actual dst using the optimized DrawMask implementation.
536-
DrawMask(dst, b, src, src.Bounds().Min, nil, image.ZP, op)
536+
DrawMask(dst, b, src, src.Bounds().Min, nil, image.Point{}, op)
537537
// Check that the resultant dst image matches the golden output.
538538
for y := b.Min.Y; y < b.Max.Y; y++ {
539539
for x := b.Min.X; x < b.Max.X; x++ {
@@ -596,28 +596,28 @@ func TestFill(t *testing.T) {
596596
// Draw 1 pixel at a time.
597597
for y := b.Min.Y; y < b.Max.Y; y++ {
598598
for x := b.Min.X; x < b.Max.X; x++ {
599-
DrawMask(m, image.Rect(x, y, x+1, y+1), src, image.ZP, nil, image.ZP, Src)
599+
DrawMask(m, image.Rect(x, y, x+1, y+1), src, image.Point{}, nil, image.Point{}, Src)
600600
}
601601
}
602602
check("pixel")
603603
// Draw 1 row at a time.
604604
c = color.RGBA{0, 22, 0, 255}
605605
src = &image.Uniform{C: c}
606606
for y := b.Min.Y; y < b.Max.Y; y++ {
607-
DrawMask(m, image.Rect(b.Min.X, y, b.Max.X, y+1), src, image.ZP, nil, image.ZP, Src)
607+
DrawMask(m, image.Rect(b.Min.X, y, b.Max.X, y+1), src, image.Point{}, nil, image.Point{}, Src)
608608
}
609609
check("row")
610610
// Draw 1 column at a time.
611611
c = color.RGBA{0, 0, 33, 255}
612612
src = &image.Uniform{C: c}
613613
for x := b.Min.X; x < b.Max.X; x++ {
614-
DrawMask(m, image.Rect(x, b.Min.Y, x+1, b.Max.Y), src, image.ZP, nil, image.ZP, Src)
614+
DrawMask(m, image.Rect(x, b.Min.Y, x+1, b.Max.Y), src, image.Point{}, nil, image.Point{}, Src)
615615
}
616616
check("column")
617617
// Draw the whole image at once.
618618
c = color.RGBA{44, 55, 66, 77}
619619
src = &image.Uniform{C: c}
620-
DrawMask(m, b, src, image.ZP, nil, image.ZP, Src)
620+
DrawMask(m, b, src, image.Point{}, nil, image.Point{}, Src)
621621
check("whole")
622622
}
623623
}

src/image/draw/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func ExampleDrawer_floydSteinberg() {
3737
color.Gray{Y: 0},
3838
})
3939

40-
draw.FloydSteinberg.Draw(pi, im.Bounds(), im, image.ZP)
40+
draw.FloydSteinberg.Draw(pi, im.Bounds(), im, image.Point{})
4141
shade := []string{" ", "░", "▒", "▓", "█"}
4242
for i, p := range pi.Pix {
4343
fmt.Print(shade[p])

0 commit comments

Comments
 (0)