graphics: Rename Initialize/Resume -> Reset

This commit is contained in:
Hajime Hoshi 2016-07-04 00:30:14 +09:00
parent d0a779e272
commit 163ee01bd5
5 changed files with 9 additions and 10 deletions

View File

@ -83,7 +83,7 @@ func (c *graphicsContext) needsRestoring(context *opengl.Context) (bool, error)
func (c *graphicsContext) initializeIfNeeded(context *opengl.Context) error { func (c *graphicsContext) initializeIfNeeded(context *opengl.Context) error {
if !c.initialized { if !c.initialized {
if err := graphics.Initialize(context); err != nil { if err := graphics.Reset(context); err != nil {
return err return err
} }
c.initialized = true c.initialized = true
@ -159,7 +159,7 @@ func (c *graphicsContext) UpdateAndDraw(context *opengl.Context, updateCount int
} }
func (c *graphicsContext) restore(context *opengl.Context) error { func (c *graphicsContext) restore(context *opengl.Context) error {
if err := graphics.Initialize(context); err != nil { if err := graphics.Reset(context); err != nil {
return err return err
} }
if err := theImages.restorePixels(context); err != nil { if err := theImages.restorePixels(context); err != nil {

View File

@ -119,7 +119,7 @@ func (c *Context) Init() error {
return nil return nil
} }
func (c *Context) Resume() error { func (c *Context) Reset() error {
c.locationCache = newLocationCache() c.locationCache = newLocationCache()
c.lastFramebuffer = invalidFramebuffer c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0 c.lastViewportWidth = 0

View File

@ -127,7 +127,7 @@ func (c *Context) init() {
c.screenFramebuffer = Framebuffer{f} c.screenFramebuffer = Framebuffer{f}
} }
func (c *Context) Resume() error { func (c *Context) Reset() error {
c.locationCache = newLocationCache() c.locationCache = newLocationCache()
c.lastFramebuffer = invalidFramebuffer c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0 c.lastViewportWidth = 0

View File

@ -88,7 +88,7 @@ func NewContext() (*Context, error) {
return c, nil return c, nil
} }
func (c *Context) Resume() error { func (c *Context) Reset() error {
c.locationCache = newLocationCache() c.locationCache = newLocationCache()
c.lastFramebuffer = invalidFramebuffer c.lastFramebuffer = invalidFramebuffer
c.lastViewportWidth = 0 c.lastViewportWidth = 0

View File

@ -52,13 +52,12 @@ const (
float32Size = 4 float32Size = 4
) )
func Initialize(context *opengl.Context) error { func Reset(context *opengl.Context) error {
return theOpenGLState.initialize(context) return theOpenGLState.reset(context)
} }
func (s *openGLState) initialize(context *opengl.Context) error { func (s *openGLState) reset(context *opengl.Context) error {
// TODO: Rename context.Reset()
context.Resume()
s.lastProgram = zeroProgram s.lastProgram = zeroProgram
s.lastProjectionMatrix = nil s.lastProjectionMatrix = nil
s.lastModelviewMatrix = nil s.lastModelviewMatrix = nil