mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
restorable: Refactoring
This commit is contained in:
parent
927a4388b5
commit
9d37221743
@ -195,7 +195,7 @@ func (i *Image) At(x, y int) (color.RGBA, error) {
|
|||||||
return color.RGBA{}, nil
|
return color.RGBA{}, nil
|
||||||
}
|
}
|
||||||
if i.basePixels == nil || i.drawImageHistory != nil || i.stale {
|
if i.basePixels == nil || i.drawImageHistory != nil || i.stale {
|
||||||
if err := i.readPixelsFromGPU(i.image); err != nil {
|
if err := i.readPixelsFromGPU(); err != nil {
|
||||||
return color.RGBA{}, err
|
return color.RGBA{}, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,9 +215,9 @@ func (i *Image) makeStaleIfDependingOn(target *Image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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(image *graphics.Image) error {
|
func (i *Image) readPixelsFromGPU() error {
|
||||||
var err error
|
var err error
|
||||||
i.basePixels, err = image.Pixels()
|
i.basePixels, err = i.image.Pixels()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ func (i *Image) resolveStale() error {
|
|||||||
if !i.stale {
|
if !i.stale {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return i.readPixelsFromGPU(i.image)
|
return i.readPixelsFromGPU()
|
||||||
}
|
}
|
||||||
|
|
||||||
// dependsOn returns a boolean value indicating whether the image depends on target.
|
// dependsOn returns a boolean value indicating whether the image depends on target.
|
||||||
|
Loading…
Reference in New Issue
Block a user