Chromium Code Reviews| 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 gfx { | 16 namespace gfx { |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 bool GLSurface::InitializeOneOffInternal() { | 19 bool GLSurface::InitializeOneOffInternal() { |
| 20 switch (GetGLImplementation()) { | 20 auto implementation = GetGLImplementation(); |
|
abarth-chromium
2015/06/03 21:55:06
It's not clear to me whether |auto| is a good type
| |
| 21 switch (implementation) { | |
| 21 case kGLImplementationEGLGLES2: | 22 case kGLImplementationEGLGLES2: |
| 22 if (!GLSurfaceEGL::InitializeOneOff()) { | 23 if (!GLSurfaceEGL::InitializeOneOff()) { |
| 23 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; | 24 LOG(ERROR) << "GLSurfaceEGL::InitializeOneOff failed."; |
| 24 return false; | 25 return false; |
| 25 } | 26 } |
| 27 break; | |
| 26 default: | 28 default: |
| 27 break; | 29 LOG(ERROR) |
| 30 << "Unknown GL implementation returned from GetGLImplementation: " | |
| 31 << implementation; | |
| 32 return false; | |
| 28 } | 33 } |
| 29 return true; | 34 return true; |
| 30 } | 35 } |
| 31 | 36 |
| 32 // static | 37 // static |
| 33 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 38 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
| 34 gfx::AcceleratedWidget window) { | 39 gfx::AcceleratedWidget window) { |
| 35 CHECK_NE(kGLImplementationNone, GetGLImplementation()); | 40 CHECK_NE(kGLImplementationNone, GetGLImplementation()); |
| 36 if (GetGLImplementation() == kGLImplementationOSMesaGL) { | 41 if (GetGLImplementation() == kGLImplementationOSMesaGL) { |
| 37 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); | 42 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 82 NOTREACHED(); | 87 NOTREACHED(); |
| 83 return NULL; | 88 return NULL; |
| 84 } | 89 } |
| 85 } | 90 } |
| 86 | 91 |
| 87 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 92 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 88 return EGL_DEFAULT_DISPLAY; | 93 return EGL_DEFAULT_DISPLAY; |
| 89 } | 94 } |
| 90 | 95 |
| 91 } // namespace gfx | 96 } // namespace gfx |
| OLD | NEW |