]> Cypherpunks repositories - gostls13.git/commitdiff
image/draw: replace deprecated image.ZP and image.ZR in xx_test.go
authorryomak <ryooomaaa0413@gmail.com>
Wed, 28 Jun 2023 13:06:38 +0000 (22:06 +0900)
committerGopher Robot <gobot@golang.org>
Thu, 20 Jul 2023 18:07:05 +0000 (18:07 +0000)
Change-Id: I87545a46e5871452075152b4c99ba85089ef86b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/506735
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/image/draw/bench_test.go
src/image/draw/clip_test.go
src/image/draw/draw_test.go
src/image/draw/example_test.go

index 55d25b85963f422794923b6c10450372d4918aba..956f4ef971ba4d0dbacf73e8f2b5ca10e62f5bfa 100644 (file)
@@ -186,7 +186,7 @@ func bench(b *testing.B, dcm, scm, mcm color.Model, op Op) {
                x := 3 * i % (dstw - srcw)
                y := 7 * i % (dsth - srch)
 
-               DrawMask(dst, dst.Bounds().Add(image.Pt(x, y)), src, image.ZP, mask, image.ZP, op)
+               DrawMask(dst, dst.Bounds().Add(image.Pt(x, y)), src, image.Point{}, mask, image.Point{}, op)
        }
 }
 
index 0abf53e5c78e3ad9647a9722fc9f404570a4bd17..7bbbf7e9f93422a054575e56f8bed20ec330761b 100644 (file)
@@ -25,104 +25,104 @@ var clipTests = []clipTest{
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 100, 100),
-               image.ZR,
-               image.ZP,
-               image.ZP,
+               image.Rectangle{},
+               image.Point{},
+               image.Point{},
                true,
                image.Rect(0, 0, 100, 100),
-               image.ZP,
-               image.ZP,
+               image.Point{},
+               image.Point{},
        },
        {
                "clip dr",
                image.Rect(0, 0, 100, 100),
                image.Rect(40, 40, 60, 60),
                image.Rect(0, 0, 100, 100),
-               image.ZR,
-               image.ZP,
-               image.ZP,
+               image.Rectangle{},
+               image.Point{},
+               image.Point{},
                true,
                image.Rect(40, 40, 60, 60),
                image.Pt(40, 40),
-               image.ZP,
+               image.Point{},
        },
        {
                "clip sr",
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 100, 100),
                image.Rect(20, 20, 80, 80),
-               image.ZR,
-               image.ZP,
-               image.ZP,
+               image.Rectangle{},
+               image.Point{},
+               image.Point{},
                true,
                image.Rect(20, 20, 80, 80),
                image.Pt(20, 20),
-               image.ZP,
+               image.Point{},
        },
        {
                "clip dr and sr",
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 50, 100),
                image.Rect(20, 20, 80, 80),
-               image.ZR,
-               image.ZP,
-               image.ZP,
+               image.Rectangle{},
+               image.Point{},
+               image.Point{},
                true,
                image.Rect(20, 20, 50, 80),
                image.Pt(20, 20),
-               image.ZP,
+               image.Point{},
        },
        {
                "clip dr and sr, sp outside sr (top-left)",
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 50, 100),
                image.Rect(20, 20, 80, 80),
-               image.ZR,
+               image.Rectangle{},
                image.Pt(15, 8),
-               image.ZP,
+               image.Point{},
                true,
                image.Rect(5, 12, 50, 72),
                image.Pt(20, 20),
-               image.ZP,
+               image.Point{},
        },
        {
                "clip dr and sr, sp outside sr (middle-left)",
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 50, 100),
                image.Rect(20, 20, 80, 80),
-               image.ZR,
+               image.Rectangle{},
                image.Pt(15, 66),
-               image.ZP,
+               image.Point{},
                true,
                image.Rect(5, 0, 50, 14),
                image.Pt(20, 66),
-               image.ZP,
+               image.Point{},
        },
        {
                "clip dr and sr, sp outside sr (bottom-left)",
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 50, 100),
                image.Rect(20, 20, 80, 80),
-               image.ZR,
+               image.Rectangle{},
                image.Pt(15, 91),
-               image.ZP,
+               image.Point{},
                true,
-               image.ZR,
+               image.Rectangle{},
                image.Pt(15, 91),
-               image.ZP,
+               image.Point{},
        },
        {
                "clip dr and sr, sp inside sr",
                image.Rect(0, 0, 100, 100),
                image.Rect(0, 0, 50, 100),
                image.Rect(20, 20, 80, 80),
-               image.ZR,
+               image.Rectangle{},
                image.Pt(44, 33),
-               image.ZP,
+               image.Point{},
                true,
                image.Rect(0, 0, 36, 47),
                image.Pt(44, 33),
-               image.ZP,
+               image.Point{},
        },
 
        // The following tests all have a non-nil mask.
