graphics: Check error at the end of the frame

The error should be raised as soon as possible.
This commit is contained in:
Hajime Hoshi 2018-07-12 03:16:29 +09:00
parent 6c8b7f8e9c
commit aed0bf4a37

View File

@ -82,10 +82,6 @@ func (c *graphicsContext) initializeIfNeeded() error {
}
func (c *graphicsContext) Update(afterFrameUpdate func()) error {
if err := shareable.Error(); err != nil {
return err
}
updateCount := clock.Update()
if err := c.initializeIfNeeded(); err != nil {
@ -130,6 +126,10 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error {
_ = c.screen.DrawImage(c.offscreen, op)
shareable.ResolveStaleImages()
if err := shareable.Error(); err != nil {
return err
}
return nil
}