| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "third_party/khronos/EGL/egl.h" | 9 #include "third_party/khronos/EGL/egl.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
| 12 #include "ui/gl/gl_surface_egl.h" | 12 #include "ui/gl/gl_surface_egl.h" |
| 13 #include "ui/gl/gl_surface_osmesa.h" | 13 #include "ui/gl/gl_surface_osmesa.h" |
| 14 #include "ui/gl/gl_surface_stub.h" | 14 #include "ui/gl/gl_surface_stub.h" |
| 15 | 15 |
| 16 namespace gl { | 16 namespace gl { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 bool GLSurface::InitializeOneOffInternal() { | |
| 20 switch (GetGLImplementation()) { | |
| 21 case kGLImplementationEGLGLES2: | |
| 22 if (!GLSurfaceEGL::InitializeOneOff()) { | |
| 23 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | |
| 24 return false; | |
| 25 } | |
| 26 default: | |
| 27 break; | |
| 28 } | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 // static | |
| 33 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 19 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
| 34 gfx::AcceleratedWidget window) { | 20 gfx::AcceleratedWidget window) { |
| 35 CHECK_NE(kGLImplementationNone, GetGLImplementation()); | 21 CHECK_NE(kGLImplementationNone, GetGLImplementation()); |
| 36 if (GetGLImplementation() == kGLImplementationOSMesaGL) { | 22 if (GetGLImplementation() == kGLImplementationOSMesaGL) { |
| 37 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); | 23 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); |
| 38 if (!surface->Initialize()) | 24 if (!surface->Initialize()) |
| 39 return NULL; | 25 return NULL; |
| 40 return surface; | 26 return surface; |
| 41 } | 27 } |
| 42 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); | 28 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 NOTREACHED(); | 70 NOTREACHED(); |
| 85 return NULL; | 71 return NULL; |
| 86 } | 72 } |
| 87 } | 73 } |
| 88 | 74 |
| 89 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 75 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 90 return EGL_DEFAULT_DISPLAY; | 76 return EGL_DEFAULT_DISPLAY; |
| 91 } | 77 } |
| 92 | 78 |
| 93 } // namespace gl | 79 } // namespace gl |
| OLD | NEW |