From 24822c0a108c5115978758f95451467d48637fbc Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 26 May 2019 23:13:54 +0900 Subject: [PATCH] restorable: Rename clear -> clearForInitialization --- internal/restorable/image.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/restorable/image.go b/internal/restorable/image.go index 7b9e10057..60123fed3 100644 --- a/internal/restorable/image.go +++ b/internal/restorable/image.go @@ -140,7 +140,7 @@ func NewImage(width, height int) *Image { i := &Image{ image: graphicscommand.NewImage(width, height), } - i.clear() + i.clearForInitialization() theImages.add(i) return i } @@ -159,7 +159,7 @@ func NewScreenFramebufferImage(width, height int) *Image { image: graphicscommand.NewScreenFramebufferImage(width, height), screen: true, } - i.clear() + i.clearForInitialization() theImages.add(i) return i } @@ -169,7 +169,9 @@ func (i *Image) Fill(r, g, b, a uint8) { i.fill(r, g, b, a) } -func (i *Image) clear() { +// clearForInitialization clears the underlying image for initialization. +func (i *Image) clearForInitialization() { + // As this is for initialization, drawing history doesn't have to be adjusted. i.fill(0, 0, 0, 0) } @@ -504,7 +506,7 @@ func (i *Image) restore() error { } if i.volatile { i.image = graphicscommand.NewImage(w, h) - i.clear() + i.clearForInitialization() return nil } if i.stale {