| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/surface/accelerated_surface_mac.h" | 5 #include "ui/surface/accelerated_surface_mac.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
| 10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Ensure GL is initialized before trying to create an offscreen GL context. | 32 // Ensure GL is initialized before trying to create an offscreen GL context. |
| 33 if (!gfx::GLSurface::InitializeOneOff()) | 33 if (!gfx::GLSurface::InitializeOneOff()) |
| 34 return false; | 34 return false; |
| 35 | 35 |
| 36 // Drawing to IOSurfaces via OpenGL only works with Apple's GL and | 36 // Drawing to IOSurfaces via OpenGL only works with Apple's GL and |
| 37 // not with the OSMesa software renderer. | 37 // not with the OSMesa software renderer. |
| 38 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL && | 38 if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL && |
| 39 gfx::GetGLImplementation() != gfx::kGLImplementationAppleGL) | 39 gfx::GetGLImplementation() != gfx::kGLImplementationAppleGL) |
| 40 return false; | 40 return false; |
| 41 | 41 |
| 42 gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface( | 42 gl_surface_ = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); |
| 43 false, gfx::Size(1, 1)); | |
| 44 if (!gl_surface_.get()) { | 43 if (!gl_surface_.get()) { |
| 45 Destroy(); | 44 Destroy(); |
| 46 return false; | 45 return false; |
| 47 } | 46 } |
| 48 | 47 |
| 49 gfx::GLShareGroup* share_group = | 48 gfx::GLShareGroup* share_group = |
| 50 share_context ? share_context->share_group() : NULL; | 49 share_context ? share_context->share_group() : NULL; |
| 51 | 50 |
| 52 gl_context_ = gfx::GLContext::CreateGLContext( | 51 gl_context_ = gfx::GLContext::CreateGLContext( |
| 53 share_group, | 52 share_group, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // make our IOSurfaces global and send back their identifiers. On | 266 // make our IOSurfaces global and send back their identifiers. On |
| 268 // the browser process side the identifier is reconstituted into an | 267 // the browser process side the identifier is reconstituted into an |
| 269 // IOSurface for on-screen rendering. | 268 // IOSurface for on-screen rendering. |
| 270 io_surface_id_ = io_surface_support->IOSurfaceGetID(io_surface_); | 269 io_surface_id_ = io_surface_support->IOSurfaceGetID(io_surface_); |
| 271 return io_surface_id_; | 270 return io_surface_id_; |
| 272 } | 271 } |
| 273 | 272 |
| 274 uint32 AcceleratedSurface::GetSurfaceId() { | 273 uint32 AcceleratedSurface::GetSurfaceId() { |
| 275 return io_surface_id_; | 274 return io_surface_id_; |
| 276 } | 275 } |
| OLD | NEW |