mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
graphics: Bug fix: a too old frame was rendered at least on Android
Fixes #520
This commit is contained in:
parent
1a898dd1b9
commit
deab21fad1
@ -97,27 +97,26 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error {
|
|||||||
}
|
}
|
||||||
afterFrameUpdate()
|
afterFrameUpdate()
|
||||||
}
|
}
|
||||||
if 0 < updateCount {
|
|
||||||
// Call ClearFramebuffer instead of c.screen.Clear()
|
|
||||||
// to clear the whole region including fullscreen's padding.
|
|
||||||
c.screen.restorable.ClearFramebuffer()
|
|
||||||
|
|
||||||
dw, dh := c.screen.Size()
|
// Call ClearFramebuffer instead of c.screen.Clear()
|
||||||
sw, _ := c.offscreen.Size()
|
// to clear the whole region including fullscreen's padding.
|
||||||
scale := float64(dw) / float64(sw)
|
c.screen.restorable.ClearFramebuffer()
|
||||||
|
|
||||||
op := &DrawImageOptions{}
|
dw, dh := c.screen.Size()
|
||||||
|
sw, _ := c.offscreen.Size()
|
||||||
|
scale := float64(dw) / float64(sw)
|
||||||
|
|
||||||
// c.screen is special: its Y axis is down to up,
|
op := &DrawImageOptions{}
|
||||||
// and the origin point is lower left.
|
|
||||||
op.GeoM.Scale(scale, -scale)
|
|
||||||
op.GeoM.Translate(0, float64(dh))
|
|
||||||
op.GeoM.Translate(c.offsetX, c.offsetY)
|
|
||||||
|
|
||||||
op.CompositeMode = CompositeModeCopy
|
// c.screen is special: its Y axis is down to up,
|
||||||
op.Filter = filterScreen
|
// and the origin point is lower left.
|
||||||
_ = c.screen.DrawImage(c.offscreen, op)
|
op.GeoM.Scale(scale, -scale)
|
||||||
}
|
op.GeoM.Translate(0, float64(dh))
|
||||||
|
op.GeoM.Translate(c.offsetX, c.offsetY)
|
||||||
|
|
||||||
|
op.CompositeMode = CompositeModeCopy
|
||||||
|
op.Filter = filterScreen
|
||||||
|
_ = c.screen.DrawImage(c.offscreen, op)
|
||||||
|
|
||||||
if err := restorable.ResolveStaleImages(); err != nil {
|
if err := restorable.ResolveStaleImages(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user