mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/restorable: skip adding stale regions when the image doesn't need to be restored
This commit is contained in:
parent
aa8e112414
commit
f32648b144
@ -233,6 +233,10 @@ func (i *Image) makeStale(rect image.Rectangle) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !i.needsRestoration() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
origSize := len(i.staleRegions)
|
origSize := len(i.staleRegions)
|
||||||
i.staleRegions = i.appendRegionsForDrawTriangles(i.staleRegions)
|
i.staleRegions = i.appendRegionsForDrawTriangles(i.staleRegions)
|
||||||
if !rect.Empty() {
|
if !rect.Empty() {
|
||||||
@ -465,7 +469,7 @@ func (i *Image) readPixelsFromGPUIfNeeded(graphicsDriver graphicsdriver.Graphics
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte, region image.Rectangle) error {
|
func (i *Image) ReadPixels(graphicsDriver graphicsdriver.Graphics, pixels []byte, region image.Rectangle) error {
|
||||||
if AlwaysReadPixelsFromGPU() {
|
if AlwaysReadPixelsFromGPU() || !i.needsRestoration() {
|
||||||
if err := i.image.ReadPixels(graphicsDriver, []graphicsdriver.PixelsArgs{
|
if err := i.image.ReadPixels(graphicsDriver, []graphicsdriver.PixelsArgs{
|
||||||
{
|
{
|
||||||
Pixels: pixels,
|
Pixels: pixels,
|
||||||
|
Loading…
Reference in New Issue
Block a user