| 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" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 return NULL; | 52 return NULL; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // static | 55 // static |
| 56 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 56 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
| 57 const gfx::Size& size) { | 57 const gfx::Size& size) { |
| 58 CHECK_NE(kGLImplementationNone, GetGLImplementation()); | 58 CHECK_NE(kGLImplementationNone, GetGLImplementation()); |
| 59 switch (GetGLImplementation()) { | 59 switch (GetGLImplementation()) { |
| 60 case kGLImplementationOSMesaGL: { | 60 case kGLImplementationOSMesaGL: { |
| 61 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(1, size)); | 61 scoped_refptr<GLSurface> surface( |
| 62 new GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, size)); |
| 62 if (!surface->Initialize()) | 63 if (!surface->Initialize()) |
| 63 return NULL; | 64 return NULL; |
| 64 | 65 |
| 65 return surface; | 66 return surface; |
| 66 } | 67 } |
| 67 case kGLImplementationEGLGLES2: { | 68 case kGLImplementationEGLGLES2: { |
| 68 scoped_refptr<GLSurface> surface; | 69 scoped_refptr<GLSurface> surface; |
| 69 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && | 70 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && |
| 70 (size.width() == 0 && size.height() == 0)) { | 71 (size.width() == 0 && size.height() == 0)) { |
| 71 surface = new SurfacelessEGL(size); | 72 surface = new SurfacelessEGL(size); |
| 72 } else { | 73 } else { |
| 73 surface = new PbufferGLSurfaceEGL(size); | 74 surface = new PbufferGLSurfaceEGL(size); |
| 74 } | 75 } |
| 75 | 76 |
| 76 if (!surface->Initialize()) | 77 if (!surface->Initialize()) |
| 77 return NULL; | 78 return NULL; |
| 78 return surface; | 79 return surface; |
| 79 } | 80 } |
| 80 default: | 81 default: |
| 81 NOTREACHED(); | 82 NOTREACHED(); |
| 82 return NULL; | 83 return NULL; |
| 83 } | 84 } |
| 84 } | 85 } |
| 85 | 86 |
| 86 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 87 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 87 return EGL_DEFAULT_DISPLAY; | 88 return EGL_DEFAULT_DISPLAY; |
| 88 } | 89 } |
| 89 | 90 |
| 90 } // namespace gfx | 91 } // namespace gfx |
| OLD | NEW |