mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
restorable: Bug fix: Calling At must resolve the image's stale state
This commit is contained in:
parent
245dde9bc1
commit
eb357f61b5
@ -238,13 +238,15 @@ func (i *Image) At(x, y int) (color.RGBA, error) {
|
|||||||
return color.RGBA{}, nil
|
return color.RGBA{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := graphics.FlushCommands(); err != nil {
|
|
||||||
return color.RGBA{}, err
|
|
||||||
}
|
|
||||||
if i.basePixels == nil || i.drawImageHistory != nil || i.stale {
|
if i.basePixels == nil || i.drawImageHistory != nil || i.stale {
|
||||||
|
if err := graphics.FlushCommands(); err != nil {
|
||||||
|
return color.RGBA{}, err
|
||||||
|
}
|
||||||
if err := i.readPixelsFromGPU(); err != nil {
|
if err := i.readPixelsFromGPU(); err != nil {
|
||||||
return color.RGBA{}, err
|
return color.RGBA{}, err
|
||||||
}
|
}
|
||||||
|
i.drawImageHistory = nil
|
||||||
|
i.stale = false
|
||||||
}
|
}
|
||||||
idx := 4*x + 4*y*w
|
idx := 4*x + 4*y*w
|
||||||
r, g, b, a := i.basePixels[idx], i.basePixels[idx+1], i.basePixels[idx+2], i.basePixels[idx+3]
|
r, g, b, a := i.basePixels[idx], i.basePixels[idx+1], i.basePixels[idx+2], i.basePixels[idx+3]
|
||||||
|
Loading…
Reference in New Issue
Block a user