mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +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)
|
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)
|
if len(i.drawTrianglesHistory) > 0 {
|
||||||
pix := gimg.Pixels()
|
pix := gimg.Pixels()
|
||||||
i.basePixels = &Pixels{
|
i.basePixels = &Pixels{
|
||||||
pixels: pix,
|
pixels: pix,
|
||||||
length: len(pix),
|
length: len(pix),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i.image = gimg
|
||||||
i.drawTrianglesHistory = nil
|
i.drawTrianglesHistory = nil
|
||||||
i.stale = false
|
i.stale = false
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user