mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/restorable: use pixelsForRestore only when restoring is needed
Updates #2375
This commit is contained in:
parent
34562c3337
commit
c6b37e9809
@ -493,7 +493,7 @@ func (i *Image) readPixelsFromGPU(graphicsDriver graphicsdriver.Graphics) error
|
||||
}
|
||||
if !r.Empty() {
|
||||
var pix []byte
|
||||
if r == image.Rect(0, 0, i.width, i.height) {
|
||||
if needsRestoring() && i.needsRestoring() && r == image.Rect(0, 0, i.width, i.height) {
|
||||
// pixelsForRestore can be reused as basePixels was invalidated.
|
||||
if i.pixelsForRestore == nil {
|
||||
i.pixelsForRestore = make([]byte, 4*r.Dx()*r.Dy())
|
||||
|
Loading…
Reference in New Issue
Block a user