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/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
13 #include "third_party/mesa/src/include/GL/osmesa.h" | 13 #include "third_party/mesa/src/include/GL/osmesa.h" |
14 #include "ui/gfx/frame_time.h" | 14 #include "ui/gfx/frame_time.h" |
| 15 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/gl/gl_bindings.h" | 16 #include "ui/gl/gl_bindings.h" |
16 #include "ui/gl/gl_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
17 #include "ui/gl/gl_surface_egl.h" | 18 #include "ui/gl/gl_surface_egl.h" |
18 #include "ui/gl/gl_surface_osmesa.h" | 19 #include "ui/gl/gl_surface_osmesa.h" |
19 #include "ui/gl/gl_surface_stub.h" | 20 #include "ui/gl/gl_surface_stub.h" |
20 #include "ui/gl/gl_surface_wgl.h" | 21 #include "ui/gl/gl_surface_wgl.h" |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 | 24 |
24 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a | 25 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 switch (GetGLImplementation()) { | 222 switch (GetGLImplementation()) { |
222 case kGLImplementationOSMesaGL: { | 223 case kGLImplementationOSMesaGL: { |
223 scoped_refptr<GLSurface> surface( | 224 scoped_refptr<GLSurface> surface( |
224 new NativeViewGLSurfaceOSMesa(window)); | 225 new NativeViewGLSurfaceOSMesa(window)); |
225 if (!surface->Initialize()) | 226 if (!surface->Initialize()) |
226 return NULL; | 227 return NULL; |
227 | 228 |
228 return surface; | 229 return surface; |
229 } | 230 } |
230 case kGLImplementationEGLGLES2: { | 231 case kGLImplementationEGLGLES2: { |
| 232 DCHECK(window != gfx::kNullAcceleratedWidget); |
231 scoped_refptr<NativeViewGLSurfaceEGL> surface( | 233 scoped_refptr<NativeViewGLSurfaceEGL> surface( |
232 new NativeViewGLSurfaceEGL(window)); | 234 new NativeViewGLSurfaceEGL(window)); |
233 scoped_ptr<VSyncProvider> sync_provider; | 235 scoped_ptr<VSyncProvider> sync_provider; |
234 if (base::win::GetVersion() >= base::win::VERSION_VISTA) | 236 if (base::win::GetVersion() >= base::win::VERSION_VISTA) |
235 sync_provider.reset(new DWMVSyncProvider); | 237 sync_provider.reset(new DWMVSyncProvider); |
236 if (!surface->Initialize(sync_provider.Pass())) | 238 if (!surface->Initialize(sync_provider.Pass())) |
237 return NULL; | 239 return NULL; |
238 | 240 |
239 return surface; | 241 return surface; |
240 } | 242 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 284 } |
283 case kGLImplementationMockGL: | 285 case kGLImplementationMockGL: |
284 return new GLSurfaceStub; | 286 return new GLSurfaceStub; |
285 default: | 287 default: |
286 NOTREACHED(); | 288 NOTREACHED(); |
287 return NULL; | 289 return NULL; |
288 } | 290 } |
289 } | 291 } |
290 | 292 |
291 } // namespace gfx | 293 } // namespace gfx |
OLD | NEW |