| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gfx/x/x11_types.h" | 12 #include "ui/gfx/x/x11_types.h" |
| 13 #include "ui/gl/gl_bindings.h" | 13 #include "ui/gl/gl_bindings.h" |
| 14 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
| 15 #include "ui/gl/gl_surface_egl.h" | 15 #include "ui/gl/gl_surface_egl.h" |
| 16 #include "ui/gl/gl_surface_egl_x11.h" |
| 16 #include "ui/gl/gl_surface_glx.h" | 17 #include "ui/gl/gl_surface_glx.h" |
| 17 #include "ui/gl/gl_surface_osmesa.h" | 18 #include "ui/gl/gl_surface_osmesa.h" |
| 18 #include "ui/gl/gl_surface_stub.h" | 19 #include "ui/gl/gl_surface_stub.h" |
| 19 | 20 |
| 20 namespace gfx { | 21 namespace gfx { |
| 21 | 22 |
| 22 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a | 23 // This OSMesa GL surface can use XLib to swap the contents of the buffer to a |
| 23 // view. | 24 // view. |
| 24 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { | 25 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { |
| 25 public: | 26 public: |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 289 } |
| 289 case kGLImplementationDesktopGL: { | 290 case kGLImplementationDesktopGL: { |
| 290 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX(window)); | 291 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX(window)); |
| 291 if (!surface->Initialize()) | 292 if (!surface->Initialize()) |
| 292 return NULL; | 293 return NULL; |
| 293 | 294 |
| 294 return surface; | 295 return surface; |
| 295 } | 296 } |
| 296 case kGLImplementationEGLGLES2: { | 297 case kGLImplementationEGLGLES2: { |
| 297 DCHECK(window != gfx::kNullAcceleratedWidget); | 298 DCHECK(window != gfx::kNullAcceleratedWidget); |
| 298 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL(window)); | 299 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGLX11(window)); |
| 299 if (!surface->Initialize()) | 300 if (!surface->Initialize()) |
| 300 return NULL; | 301 return NULL; |
| 301 | 302 |
| 302 return surface; | 303 return surface; |
| 303 } | 304 } |
| 304 case kGLImplementationMockGL: | 305 case kGLImplementationMockGL: |
| 305 return new GLSurfaceStub; | 306 return new GLSurfaceStub; |
| 306 default: | 307 default: |
| 307 NOTREACHED(); | 308 NOTREACHED(); |
| 308 return NULL; | 309 return NULL; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 NOTREACHED(); | 343 NOTREACHED(); |
| 343 return NULL; | 344 return NULL; |
| 344 } | 345 } |
| 345 } | 346 } |
| 346 | 347 |
| 347 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 348 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 348 return gfx::GetXDisplay(); | 349 return gfx::GetXDisplay(); |
| 349 } | 350 } |
| 350 | 351 |
| 351 } // namespace gfx | 352 } // namespace gfx |
| OLD | NEW |