mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08: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
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imagesWithoutHistory := []*imageImpl{}
|
imagesWithoutDependency := []*imageImpl{}
|
||||||
imagesWithHistory := []*imageImpl{}
|
imagesWithDependency := []*imageImpl{}
|
||||||
for img := range i.images {
|
for img := range i.images {
|
||||||
if img.hasHistory() {
|
if img.hasDependency() {
|
||||||
imagesWithHistory = append(imagesWithHistory, img)
|
imagesWithDependency = append(imagesWithDependency, img)
|
||||||
} else {
|
} else {
|
||||||
imagesWithoutHistory = append(imagesWithoutHistory, img)
|
imagesWithoutDependency = append(imagesWithoutDependency, img)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Images with history can depend on other images. Let's process images without history
|
// Images depending on other images should be processed first.
|
||||||
// first.
|
for _, img := range imagesWithoutDependency {
|
||||||
for _, img := range imagesWithoutHistory {
|
|
||||||
if err := img.restore(context); err != nil {
|
if err := img.restore(context); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, img := range imagesWithHistory {
|
for _, img := range imagesWithDependency {
|
||||||
if err := img.restore(context); err != nil {
|
if err := img.restore(context); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -243,13 +243,13 @@ func (i *imageImpl) resetPixelsIfDependingOn(target *imageImpl, context *opengl.
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *imageImpl) hasHistory() bool {
|
func (i *imageImpl) hasDependency() bool {
|
||||||
i.m.Lock()
|
i.m.Lock()
|
||||||
defer i.m.Unlock()
|
defer i.m.Unlock()
|
||||||
if i.pixels == nil {
|
if i.pixels == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return i.pixels.HasHistory()
|
return i.pixels.HasDependency()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *imageImpl) restore(context *opengl.Context) error {
|
func (i *imageImpl) restore(context *opengl.Context) error {
|
||||||
|
@ -116,7 +116,7 @@ func (p *Pixels) Reset(context *opengl.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Pixels) HasHistory() bool {
|
func (p *Pixels) HasDependency() bool {
|
||||||
return p.drawImageHistory != nil
|
return p.drawImageHistory != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user