mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
graphics: Skip clearing the screen framebuffer
This commit is contained in:
parent
64abc79dc2
commit
d523229d9f
@ -102,19 +102,22 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error {
|
|||||||
|
|
||||||
// Clear the screen framebuffer by DrawImage instad of Fill
|
// Clear the screen framebuffer by DrawImage instad of Fill
|
||||||
// to clear the whole region including fullscreen's padding.
|
// to clear the whole region including fullscreen's padding.
|
||||||
op := &DrawImageOptions{}
|
// TODO: This clear is needed only when the screen size is changed.
|
||||||
w, h := emptyImage.Size()
|
if c.offsetX > 0 || c.offsetY > 0 {
|
||||||
// graphics.MaxImageSize should be the maximum size of framebuffer.
|
op := &DrawImageOptions{}
|
||||||
op.GeoM.Scale(graphics.MaxImageSize/float64(w), graphics.MaxImageSize/float64(h))
|
w, h := emptyImage.Size()
|
||||||
op.CompositeMode = CompositeModeCopy
|
// graphics.MaxImageSize should be the maximum size of framebuffer.
|
||||||
op.Filter = filterScreen // any filter is fine: just use the same filter as below.
|
op.GeoM.Scale(graphics.MaxImageSize/float64(w), graphics.MaxImageSize/float64(h))
|
||||||
c.screen.DrawImage(emptyImage, op)
|
op.CompositeMode = CompositeModeCopy
|
||||||
|
op.Filter = filterScreen // any filter is fine: just use the same filter as below.
|
||||||
|
c.screen.DrawImage(emptyImage, op)
|
||||||
|
}
|
||||||
|
|
||||||
dw, dh := c.screen.Size()
|
dw, dh := c.screen.Size()
|
||||||
sw, _ := c.offscreen.Size()
|
sw, _ := c.offscreen.Size()
|
||||||
scale := float64(dw) / float64(sw)
|
scale := float64(dw) / float64(sw)
|
||||||
|
|
||||||
op = &DrawImageOptions{}
|
op := &DrawImageOptions{}
|
||||||
// c.screen is special: its Y axis is down to up,
|
// c.screen is special: its Y axis is down to up,
|
||||||
// and the origin point is lower left.
|
// and the origin point is lower left.
|
||||||
op.GeoM.Scale(scale, -scale)
|
op.GeoM.Scale(scale, -scale)
|
||||||
|
Loading…
Reference in New Issue
Block a user