OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/gl/gl_surface.h" | 5 #include "ui/gfx/gl/gl_surface.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" | 9 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" |
10 #include "ui/gfx/gl/gl_bindings.h" | 10 #include "ui/gfx/gl/gl_bindings.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 default: | 89 default: |
90 break; | 90 break; |
91 } | 91 } |
92 | 92 |
93 initialized = true; | 93 initialized = true; |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( | 97 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( |
98 gfx::PluginWindowHandle window) | 98 gfx::PluginWindowHandle window) |
99 : GLSurfaceOSMesa(gfx::Size()), | 99 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size()), |
100 window_graphics_context_(0), | 100 window_graphics_context_(0), |
101 window_(window), | 101 window_(window), |
102 pixmap_graphics_context_(0), | 102 pixmap_graphics_context_(0), |
103 pixmap_(0) { | 103 pixmap_(0) { |
104 DCHECK(window); | 104 DCHECK(window); |
105 } | 105 } |
106 | 106 |
107 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { | 107 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { |
108 Destroy(); | 108 Destroy(); |
109 } | 109 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 return new GLSurfaceStub; | 273 return new GLSurfaceStub; |
274 default: | 274 default: |
275 NOTREACHED(); | 275 NOTREACHED(); |
276 return NULL; | 276 return NULL; |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 GLSurface* GLSurface::CreateOffscreenGLSurface(const gfx::Size& size) { | 280 GLSurface* GLSurface::CreateOffscreenGLSurface(const gfx::Size& size) { |
281 switch (GetGLImplementation()) { | 281 switch (GetGLImplementation()) { |
282 case kGLImplementationOSMesaGL: { | 282 case kGLImplementationOSMesaGL: { |
283 scoped_ptr<GLSurfaceOSMesa> surface(new GLSurfaceOSMesa(size)); | 283 scoped_ptr<GLSurfaceOSMesa> surface(new GLSurfaceOSMesa(OSMESA_RGBA, |
| 284 size)); |
284 if (!surface->Initialize()) | 285 if (!surface->Initialize()) |
285 return NULL; | 286 return NULL; |
286 | 287 |
287 return surface.release(); | 288 return surface.release(); |
288 } | 289 } |
289 case kGLImplementationEGLGLES2: { | 290 case kGLImplementationEGLGLES2: { |
290 scoped_ptr<PbufferGLSurfaceEGL> surface(new PbufferGLSurfaceEGL(size)); | 291 scoped_ptr<PbufferGLSurfaceEGL> surface(new PbufferGLSurfaceEGL(size)); |
291 if (!surface->Initialize()) | 292 if (!surface->Initialize()) |
292 return NULL; | 293 return NULL; |
293 | 294 |
294 return surface.release(); | 295 return surface.release(); |
295 } | 296 } |
296 case kGLImplementationDesktopGL: { | 297 case kGLImplementationDesktopGL: { |
297 scoped_ptr<PbufferGLSurfaceGLX> surface(new PbufferGLSurfaceGLX(size)); | 298 scoped_ptr<PbufferGLSurfaceGLX> surface(new PbufferGLSurfaceGLX(size)); |
298 if (!surface->Initialize()) | 299 if (!surface->Initialize()) |
299 return NULL; | 300 return NULL; |
300 | 301 |
301 return surface.release(); | 302 return surface.release(); |
302 } | 303 } |
303 case kGLImplementationMockGL: | 304 case kGLImplementationMockGL: |
304 return new GLSurfaceStub; | 305 return new GLSurfaceStub; |
305 default: | 306 default: |
306 NOTREACHED(); | 307 NOTREACHED(); |
307 return NULL; | 308 return NULL; |
308 } | 309 } |
309 } | 310 } |
310 | 311 |
311 } // namespace gfx | 312 } // namespace gfx |
OLD | NEW |