mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +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() {
|
if !r.Empty() {
|
||||||
var pix []byte
|
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.
|
// pixelsForRestore can be reused as basePixels was invalidated.
|
||||||
if i.pixelsForRestore == nil {
|
if i.pixelsForRestore == nil {
|
||||||
i.pixelsForRestore = make([]byte, 4*r.Dx()*r.Dy())
|
i.pixelsForRestore = make([]byte, 4*r.Dx()*r.Dy())
|
||||||
|
Loading…
Reference in New Issue
Block a user