graphics: Bug fix: restoring needs to be done after main logic execution (#357)

This commit is contained in:
Hajime Hoshi 2017-05-30 10:55:07 +09:00
parent 5a4a82ab50
commit cbc08d9c16

View File

@ -143,11 +143,6 @@ func (c *graphicsContext) UpdateAndDraw(context *opengl.Context, updateCount int
if err := c.initializeIfNeeded(context); err != nil {
return err
}
// TODO: Is it OK to restore images here? The images can be in 'stale' state after c.f().
// (#357)
if err := restorable.ResolveStalePixels(context); err != nil {
return err
}
for i := 0; i < updateCount; i++ {
restorable.ClearVolatileImages()
setRunningSlowly(i < updateCount-1)
@ -161,6 +156,10 @@ func (c *graphicsContext) UpdateAndDraw(context *opengl.Context, updateCount int
if err := c.drawToDefaultRenderTarget(context); err != nil {
return err
}
// TODO: Add tests to check if this behavior is correct (#357)
if err := restorable.ResolveStalePixels(context); err != nil {
return err
}
return nil
}