mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
graphics: Bug fix: Errors should be returned after checking the history
This commit is contained in:
parent
806eb44258
commit
b146e5d1b4
@ -92,15 +92,15 @@ func (p *pixels) hasHistoryWith(target *Image) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *pixels) resetHistoryIfNeeded(image *graphics.Image, target *Image, context *opengl.Context) error {
|
func (p *pixels) resetHistoryIfNeeded(image *graphics.Image, target *Image, context *opengl.Context) error {
|
||||||
if context == nil {
|
|
||||||
return errors.New("ebiten: OpenGL context is missing: before running the main loop, it is forbidden to manipulate images that is used as a drawing source once.")
|
|
||||||
}
|
|
||||||
if p.drawImageHistory == nil {
|
if p.drawImageHistory == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if !p.hasHistoryWith(target) {
|
if !p.hasHistoryWith(target) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if context == nil {
|
||||||
|
return errors.New("ebiten: OpenGL context is missing: before running the main loop, it is forbidden to manipulate images that is used as a drawing source once.")
|
||||||
|
}
|
||||||
var err error
|
var err error
|
||||||
p.basePixels, err = image.Pixels(context)
|
p.basePixels, err = image.Pixels(context)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user