Index: ui/gfx/compositor/compositor_gl.cc |
=================================================================== |
--- ui/gfx/compositor/compositor_gl.cc (revision 86168) |
+++ ui/gfx/compositor/compositor_gl.cc (working copy) |
@@ -63,6 +63,7 @@ |
virtual void NotifyEnd() OVERRIDE; |
// The GL context used for compositing. |
+ scoped_ptr<gfx::GLSurface> gl_surface_; |
scoped_ptr<gfx::GLContext> gl_context_; |
gfx::Size size_; |
@@ -194,9 +195,8 @@ |
CompositorGL::CompositorGL(gfx::AcceleratedWidget widget) |
: started_(false) { |
- scoped_ptr<gfx::GLSurface> surface( |
- gfx::GLSurface::CreateViewGLSurface(widget)); |
- gl_context_.reset(gfx::GLContext::CreateGLContext(surface.release(), NULL)), |
+ gl_surface_.reset(gfx::GLSurface::CreateViewGLSurface(widget)); |
+ gl_context_.reset(gfx::GLContext::CreateGLContext(NULL, gl_surface.get())), |
gl_context_->MakeCurrent(); |
glColorMask(true, true, true, true); |
glEnable(GL_BLEND); |
@@ -221,7 +221,7 @@ |
void CompositorGL::NotifyStart() { |
started_ = true; |
- gl_context_->MakeCurrent(); |
+ gl_context_->MakeCurrent(gl_surface_.get()); |
glViewport(0, 0, |
gl_context_->GetSize().width(), gl_context_->GetSize().height()); |
@@ -235,7 +235,7 @@ |
void CompositorGL::NotifyEnd() { |
DCHECK(started_); |
- gl_context_->SwapBuffers(); |
+ gl_surface_->SwapBuffers(); |
started_ = false; |
} |
@@ -272,6 +272,7 @@ |
void RestoreTransform() OVERRIDE; |
// The GL context used for compositing. |
+ scoped_ptr<gfx::GLSurface> gl_surface_; |
scoped_ptr<gfx::GLContext> gl_context_; |
// Keep track of whether compositing has started or not. |
@@ -282,19 +283,18 @@ |
CompositorGL::CompositorGL(gfx::AcceleratedWidget widget) |
: started_(false) { |
- scoped_ptr<gfx::GLSurface> surface( |
- gfx::GLSurface::CreateViewGLSurface(widget)); |
- gl_context_.reset(gfx::GLContext::CreateGLContext(surface.release(), NULL)); |
+ gl_surface_.reset(gfx::GLSurface::CreateViewGLSurface(widget)); |
+ gl_context_.reset(gfx::GLContext::CreateGLContext(NULL, gl_surface_.get())); |
} |
void CompositorGL::NotifyStart() { |
started_ = true; |
- gl_context_->MakeCurrent(); |
+ gl_context_->MakeCurrent(gl_surface_.get()); |
} |
void CompositorGL::NotifyEnd() { |
DCHECK(started_); |
- gl_context_->SwapBuffers(); |
+ gl_surface_->SwapBuffers(); |
started_ = false; |
} |