graphics: Add pixels.makeInconsistent

This commit is contained in:
Hajime Hoshi 2016-07-24 02:53:33 +09:00
parent b3aa567f38
commit 7649236712

View File

@ -75,9 +75,16 @@ func (p *pixels) fill(clr color.Color) {
p.drawImageHistory = nil p.drawImageHistory = nil
} }
func (p *pixels) makeInconsistent() {
p.inconsistent = true
p.basePixels = nil
p.baseColor = nil
p.drawImageHistory = nil
}
func (p *pixels) appendDrawImageHistory(item *drawImageHistoryItem) { func (p *pixels) appendDrawImageHistory(item *drawImageHistoryItem) {
if item.image.impl.pixels.inconsistent { if item.image.impl.pixels.inconsistent {
p.inconsistent = true p.makeInconsistent()
} }
if p.inconsistent { if p.inconsistent {
return return
@ -132,7 +139,7 @@ func (p *pixels) flushIfNeeded(target *Image, context *opengl.Context) error {
return nil return nil
} }
if context == nil { if context == nil {
p.inconsistent = true p.makeInconsistent()
return nil return nil
} }
p.inconsistent = false p.inconsistent = false