mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
parent
c2ee8e8d59
commit
525d16bec8
9
image.go
9
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.
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user