From 931e60902f87baf71d0056f786add4bd0ea5f351 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 25 Jul 2016 08:48:58 +0900 Subject: [PATCH] graphics: Refactoring --- imageimpl.go | 5 +++++ internal/pixels/pixels.go | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/imageimpl.go b/imageimpl.go index f08488c58..b5173b221 100644 --- a/imageimpl.go +++ b/imageimpl.go @@ -223,6 +223,11 @@ func (i *imageImpl) flushPixelsIfNeeded(target *imageImpl, context *opengl.Conte if target.isDisposed() { return errors.New("ebiten: target is already disposed") } + if context == nil { + // context is null when this is not initialized yet. + i.pixels.MakeInconsistent() + return nil + } if err := i.pixels.FlushIfNeeded(target.image, context); err != nil { return err } diff --git a/internal/pixels/pixels.go b/internal/pixels/pixels.go index 1be0b3f97..dfe758b00 100644 --- a/internal/pixels/pixels.go +++ b/internal/pixels/pixels.go @@ -148,11 +148,6 @@ func (p *Pixels) FlushIfNeeded(target *graphics.Image, context *opengl.Context) if !p.hasHistoryWith(target) { return nil } - if context == nil { - // context is null when this is not initialized yet. - p.MakeInconsistent() - return nil - } p.inconsistent = false var err error p.basePixels, err = p.image.Pixels(context)