From e0894879f194c68d0790188a0bde9bd7dc386d21 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 27 Jul 2016 02:20:42 +0900 Subject: [PATCH] pixels: Remove IsStale --- imageimpl.go | 5 +---- internal/pixels/pixels.go | 11 +++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/imageimpl.go b/imageimpl.go index 3efe4331e..888ec1c6f 100644 --- a/imageimpl.go +++ b/imageimpl.go @@ -194,10 +194,7 @@ func (i *imageImpl) ensurePixels(context *opengl.Context) error { if i.disposed { return nil } - if !i.pixels.IsStale() { - return nil - } - if err := i.pixels.Reset(context); err != nil { + if err := i.pixels.ResetIfStale(context); err != nil { return err } return nil diff --git a/internal/pixels/pixels.go b/internal/pixels/pixels.go index 89d816d69..e3f3d60d3 100644 --- a/internal/pixels/pixels.go +++ b/internal/pixels/pixels.go @@ -47,10 +47,6 @@ func NewPixels(image *graphics.Image) *Pixels { } } -func (p *Pixels) IsStale() bool { - return p.stale -} - func (p *Pixels) MakeStale() { p.basePixels = nil p.baseColor = nil @@ -134,6 +130,13 @@ func (p *Pixels) Reset(context *opengl.Context) error { return nil } +func (p *Pixels) ResetIfStale(context *opengl.Context) error { + if !p.stale { + return nil + } + return p.Reset(context) +} + func (p *Pixels) HasDependency() bool { if p.stale { return false