mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Refactoring
This commit is contained in:
parent
f6be72fba2
commit
931e60902f
@ -223,6 +223,11 @@ func (i *imageImpl) flushPixelsIfNeeded(target *imageImpl, context *opengl.Conte
|
|||||||
if target.isDisposed() {
|
if target.isDisposed() {
|
||||||
return errors.New("ebiten: target is already disposed")
|
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 {
|
if err := i.pixels.FlushIfNeeded(target.image, context); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -148,11 +148,6 @@ func (p *Pixels) FlushIfNeeded(target *graphics.Image, context *opengl.Context)
|
|||||||
if !p.hasHistoryWith(target) {
|
if !p.hasHistoryWith(target) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if context == nil {
|
|
||||||
// context is null when this is not initialized yet.
|
|
||||||
p.MakeInconsistent()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
p.inconsistent = false
|
p.inconsistent = false
|
||||||
var err error
|
var err error
|
||||||
p.basePixels, err = p.image.Pixels(context)
|
p.basePixels, err = p.image.Pixels(context)
|
||||||
|
Loading…
Reference in New Issue
Block a user