Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: ui/gfx/surface/accelerated_surface_mac.cc

Issue 7021014: GLContext no longer holds a pointer to a GLSurface. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/gfx/surface/accelerated_surface_mac.cc
===================================================================
--- ui/gfx/surface/accelerated_surface_mac.cc (revision 86168)
+++ ui/gfx/surface/accelerated_surface_mac.cc (working copy)
@@ -35,15 +35,14 @@
if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL)
return false;
- scoped_ptr<gfx::GLSurface> surface(gfx::GLSurface::CreateOffscreenGLSurface(
- gfx::Size(1, 1)));
- if (!surface.get()) {
+ gl_surface_.reset(gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)));
+ if (!gl_surface_.get()) {
Destroy();
return false;
}
- gl_context_.reset(gfx::GLContext::CreateGLContext(surface.release(),
- share_context));
+ gl_context_.reset(gfx::GLContext::CreateGLContext(share_context,
+ gl_surface_.get()));
if (!gl_context_.get()) {
Destroy();
return false;
@@ -67,9 +66,8 @@
}
transport_dib_.reset();
- if (gl_context_.get())
- gl_context_->Destroy();
gl_context_.reset();
+ gl_surface_.reset();
}
// Call after making changes to the surface which require a visual update.
@@ -199,11 +197,11 @@
bool AcceleratedSurface::MakeCurrent() {
if (!gl_context_.get())
return false;
- return gl_context_->MakeCurrent();
+ return gl_context_->MakeCurrent(gl_surface_.get());
}
void AcceleratedSurface::Clear(const gfx::Rect& rect) {
- DCHECK(gl_context_->IsCurrent());
+ DCHECK(gl_context_->IsCurrent(gl_surface_.get()));
glClearColor(0, 0, 0, 0);
glViewport(0, 0, rect.width(), rect.height());
glMatrixMode(GL_PROJECTION);
@@ -334,7 +332,7 @@
}
if (allocate_fbo_) {
- DCHECK(gl_context_->IsCurrent());
+ DCHECK(gl_context_->IsCurrent(gl_surface_.get()));
// Set up the render buffers and reserve enough space on the card for the
// framebuffer texture.
GLenum target = GL_TEXTURE_RECTANGLE_ARB;

Powered by Google App Engine
This is Rietveld 408576698