mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
internal/restorable: bug fix: readPixelsFromGPU might be called for a non-stale image
Actually readPixelsFromGPUIfNeeded can invoke this. Closes #2322
This commit is contained in:
parent
4824cbc755
commit
40362aa62d
@ -496,10 +496,6 @@ func (i *Image) makeStaleIfDependingOnShader(shader *Shader) {
|
|||||||
|
|
||||||
// readPixelsFromGPU reads the pixels from GPU and resolves the image's 'stale' state.
|
// readPixelsFromGPU reads the pixels from GPU and resolves the image's 'stale' state.
|
||||||
func (i *Image) readPixelsFromGPU(graphicsDriver graphicsdriver.Graphics) error {
|
func (i *Image) readPixelsFromGPU(graphicsDriver graphicsdriver.Graphics) error {
|
||||||
if !i.stale {
|
|
||||||
panic("restorable: the image must be stale at readPixelsFromGPU")
|
|
||||||
}
|
|
||||||
|
|
||||||
i.basePixels = Pixels{}
|
i.basePixels = Pixels{}
|
||||||
if r := i.staleRegion; !r.Empty() {
|
if r := i.staleRegion; !r.Empty() {
|
||||||
pix := make([]byte, 4*r.Dx()*r.Dy())
|
pix := make([]byte, 4*r.Dx()*r.Dy())
|
||||||
|
Loading…
Reference in New Issue
Block a user