diff --git a/image.go b/image.go index 1b0cbd121..f03f42e38 100644 --- a/image.go +++ b/image.go @@ -52,11 +52,11 @@ func (i *images) remove(img *Image) { runtime.SetFinalizer(img, nil) } -func (i *images) resetHistoryIfNeeded(target *Image, context *opengl.Context) error { +func (i *images) flushPixelsIfNeeded(target *Image, context *opengl.Context) error { i.m.Lock() defer i.m.Unlock() for img := range i.images { - if err := img.resetHistoryIfNeeded(target, context); err != nil { + if err := img.flushPixelsIfNeeded(target, context); err != nil { return err } } @@ -130,7 +130,7 @@ func (i *Image) Size() (width, height int) { // // This function is concurrent-safe. func (i *Image) Clear() error { - if err := theImagesForRestoring.resetHistoryIfNeeded(i, ui.GLContext()); err != nil { + if err := theImagesForRestoring.flushPixelsIfNeeded(i, ui.GLContext()); err != nil { return err } return i.impl.Fill(color.Transparent) @@ -140,7 +140,7 @@ func (i *Image) Clear() error { // // This function is concurrent-safe. func (i *Image) Fill(clr color.Color) error { - if err := theImagesForRestoring.resetHistoryIfNeeded(i, ui.GLContext()); err != nil { + if err := theImagesForRestoring.flushPixelsIfNeeded(i, ui.GLContext()); err != nil { return err } return i.impl.Fill(clr) @@ -163,7 +163,7 @@ func (i *Image) Fill(clr color.Color) error { // // This function is concurrent-safe. func (i *Image) DrawImage(image *Image, options *DrawImageOptions) error { - if err := theImagesForRestoring.resetHistoryIfNeeded(i, ui.GLContext()); err != nil { + if err := theImagesForRestoring.flushPixelsIfNeeded(i, ui.GLContext()); err != nil { return err } return i.impl.DrawImage(image, options) @@ -201,7 +201,7 @@ func (i *Image) At(x, y int) color.Color { // // This function is concurrent-safe. func (i *Image) Dispose() error { - if err := theImagesForRestoring.resetHistoryIfNeeded(i, ui.GLContext()); err != nil { + if err := theImagesForRestoring.flushPixelsIfNeeded(i, ui.GLContext()); err != nil { return err } if i.impl.isDisposed() { @@ -218,7 +218,7 @@ func (i *Image) Dispose() error { // // This function is concurrent-safe. func (i *Image) ReplacePixels(p []uint8) error { - if err := theImagesForRestoring.resetHistoryIfNeeded(i, ui.GLContext()); err != nil { + if err := theImagesForRestoring.flushPixelsIfNeeded(i, ui.GLContext()); err != nil { return err } return i.impl.ReplacePixels(p) diff --git a/imageimpl.go b/imageimpl.go index d11f05945..80e92ee6d 100644 --- a/imageimpl.go +++ b/imageimpl.go @@ -199,13 +199,13 @@ func (i *imageImpl) At(x, y int, context *opengl.Context) color.Color { return clr } -func (i *imageImpl) resetHistoryIfNeeded(target *Image, context *opengl.Context) error { +func (i *imageImpl) flushPixelsIfNeeded(target *Image, context *opengl.Context) error { i.m.Lock() defer i.m.Unlock() if i.disposed { return nil } - if err := i.pixels.resetHistoryIfNeeded(i.image, target, context); err != nil { + if err := i.pixels.flushIfNeeded(i.image, target, context); err != nil { return err } return nil diff --git a/pixels.go b/pixels.go index 68c3085d3..b093f32f3 100644 --- a/pixels.go +++ b/pixels.go @@ -91,7 +91,7 @@ func (p *pixels) hasHistoryWith(target *Image) bool { return false } -func (p *pixels) resetHistoryIfNeeded(image *graphics.Image, target *Image, context *opengl.Context) error { +func (p *pixels) flushIfNeeded(image *graphics.Image, target *Image, context *opengl.Context) error { if p.drawImageHistory == nil { return nil }