| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gl/gl_bindings.h" | 15 #include "ui/gl/gl_bindings.h" |
| 16 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
| 17 #include "ui/gl/gl_surface_egl.h" | 17 #include "ui/gl/gl_surface_egl.h" |
| 18 #include "ui/gl/gl_surface_egl_x11.h" | 18 #include "ui/gl/gl_surface_egl_x11.h" |
| 19 #include "ui/gl/gl_surface_glx.h" | 19 #include "ui/gl/gl_surface_glx.h" |
| 20 #include "ui/gl/gl_surface_osmesa_x11.h" | 20 #include "ui/gl/gl_surface_osmesa_x11.h" |
| 21 #include "ui/gl/gl_surface_stub.h" | 21 #include "ui/gl/gl_surface_stub.h" |
| 22 | 22 |
| 23 namespace gl { | 23 namespace gl { |
| 24 | 24 |
| 25 namespace { | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 bool GLSurface::InitializeOneOffInternal() { | |
| 30 switch (GetGLImplementation()) { | |
| 31 case kGLImplementationDesktopGL: | |
| 32 if (!GLSurfaceGLX::InitializeOneOff()) { | |
| 33 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; | |
| 34 return false; | |
| 35 } | |
| 36 break; | |
| 37 case kGLImplementationOSMesaGL: | |
| 38 if (!GLSurfaceOSMesaX11::InitializeOneOff()) { | |
| 39 LOG(ERROR) << "GLSurfaceOSMesaX11::InitializeOneOff failed."; | |
| 40 return false; | |
| 41 } | |
| 42 break; | |
| 43 case kGLImplementationEGLGLES2: | |
| 44 if (!GLSurfaceEGL::InitializeOneOff()) { | |
| 45 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | |
| 46 return false; | |
| 47 } | |
| 48 break; | |
| 49 default: | |
| 50 break; | |
| 51 } | |
| 52 | |
| 53 return true; | |
| 54 } | |
| 55 | |
| 56 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 25 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
| 57 gfx::AcceleratedWidget window) { | 26 gfx::AcceleratedWidget window) { |
| 58 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); | 27 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); |
| 59 switch (GetGLImplementation()) { | 28 switch (GetGLImplementation()) { |
| 60 case kGLImplementationOSMesaGL: { | 29 case kGLImplementationOSMesaGL: { |
| 61 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaX11(window)); | 30 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaX11(window)); |
| 62 if (!surface->Initialize()) | 31 if (!surface->Initialize()) |
| 63 return NULL; | 32 return NULL; |
| 64 | 33 |
| 65 return surface; | 34 return surface; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 NOTREACHED(); | 89 NOTREACHED(); |
| 121 return NULL; | 90 return NULL; |
| 122 } | 91 } |
| 123 } | 92 } |
| 124 | 93 |
| 125 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 94 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 126 return gfx::GetXDisplay(); | 95 return gfx::GetXDisplay(); |
| 127 } | 96 } |
| 128 | 97 |
| 129 } // namespace gl | 98 } // namespace gl |
| OLD | NEW |