mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 03:58:55 +01:00
restorable: Add TODO comments (#357)
This commit is contained in:
parent
9d4849e351
commit
5a4a82ab50
@ -144,6 +144,7 @@ func (c *graphicsContext) UpdateAndDraw(context *opengl.Context, updateCount int
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TODO: Is it OK to restore images here? The images can be in 'stale' state after c.f().
|
// TODO: Is it OK to restore images here? The images can be in 'stale' state after c.f().
|
||||||
|
// (#357)
|
||||||
if err := restorable.ResolveStalePixels(context); err != nil {
|
if err := restorable.ResolveStalePixels(context); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
2
image.go
2
image.go
@ -257,6 +257,8 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
|||||||
// On the other hand, pixels in volatile images are not saved.
|
// On the other hand, pixels in volatile images are not saved.
|
||||||
// Saving pixels is an expensive operation, and it is desirable to avoid it if possible.
|
// Saving pixels is an expensive operation, and it is desirable to avoid it if possible.
|
||||||
//
|
//
|
||||||
|
// Note that volatile images are internal only and will never be source of drawing.
|
||||||
|
//
|
||||||
// If width or height is less than 1 or more than MaxImageSize, newVolatileImage panics.
|
// If width or height is less than 1 or more than MaxImageSize, newVolatileImage panics.
|
||||||
//
|
//
|
||||||
// Error returned by newVolatileImage is always nil as of 1.5.0-alpha.
|
// Error returned by newVolatileImage is always nil as of 1.5.0-alpha.
|
||||||
|
@ -43,9 +43,11 @@ type Image struct {
|
|||||||
basePixels []uint8
|
basePixels []uint8
|
||||||
baseColor color.RGBA
|
baseColor color.RGBA
|
||||||
drawImageHistory []*drawImageHistoryItem
|
drawImageHistory []*drawImageHistoryItem
|
||||||
|
|
||||||
|
// stale indicates whether the image needs to be synced with GPU as soon as possible.
|
||||||
stale bool
|
stale bool
|
||||||
|
|
||||||
// volatile indicates whether the image is cleared at every frame.
|
// volatile indicates whether the image is cleared whenever a frame starts.
|
||||||
volatile bool
|
volatile bool
|
||||||
|
|
||||||
// screen indicates whether the image is used as an actual screen.
|
// screen indicates whether the image is used as an actual screen.
|
||||||
|
@ -79,6 +79,8 @@ func (i *images) resetPixelsIfDependingOn(target *Image) {
|
|||||||
}
|
}
|
||||||
i.lastChecked = target
|
i.lastChecked = target
|
||||||
for img := range i.images {
|
for img := range i.images {
|
||||||
|
// TODO: This seems not enough: What if img becomes stale but what about
|
||||||
|
// other images depend on img? (#357)
|
||||||
img.makeStaleIfDependingOn(target)
|
img.makeStaleIfDependingOn(target)
|
||||||
}
|
}
|
||||||
i.m.Unlock()
|
i.m.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user