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 "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gl/gl_context.h" | 10 #include "ui/gl/gl_context.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return surface; | 147 return surface; |
148 } | 148 } |
149 return NULL; | 149 return NULL; |
150 } | 150 } |
151 | 151 |
152 // static | 152 // static |
153 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 153 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
154 const gfx::Size& size) { | 154 const gfx::Size& size) { |
155 switch (GetGLImplementation()) { | 155 switch (GetGLImplementation()) { |
156 case kGLImplementationOSMesaGL: { | 156 case kGLImplementationOSMesaGL: { |
157 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(1, size)); | 157 scoped_refptr<GLSurface> surface( |
| 158 new GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, size)); |
158 if (!surface->Initialize()) | 159 if (!surface->Initialize()) |
159 return NULL; | 160 return NULL; |
160 | 161 |
161 return surface; | 162 return surface; |
162 } | 163 } |
163 case kGLImplementationEGLGLES2: { | 164 case kGLImplementationEGLGLES2: { |
164 scoped_refptr<GLSurface> surface; | 165 scoped_refptr<GLSurface> surface; |
165 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && | 166 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && |
166 (size.width() == 0 && size.height() == 0)) { | 167 (size.width() == 0 && size.height() == 0)) { |
167 surface = new SurfacelessEGL(size); | 168 surface = new SurfacelessEGL(size); |
168 } else | 169 } else |
169 surface = new PbufferGLSurfaceEGL(size); | 170 surface = new PbufferGLSurfaceEGL(size); |
170 | 171 |
171 if (!surface->Initialize()) | 172 if (!surface->Initialize()) |
172 return NULL; | 173 return NULL; |
173 return surface; | 174 return surface; |
174 } | 175 } |
175 default: | 176 default: |
176 NOTREACHED(); | 177 NOTREACHED(); |
177 return NULL; | 178 return NULL; |
178 } | 179 } |
179 } | 180 } |
180 | 181 |
181 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 182 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
182 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); | 183 return ui::SurfaceFactoryOzone::GetInstance()->GetNativeDisplay(); |
183 } | 184 } |
184 | 185 |
185 } // namespace gfx | 186 } // namespace gfx |
OLD | NEW |