diff options
Diffstat (limited to 'ui/gfx/surface/accelerated_surface_mac.cc')
-rw-r--r-- | ui/gfx/surface/accelerated_surface_mac.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/ui/gfx/surface/accelerated_surface_mac.cc b/ui/gfx/surface/accelerated_surface_mac.cc index 43c6890..2210a6f 100644 --- a/ui/gfx/surface/accelerated_surface_mac.cc +++ b/ui/gfx/surface/accelerated_surface_mac.cc @@ -8,6 +8,7 @@ #include "base/mac/scoped_cftyperef.h" #include "ui/gfx/gl/gl_bindings.h" #include "ui/gfx/gl/gl_implementation.h" +#include "ui/gfx/gl/gl_surface.h" #include "ui/gfx/rect.h" #include "ui/gfx/surface/io_surface_support_mac.h" @@ -26,7 +27,7 @@ bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, allocate_fbo_ = allocate_fbo; // Ensure GL is initialized before trying to create an offscreen GL context. - if (!gfx::GLContext::InitializeOneOff()) + if (!gfx::GLSurface::InitializeOneOff()) return false; // Drawing to IOSurfaces via OpenGL only works with desktop GL and @@ -34,9 +35,19 @@ bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) return false; - gl_context_.reset(gfx::GLContext::CreateOffscreenGLContext(share_context)); - if (!gl_context_.get()) + scoped_ptr<gfx::GLSurface> surface(gfx::GLSurface::CreateOffscreenGLSurface( + gfx::Size(1, 1))); + if (!surface.get()) { + Destroy(); return false; + } + + gl_context_.reset(gfx::GLContext::CreateGLContext(surface.release(), + share_context)); + if (!gl_context_.get()) { + Destroy(); + return false; + } // Now we're ready to handle SetSurfaceSize calls, which will // allocate and/or reallocate the IOSurface and associated offscreen |