graphics: Refactoring

This commit is contained in:
Hajime Hoshi 2016-07-25 08:48:58 +09:00
parent f6be72fba2
commit 931e60902f
2 changed files with 5 additions and 5 deletions

View File

@ -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
}

View File

@ -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)