mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
restorable: Refactoring: Do not have to update basePixels in some cases
If there is no draw-traiangles command, the image can keep its basePixels.
This commit is contained in:
parent
6d20e3f951
commit
8ae2fef817
@ -563,14 +563,16 @@ func (i *Image) restore() error {
|
||||
}
|
||||
gimg.DrawTriangles(c.image.image, c.vertices, c.indices, c.colorm, c.mode, c.filter, c.address)
|
||||
}
|
||||
i.image = gimg
|
||||
|
||||
// TODO: Can we avoid getting pixels here? (#897)
|
||||
pix := gimg.Pixels()
|
||||
i.basePixels = &Pixels{
|
||||
pixels: pix,
|
||||
length: len(pix),
|
||||
if len(i.drawTrianglesHistory) > 0 {
|
||||
pix := gimg.Pixels()
|
||||
i.basePixels = &Pixels{
|
||||
pixels: pix,
|
||||
length: len(pix),
|
||||
}
|
||||
}
|
||||
|
||||
i.image = gimg
|
||||
i.drawTrianglesHistory = nil
|
||||
i.stale = false
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user