From 525d16bec865dfc855e857c416194eb9faa340b1 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 6 Oct 2020 00:13:19 +0900 Subject: [PATCH] ebiten: Remove the returning value from (*Image).Dispose Updates #1380 --- image.go | 9 +++------ image_test.go | 4 +--- uicontext.go | 4 ++-- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/image.go b/image.go index 066dbc974..2e8ce062e 100644 --- a/image.go +++ b/image.go @@ -678,20 +678,17 @@ func (i *Image) Set(x, y int, clr color.Color) { // However, calling Dispose explicitly is helpful if memory usage matters. // // When the image is disposed, Dipose does nothing. -// -// Dipose always return nil as of 1.5.0. -func (i *Image) Dispose() error { +func (i *Image) Dispose() { i.copyCheck() if i.isDisposed() { - return nil + return } if i.isSubImage() { - return nil + return } i.mipmap.MarkDisposed() i.mipmap = nil - return nil } // ReplacePixels replaces the pixels of the image with p. diff --git a/image_test.go b/image_test.go index 443d06d66..54d5d7069 100644 --- a/image_test.go +++ b/image_test.go @@ -383,9 +383,7 @@ func TestImageDispose(t *testing.T) { return } img.Fill(color.White) - if err := img.Dispose(); err != nil { - t.Errorf("img.Dipose() returns error: %v", err) - } + img.Dispose() // The color is transparent (color.RGBA{}). // Note that the value's type must be color.RGBA. diff --git a/uicontext.go b/uicontext.go index e50273425..bb7429628 100644 --- a/uicontext.go +++ b/uicontext.go @@ -81,13 +81,13 @@ func (c *uiContext) updateOffscreen() { c.outsideSizeUpdated = false if c.screen != nil { - _ = c.screen.Dispose() + c.screen.Dispose() c.screen = nil } if c.offscreen != nil { if w, h := c.offscreen.Size(); w != sw || h != sh { - _ = c.offscreen.Dispose() + c.offscreen.Dispose() c.offscreen = nil } }