pixels Rename s/history/dependency/

This commit is contained in:
Hajime Hoshi 2016-07-27 01:28:16 +09:00
parent eff0ec8e11
commit 5c56058d6e
3 changed files with 11 additions and 12 deletions

View File

@ -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
} }

View File

@ -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 {

View File

@ -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
} }