mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
pixels Rename s/history/dependency/
This commit is contained in:
parent
eff0ec8e11
commit
5c56058d6e
17
image.go
17
image.go
@ -99,23 +99,22 @@ func (i *images) restore(context *opengl.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
imagesWithoutHistory := []*imageImpl{}
|
||||
imagesWithHistory := []*imageImpl{}
|
||||
imagesWithoutDependency := []*imageImpl{}
|
||||
imagesWithDependency := []*imageImpl{}
|
||||
for img := range i.images {
|
||||
if img.hasHistory() {
|
||||
imagesWithHistory = append(imagesWithHistory, img)
|
||||
if img.hasDependency() {
|
||||
imagesWithDependency = append(imagesWithDependency, img)
|
||||
} else {
|
||||
imagesWithoutHistory = append(imagesWithoutHistory, img)
|
||||
imagesWithoutDependency = append(imagesWithoutDependency, img)
|
||||
}
|
||||
}
|
||||
// Images with history can depend on other images. Let's process images without history
|
||||
// first.
|
||||
for _, img := range imagesWithoutHistory {
|
||||
// Images depending on other images should be processed first.
|
||||
for _, img := range imagesWithoutDependency {
|
||||
if err := img.restore(context); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, img := range imagesWithHistory {
|
||||
for _, img := range imagesWithDependency {
|
||||
if err := img.restore(context); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -243,13 +243,13 @@ func (i *imageImpl) resetPixelsIfDependingOn(target *imageImpl, context *opengl.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i *imageImpl) hasHistory() bool {
|
||||
func (i *imageImpl) hasDependency() bool {
|
||||
i.m.Lock()
|
||||
defer i.m.Unlock()
|
||||
if i.pixels == nil {
|
||||
return false
|
||||
}
|
||||
return i.pixels.HasHistory()
|
||||
return i.pixels.HasDependency()
|
||||
}
|
||||
|
||||
func (i *imageImpl) restore(context *opengl.Context) error {
|
||||
|
@ -116,7 +116,7 @@ func (p *Pixels) Reset(context *opengl.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Pixels) HasHistory() bool {
|
||||
func (p *Pixels) HasDependency() bool {
|
||||
return p.drawImageHistory != nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user