diff --git a/ebitenutil/debugprint.go b/ebitenutil/debugprint.go index b34292f3b..59aae90a6 100644 --- a/ebitenutil/debugprint.go +++ b/ebitenutil/debugprint.go @@ -78,7 +78,7 @@ func drawDebugText(rt *ebiten.Image, str string, ox, oy int, shadow bool) { op.GeoM.Reset() op.GeoM.Translate(float64(x), float64(y)) op.GeoM.Translate(float64(ox+1), float64(oy)) - _ = rt.DrawImage(s, op) + rt.DrawImage(s, op) x += cw } } diff --git a/ebitenutil/shapes.go b/ebitenutil/shapes.go index 0027bb96e..9b1cf046a 100644 --- a/ebitenutil/shapes.go +++ b/ebitenutil/shapes.go @@ -47,7 +47,7 @@ func DrawLine(dst *ebiten.Image, x1, y1, x2, y2 float64, clr color.Color) { op.ColorM = colormcache.ColorToColorM(clr) // Filter must be 'nearest' filter (default). // Linear filtering would make edges blurred. - _ = dst.DrawImage(emptyImage, op) + dst.DrawImage(emptyImage, op) } // DrawRect draws a rectangle on the given destination dst. @@ -64,5 +64,5 @@ func DrawRect(dst *ebiten.Image, x, y, width, height float64, clr color.Color) { op.ColorM = colormcache.ColorToColorM(clr) // Filter must be 'nearest' filter (default). // Linear filtering would make edges blurred. - _ = dst.DrawImage(emptyImage, op) + dst.DrawImage(emptyImage, op) } diff --git a/examples/camera/main.go b/examples/camera/main.go index bf4d254fb..f71792e85 100644 --- a/examples/camera/main.go +++ b/examples/camera/main.go @@ -103,8 +103,8 @@ func (c *Camera) worldMatrix() ebiten.GeoM { return m } -func (c *Camera) Render(world, screen *ebiten.Image) error { - return screen.DrawImage(world, &ebiten.DrawImageOptions{ +func (c *Camera) Render(world, screen *ebiten.Image) { + screen.DrawImage(world, &ebiten.DrawImageOptions{ GeoM: c.worldMatrix(), }) } diff --git a/image.go b/image.go index 9bf213331..bfd4de41a 100644 --- a/image.go +++ b/image.go @@ -154,16 +154,14 @@ type DrawImageOptions struct { // share the texture atlas with high probability. // // For more performance tips, see https://ebiten.org/documents/performancetips.html -// -// DrawImage always returns nil as of 1.5.0. -func (i *Image) DrawImage(img *Image, options *DrawImageOptions) error { +func (i *Image) DrawImage(img *Image, options *DrawImageOptions) { i.copyCheck() if img.isDisposed() { panic("ebiten: the given image to DrawImage must not be disposed") } if i.isDisposed() { - return nil + return } // TODO: Implement this. @@ -192,7 +190,6 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) error { srcs := [graphics.ShaderImageNum]*mipmap.Mipmap{img.mipmap} i.mipmap.DrawTriangles(srcs, vs, is, options.ColorM.impl, mode, filter, driver.AddressUnsafe, driver.Region{}, [graphics.ShaderImageNum - 1][2]float32{}, nil, nil, canSkipMipmap(options.GeoM, filter)) - return nil } // Vertex represents a vertex passed to DrawTriangles. diff --git a/image_test.go b/image_test.go index c8d48273d..fa841ba83 100644 --- a/image_test.go +++ b/image_test.go @@ -142,18 +142,9 @@ func TestImageComposition(t *testing.T) { t.Fatal(err) return } - if err := img2.DrawImage(img1, nil); err != nil { - t.Fatal(err) - return - } - if err := img3.DrawImage(img2, nil); err != nil { - t.Fatal(err) - return - } - if err := img_12_3.DrawImage(img3, nil); err != nil { - t.Fatal(err) - return - } + img2.DrawImage(img1, nil) + img3.DrawImage(img2, nil) + img_12_3.DrawImage(img3, nil) img2.Fill(img2Color) img3.Fill(img3Color) @@ -162,18 +153,9 @@ func TestImageComposition(t *testing.T) { t.Fatal(err) return } - if err := img3.DrawImage(img2, nil); err != nil { - t.Fatal(err) - return - } - if err := img3.DrawImage(img1, nil); err != nil { - t.Fatal(err) - return - } - if err := img_1_23.DrawImage(img3, nil); err != nil { - t.Fatal(err) - return - } + img3.DrawImage(img2, nil) + img3.DrawImage(img1, nil) + img_1_23.DrawImage(img3, nil) for j := 0; j < h; j++ { for i := 0; i < w; i++ { @@ -223,10 +205,7 @@ func TestImageScale(t *testing.T) { op := &DrawImageOptions{} op.GeoM.Scale(float64(scale), float64(scale)) - if err := img1.DrawImage(img0, op); err != nil { - t.Fatal(err) - return - } + img1.DrawImage(img0, op) for j := 0; j < h*scale; j++ { for i := 0; i < w*scale; i++ { @@ -255,10 +234,7 @@ func TestImage90DegreeRotate(t *testing.T) { op := &DrawImageOptions{} op.GeoM.Rotate(math.Pi / 2) op.GeoM.Translate(float64(h), 0) - if err := img1.DrawImage(img0, op); err != nil { - t.Fatal(err) - return - } + img1.DrawImage(img0, op) for j := 0; j < h; j++ { for i := 0; i < w; i++ { @@ -286,10 +262,7 @@ func TestImageDotByDotInversion(t *testing.T) { op := &DrawImageOptions{} op.GeoM.Rotate(math.Pi) op.GeoM.Translate(float64(w), float64(h)) - if err := img1.DrawImage(img0, op); err != nil { - t.Fatal(err) - return - } + img1.DrawImage(img0, op) for j := 0; j < h; j++ { for i := 0; i < w; i++ { @@ -411,10 +384,7 @@ func TestImageCompositeModeLighter(t *testing.T) { img1.Fill(color.RGBA{0x01, 0x02, 0x03, 0x04}) op := &DrawImageOptions{} op.CompositeMode = CompositeModeLighter - if err := img1.DrawImage(img0, op); err != nil { - t.Fatal(err) - return - } + img1.DrawImage(img0, op) for j := 0; j < img1.Bounds().Size().Y; j++ { for i := 0; i < img1.Bounds().Size().X; i++ { got := img1.At(i, j).(color.RGBA) diff --git a/text/text.go b/text/text.go index 598877c2e..300b8f149 100644 --- a/text/text.go +++ b/text/text.go @@ -56,7 +56,7 @@ func drawGlyph(dst *ebiten.Image, face font.Face, r rune, img *ebiten.Image, x, op := &ebiten.DrawImageOptions{} op.GeoM.Translate(float64((x+b.Min.X)>>6), float64((y+b.Min.Y)>>6)) op.ColorM = clr - _ = dst.DrawImage(img, op) + dst.DrawImage(img, op) } var ( diff --git a/uicontext.go b/uicontext.go index bb7429628..ac719a23b 100644 --- a/uicontext.go +++ b/uicontext.go @@ -240,7 +240,7 @@ func (c *uiContext) draw() { } else { op.Filter = FilterLinear } - _ = c.screen.DrawImage(c.offscreen, op) + c.screen.DrawImage(c.offscreen, op) } func (c *uiContext) AdjustPosition(x, y float64) (float64, float64) {