mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 10:42:42 +01:00
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:
parent
e931494c66
commit
b8eeded538
5
image.go
5
image.go
@ -123,10 +123,7 @@ func (i *Image) Fill(clr color.Color) error {
|
|||||||
if af < 1.0 {
|
if af < 1.0 {
|
||||||
op.CompositeMode = CompositeModeCopy
|
op.CompositeMode = CompositeModeCopy
|
||||||
}
|
}
|
||||||
// As Fill will change all the pixels of the image into the same color, all the information for restoring
|
// TODO: As all the pixels will be changed, this image can reset the information for restoring.
|
||||||
// will be invalidated.
|
|
||||||
// TODO: This is a little hacky. Is there a better way?
|
|
||||||
i.mipmap.resetRestoringState()
|
|
||||||
i.DrawImage(emptyImage, op)
|
i.DrawImage(emptyImage, op)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -223,14 +223,7 @@ func (i *Image) clear() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearImage(i.image)
|
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.basePixels = Pixels{}
|
||||||
i.drawTrianglesHistory = nil
|
i.drawTrianglesHistory = nil
|
||||||
i.stale = false
|
i.stale = false
|
||||||
|
@ -342,15 +342,6 @@ func (i *Image) ClearFramebuffer() {
|
|||||||
i.backend.restorable.Clear()
|
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) {
|
func (i *Image) ReplacePixels(p []byte) {
|
||||||
backendsM.Lock()
|
backendsM.Lock()
|
||||||
defer backendsM.Unlock()
|
defer backendsM.Unlock()
|
||||||
|
@ -144,10 +144,6 @@ func (m *mipmap) clearFramebuffer() {
|
|||||||
m.orig.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 returns an appropriate mipmap level for the given determinant of a geometry matrix.
|
||||||
//
|
//
|
||||||
// mipmapLevel panics if det is NaN or 0.
|
// mipmapLevel panics if det is NaN or 0.
|
||||||
|
Loading…
Reference in New Issue
Block a user