@@ -132,8 +132,8 @@ var clipTests = []clipTest{
                image.Rect(20, 0, 100, 80),
                image.Rect(0, 0, 50, 49),
                image.Rect(0, 0, 46, 47),
-               image.ZP,
-               image.ZP,
+               image.Point{},
+               image.Point{},
                false,
                image.Rect(20, 0, 46, 47),
                image.Pt(20, 0),
index a34d1c3e6e8ab95778fcc4dea657e1a20e68b58b..ff9e71daab6330d867a56bfbe6e7b7d2b4f18844 100644 (file)
@@ -13,7 +13,7 @@ import (
        "testing/quick"
 )
 
-// slowestRGBA is a draw.Image like image.RGBA but it is a different type and
+// slowestRGBA is a draw.Image like image.RGBA, but it is a different type and
 // therefore does not trigger the draw.go fastest code paths.
 //
 // Unlike slowerRGBA, it does not implement the draw.RGBA64Image interface.
@@ -484,7 +484,7 @@ func TestDraw(t *testing.T) {
                                }
 
                                // Draw the (src, mask, op) onto a copy of dst using a slow but obviously correct implementation.
-                               golden := makeGolden(dst, image.Rect(0, 0, 16, 16), test.src, image.ZP, test.mask, image.ZP, test.op)
+                               golden := makeGolden(dst, image.Rect(0, 0, 16, 16), test.src, image.Point{}, test.mask, image.Point{}, test.op)
                                b := dst.Bounds()
                                if !b.Eq(golden.Bounds()) {
                                        t.Errorf("draw %v %s on %T: bounds %v versus %v",
@@ -492,7 +492,7 @@ func TestDraw(t *testing.T) {
                                        continue
                                }
                                // Draw the same combination onto the actual dst using the optimized DrawMask implementation.
-                               DrawMask(dst, image.Rect(0, 0, 16, 16), test.src, image.ZP, test.mask, image.ZP, test.op)
+                               DrawMask(dst, image.Rect(0, 0, 16, 16), test.src, image.Point{}, test.mask, image.Point{}, test.op)
                                if image.Pt(8, 8).In(r) {
                                        // Check that the resultant pixel at (8, 8) matches what we expect
                                        // (the expected value can be verified by hand).
@@ -527,13 +527,13 @@ func TestDrawOverlap(t *testing.T) {
                                src := m.SubImage(image.Rect(5+xoff, 5+yoff, 10+xoff, 10+yoff)).(*image.RGBA)
                                b := dst.Bounds()
                                // Draw the (src, mask, op) onto a copy of dst using a slow but obviously correct implementation.
-                               golden := makeGolden(dst, b, src, src.Bounds().Min, nil, image.ZP, op)
+                               golden := makeGolden(dst, b, src, src.Bounds().Min, nil, image.Point{}, op)
                                if !b.Eq(golden.Bounds()) {
                                        t.Errorf("drawOverlap xoff=%d,yoff=%d: bounds %v versus %v", xoff, yoff, dst.Bounds(), golden.Bounds())
                                        continue
                                }
                                // Draw the same combination onto the actual dst using the optimized DrawMask implementation.
-                               DrawMask(dst, b, src, src.Bounds().Min, nil, image.ZP, op)
+                               DrawMask(dst, b, src, src.Bounds().Min, nil, image.Point{}, op)
                                // Check that the resultant dst image matches the golden output.
                                for y := b.Min.Y; y < b.Max.Y; y++ {
                                        for x := b.Min.X; x < b.Max.X; x++ {
@@ -596,7 +596,7 @@ func TestFill(t *testing.T) {
                // Draw 1 pixel at a time.
                for y := b.Min.Y; y < b.Max.Y; y++ {
                        for x := b.Min.X; x < b.Max.X; x++ {
-                               DrawMask(m, image.Rect(x, y, x+1, y+1), src, image.ZP, nil, image.ZP, Src)
+                               DrawMask(m, image.Rect(x, y, x+1, y+1), src, image.Point{}, nil, image.Point{}, Src)
                        }
                }
                check("pixel")
@@ -604,20 +604,20 @@ func TestFill(t *testing.T) {
                c = color.RGBA{0, 22, 0, 255}
                src = &image.Uniform{C: c}
                for y := b.Min.Y; y < b.Max.Y; y++ {
-                       DrawMask(m, image.Rect(b.Min.X, y, b.Max.X, y+1), src, image.ZP, nil, image.ZP, Src)
+                       DrawMask(m, image.Rect(b.Min.X, y, b.Max.X, y+1), src, image.Point{}, nil, image.Point{}, Src)
                }
                check("row")
                // Draw 1 column at a time.
                c = color.RGBA{0, 0, 33, 255}
                src = &image.Uniform{C: c}
                for x := b.Min.X; x < b.Max.X; x++ {
-                       DrawMask(m, image.Rect(x, b.Min.Y, x+1, b.Max.Y), src, image.ZP, nil, image.ZP, Src)
+                       DrawMask(m, image.Rect(x, b.Min.Y, x+1, b.Max.Y), src, image.Point{}, nil, image.Point{}, Src)
                }
                check("column")
                // Draw the whole image at once.
                c = color.RGBA{44, 55, 66, 77}
                src = &image.Uniform{C: c}
-               DrawMask(m, b, src, image.ZP, nil, image.ZP, Src)
+               DrawMask(m, b, src, image.Point{}, nil, image.Point{}, Src)
                check("whole")
        }
 }
index 2ccc2f4acdbffd88469ca27df79e6c3479adf32c..bfa6355fe3b299ce4109fdcbed1394d9b4d0da59 100644 (file)
@@ -37,7 +37,7 @@ func ExampleDrawer_floydSteinberg() {
                color.Gray{Y: 0},
        })
 
-       draw.FloydSteinberg.Draw(pi, im.Bounds(), im, image.ZP)
+       draw.FloydSteinberg.Draw(pi, im.Bounds(), im, image.Point{})
        shade := []string{" ", "░", "▒", "▓", "█"}
        for i, p := range pi.Pix {
                fmt.Print(shade[p])