Revert "graphics: Bug fix: mipmap images should be volatile when the base image is volatile"

This reverts commit 0f82330009.
This commit is contained in:
Hajime Hoshi 2018-07-29 23:58:46 +09:00
parent 0f82330009
commit 5be58086b5
3 changed files with 1 additions and 22 deletions

View File

@ -45,8 +45,6 @@ type Image struct {
// See strings.Builder for similar examples. // See strings.Builder for similar examples.
addr *Image addr *Image
// shareableImages is a set of shareable.Image sorted by the order of mipmap level.
// The level 0 image is a regular image and higher-level images are used for mipmap.
shareableImages []*shareable.Image shareableImages []*shareable.Image
filter Filter filter Filter
@ -284,12 +282,7 @@ func (i *Image) DrawImage(img *Image, options *DrawImageOptions) error {
if w2 == 0 || h2 == 0 { if w2 == 0 || h2 == 0 {
break break
} }
var s *shareable.Image s := shareable.NewImage(w2, h2)
if img.shareableImages[0].IsVolatile() {
s = shareable.NewVolatileImage(w2, h2)
} else {
s = shareable.NewImage(w2, h2)
}
vs := src.QuadVertices(0, 0, w, h, 0.5, 0, 0, 0.5, 0, 0, nil) vs := src.QuadVertices(0, 0, w, h, 0.5, 0, 0, 0.5, 0, 0, nil)
is := graphicsutil.QuadIndices() is := graphicsutil.QuadIndices()
s.DrawImage(src, vs, is, opengl.CompositeModeCopy, graphics.FilterLinear) s.DrawImage(src, vs, is, opengl.CompositeModeCopy, graphics.FilterLinear)

View File

@ -99,10 +99,6 @@ func NewScreenFramebufferImage(width, height int) *Image {
return i return i
} }
func (i *Image) IsVolatile() bool {
return i.volatile
}
// BasePixelsForTesting returns the image's basePixels for testing. // BasePixelsForTesting returns the image's basePixels for testing.
func (i *Image) BasePixelsForTesting() []byte { func (i *Image) BasePixelsForTesting() []byte {
return i.basePixels return i.basePixels

View File

@ -323,16 +323,6 @@ func (i *Image) dispose(markDisposed bool) {
theBackends = append(theBackends[:index], theBackends[index+1:]...) theBackends = append(theBackends[:index], theBackends[index+1:]...)
} }
func (i *Image) IsVolatile() bool {
backendsM.Lock()
defer backendsM.Unlock()
if i.backend == nil {
// Not allocated yet. Only non-volatile images can do lazy allocation so far.
return false
}
return i.backend.restorable.IsVolatile()
}
func (i *Image) IsInvalidated() (bool, error) { func (i *Image) IsInvalidated() (bool, error) {
backendsM.Lock() backendsM.Lock()
defer backendsM.Unlock() defer backendsM.Unlock()