| 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 <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 11 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
| 13 #include "third_party/mesa/src/include/GL/osmesa.h" | 14 #include "third_party/mesa/src/include/GL/osmesa.h" |
| 14 #include "ui/gfx/frame_time.h" | 15 #include "ui/gfx/frame_time.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 17 #include "ui/gl/gl_implementation.h" | 18 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/gl/gl_surface_egl.h" | 19 #include "ui/gl/gl_surface_egl.h" |
| 19 #include "ui/gl/gl_surface_osmesa.h" | 20 #include "ui/gl/gl_surface_osmesa.h" |
| 20 #include "ui/gl/gl_surface_stub.h" | 21 #include "ui/gl/gl_surface_stub.h" |
| 21 #include "ui/gl/gl_surface_wgl.h" | 22 #include "ui/gl/gl_surface_wgl.h" |
| 22 | 23 |
| 24 // From ANGLE's egl/eglext.h. |
| 25 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) |
| 26 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ |
| 27 reinterpret_cast<EGLNativeDisplayType>(-2) |
| 28 #endif |
| 29 |
| 23 namespace gfx { | 30 namespace gfx { |
| 24 | 31 |
| 25 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a | 32 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a |
| 26 // view. | 33 // view. |
| 27 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { | 34 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { |
| 28 public: | 35 public: |
| 29 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); | 36 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); |
| 30 virtual ~NativeViewGLSurfaceOSMesa(); | 37 virtual ~NativeViewGLSurfaceOSMesa(); |
| 31 | 38 |
| 32 // Implement subset of GLSurface. | 39 // Implement subset of GLSurface. |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 return surface; | 287 return surface; |
| 281 } | 288 } |
| 282 case kGLImplementationMockGL: | 289 case kGLImplementationMockGL: |
| 283 return new GLSurfaceStub; | 290 return new GLSurfaceStub; |
| 284 default: | 291 default: |
| 285 NOTREACHED(); | 292 NOTREACHED(); |
| 286 return NULL; | 293 return NULL; |
| 287 } | 294 } |
| 288 } | 295 } |
| 289 | 296 |
| 297 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 298 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11)) |
| 299 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; |
| 300 |
| 301 return EGL_DEFAULT_DISPLAY; |
| 302 } |
| 303 |
| 290 } // namespace gfx | 304 } // namespace gfx |
| OLD | NEW |