mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 20:42:07 +01:00
graphics: Speed optimization: Use CompositeModeCopy instead of Clear
This commit is contained in:
parent
c6b813a321
commit
1179c12d35
@ -94,6 +94,7 @@ func drawWithFittingScale(dst *Image, src *Image) {
|
|||||||
sh := float64(hd) / float64(hs)
|
sh := float64(hd) / float64(hs)
|
||||||
op := &DrawImageOptions{}
|
op := &DrawImageOptions{}
|
||||||
op.GeoM.Scale(sw, sh)
|
op.GeoM.Scale(sw, sh)
|
||||||
|
op.CompositeMode = CompositeModeCopy
|
||||||
_ = dst.DrawImage(src, op)
|
_ = dst.DrawImage(src, op)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +117,6 @@ func (c *graphicsContext) Update(afterFrameUpdate func()) error {
|
|||||||
}
|
}
|
||||||
if 0 < updateCount {
|
if 0 < updateCount {
|
||||||
drawWithFittingScale(c.offscreen2, c.offscreen)
|
drawWithFittingScale(c.offscreen2, c.offscreen)
|
||||||
_ = c.screen.Clear()
|
|
||||||
drawWithFittingScale(c.screen, c.offscreen2)
|
drawWithFittingScale(c.screen, c.offscreen2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user