From 9c9c70e7bab0d41418dbb81e56e066aa8a70dfc8 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 30 May 2017 01:01:19 +0900 Subject: [PATCH] graphics: Use SourceRect at image_test.go --- image_test.go | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/image_test.go b/image_test.go index 47737532f..9d383d8d0 100644 --- a/image_test.go +++ b/image_test.go @@ -490,24 +490,6 @@ func TestImageFill(t *testing.T) { } } -type halfImagePart struct { - image *Image -} - -func (p *halfImagePart) Len() int { - return 1 -} - -func (p *halfImagePart) Src(index int) (int, int, int, int) { - w, h := p.image.Size() - return 0, 0, w, h / 2 -} - -func (p *halfImagePart) Dst(index int) (int, int, int, int) { - w, h := p.image.Size() - return 0, 0, w, h / 2 -} - // Issue 317 func TestImageEdge(t *testing.T) { const ( @@ -555,7 +537,9 @@ func TestImageEdge(t *testing.T) { t.Fatal(err) } op := &DrawImageOptions{} - op.ImageParts = &halfImagePart{img0} + w, h := img0.Size() + r := image.Rect(0, 0, w, h/2) + op.SourceRect = &r op.GeoM.Translate(-float64(img0Width)/2, -float64(img0Height)/2) op.GeoM.Rotate(float64(a) * math.Pi / 180) op.GeoM.Translate(img1Width/2, img1Height/2)