shareable: Refactoring

This commit is contained in:
Hajime Hoshi 2020-11-06 01:45:04 +09:00
parent a3bccf5ff7
commit 34d7385e6d

View File

@ -188,6 +188,9 @@ func (i *Image) isShared() bool {
} }
func (i *Image) ensureNotShared() { func (i *Image) ensureNotShared() {
i.nonUpdatedCount = 0
delete(imagesToMakeShared, i)
if i.backend == nil { if i.backend == nil {
i.allocate(false) i.allocate(false)
return return
@ -374,9 +377,6 @@ func (i *Image) DrawTriangles(srcs [graphics.ShaderImageNum]*Image, vertices []f
i.backend.restorable.DrawTriangles(imgs, offsets, vertices, indices, colorm, mode, filter, address, sourceRegion, s, uniforms) i.backend.restorable.DrawTriangles(imgs, offsets, vertices, indices, colorm, mode, filter, address, sourceRegion, s, uniforms)
i.nonUpdatedCount = 0
delete(imagesToMakeShared, i)
for _, src := range srcs { for _, src := range srcs {
if src == nil { if src == nil {
continue continue
@ -407,9 +407,6 @@ func (i *Image) Fill(clr color.RGBA) {
// As *restorable.Image is an independent image, it is fine to fill the entire image. // As *restorable.Image is an independent image, it is fine to fill the entire image.
i.backend.restorable.Fill(clr) i.backend.restorable.Fill(clr)
i.nonUpdatedCount = 0
delete(imagesToMakeShared, i)
} }
func (i *Image) ReplacePixels(pix []byte) { func (i *Image) ReplacePixels(pix []byte) {