| 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/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "third_party/mesa/src/include/GL/osmesa.h" | |
| 12 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 13 #include "ui/gfx/x/x11_types.h" | 12 #include "ui/gfx/x/x11_types.h" |
| 14 #include "ui/gl/gl_bindings.h" | 13 #include "ui/gl/gl_bindings.h" |
| 15 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
| 16 #include "ui/gl/gl_surface_egl.h" | 15 #include "ui/gl/gl_surface_egl.h" |
| 17 #include "ui/gl/gl_surface_glx.h" | 16 #include "ui/gl/gl_surface_glx.h" |
| 18 #include "ui/gl/gl_surface_osmesa.h" | 17 #include "ui/gl/gl_surface_osmesa.h" |
| 19 #include "ui/gl/gl_surface_stub.h" | 18 #include "ui/gl/gl_surface_stub.h" |
| 20 | 19 |
| 21 namespace gfx { | 20 namespace gfx { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 break; | 71 break; |
| 73 default: | 72 default: |
| 74 break; | 73 break; |
| 75 } | 74 } |
| 76 | 75 |
| 77 return true; | 76 return true; |
| 78 } | 77 } |
| 79 | 78 |
| 80 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( | 79 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( |
| 81 gfx::AcceleratedWidget window) | 80 gfx::AcceleratedWidget window) |
| 82 : GLSurfaceOSMesa(OSMESA_BGRA, gfx::Size(1, 1)), | 81 : GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, gfx::Size(1, 1)), |
| 83 xdisplay_(gfx::GetXDisplay()), | 82 xdisplay_(gfx::GetXDisplay()), |
| 84 window_graphics_context_(0), | 83 window_graphics_context_(0), |
| 85 window_(window), | 84 window_(window), |
| 86 pixmap_graphics_context_(0), | 85 pixmap_graphics_context_(0), |
| 87 pixmap_(0) { | 86 pixmap_(0) { |
| 88 DCHECK(xdisplay_); | 87 DCHECK(xdisplay_); |
| 89 DCHECK(window_); | 88 DCHECK(window_); |
| 90 } | 89 } |
| 91 | 90 |
| 92 // static | 91 // static |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 NOTREACHED(); | 304 NOTREACHED(); |
| 306 return NULL; | 305 return NULL; |
| 307 } | 306 } |
| 308 } | 307 } |
| 309 | 308 |
| 310 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 309 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
| 311 const gfx::Size& size) { | 310 const gfx::Size& size) { |
| 312 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); | 311 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); |
| 313 switch (GetGLImplementation()) { | 312 switch (GetGLImplementation()) { |
| 314 case kGLImplementationOSMesaGL: { | 313 case kGLImplementationOSMesaGL: { |
| 315 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, | 314 scoped_refptr<GLSurface> surface( |
| 316 size)); | 315 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); |
| 317 if (!surface->Initialize()) | 316 if (!surface->Initialize()) |
| 318 return NULL; | 317 return NULL; |
| 319 | 318 |
| 320 return surface; | 319 return surface; |
| 321 } | 320 } |
| 322 case kGLImplementationDesktopGL: { | 321 case kGLImplementationDesktopGL: { |
| 323 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size)); | 322 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size)); |
| 324 if (!surface->Initialize()) | 323 if (!surface->Initialize()) |
| 325 return NULL; | 324 return NULL; |
| 326 | 325 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 339 NOTREACHED(); | 338 NOTREACHED(); |
| 340 return NULL; | 339 return NULL; |
| 341 } | 340 } |
| 342 } | 341 } |
| 343 | 342 |
| 344 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 343 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 345 return gfx::GetXDisplay(); | 344 return gfx::GetXDisplay(); |
| 346 } | 345 } |
| 347 | 346 |
| 348 } // namespace gfx | 347 } // namespace gfx |
| OLD | NEW |