graphics: Remove 'resetRestoringState'

This is basically a revert of 2d079b123f

As filling can happen on a part of a shared image, resetting the
restoring state was wrong.
This commit is contained in:
Hajime Hoshi 2019-08-25 02:18:42 +09:00
parent e931494c66
commit b8eeded538
4 changed files with 1 additions and 24 deletions

View File

@ -123,10 +123,7 @@ func (i *Image) Fill(clr color.Color) error {
if af < 1.0 {
op.CompositeMode = CompositeModeCopy
}
// As Fill will change all the pixels of the image into the same color, all the information for restoring
// will be invalidated.
// TODO: This is a little hacky. Is there a better way?
i.mipmap.resetRestoringState()
// TODO: As all the pixels will be changed, this image can reset the information for restoring.
i.DrawImage(emptyImage, op)
return nil
}

View File

@ -223,14 +223,7 @@ func (i *Image) clear() {
}
clearImage(i.image)
i.ResetRestoringState()
}
// ResetRestoringState resets all the information for restoring.
// ResetRestoringState doen't affect the underlying image.
//
// After ResetRestoringState, the image is assumed to be cleared.
func (i *Image) ResetRestoringState() {
i.basePixels = Pixels{}
i.drawTrianglesHistory = nil
i.stale = false

View File

@ -342,15 +342,6 @@ func (i *Image) ClearFramebuffer() {
i.backend.restorable.Clear()
}
func (i *Image) ResetRestoringState() {
backendsM.Lock()
defer backendsM.Unlock()
if i.backend == nil {
return
}
i.backend.restorable.ResetRestoringState()
}
func (i *Image) ReplacePixels(p []byte) {
backendsM.Lock()
defer backendsM.Unlock()

View File

@ -144,10 +144,6 @@ func (m *mipmap) clearFramebuffer() {
m.orig.ClearFramebuffer()
}
func (m *mipmap) resetRestoringState() {
m.orig.ResetRestoringState()
}
// mipmapLevel returns an appropriate mipmap level for the given determinant of a geometry matrix.
//
// mipmapLevel panics if det is NaN or 0.