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 <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 NOTREACHED(); | 74 NOTREACHED(); |
75 case kGLImplementationOSMesaGL: | 75 case kGLImplementationOSMesaGL: |
76 case kGLImplementationMockGL: | 76 case kGLImplementationMockGL: |
77 break; | 77 break; |
78 } | 78 } |
79 return true; | 79 return true; |
80 } | 80 } |
81 | 81 |
82 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( | 82 NativeViewGLSurfaceOSMesa::NativeViewGLSurfaceOSMesa( |
83 gfx::AcceleratedWidget window) | 83 gfx::AcceleratedWidget window) |
84 : GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, gfx::Size(1, 1)), | 84 : GLSurfaceOSMesa(SURFACE_OSMESA_RGBA, gfx::Size(1, 1)), |
85 window_(window), | 85 window_(window), |
86 device_context_(NULL) { | 86 device_context_(NULL) { |
87 DCHECK(window); | 87 DCHECK(window); |
88 } | 88 } |
89 | 89 |
90 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { | 90 NativeViewGLSurfaceOSMesa::~NativeViewGLSurfaceOSMesa() { |
91 Destroy(); | 91 Destroy(); |
92 } | 92 } |
93 | 93 |
94 bool NativeViewGLSurfaceOSMesa::Initialize(GLSurface::Format format) { | 94 bool NativeViewGLSurfaceOSMesa::Initialize(GLSurface::Format format) { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 case kGLImplementationMockGL: | 225 case kGLImplementationMockGL: |
226 return new GLSurfaceStub; | 226 return new GLSurfaceStub; |
227 default: | 227 default: |
228 NOTREACHED(); | 228 NOTREACHED(); |
229 return NULL; | 229 return NULL; |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 233 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
234 const gfx::Size& size, GLSurface::Format format) { | 234 const gfx::Size& size) { |
235 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); | 235 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); |
236 switch (GetGLImplementation()) { | 236 switch (GetGLImplementation()) { |
237 case kGLImplementationOSMesaGL: { | 237 case kGLImplementationOSMesaGL: { |
238 scoped_refptr<GLSurface> surface( | 238 scoped_refptr<GLSurface> surface( |
239 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); | 239 new GLSurfaceOSMesa(SURFACE_OSMESA_RGBA, size)); |
240 if (!surface->Initialize(format)) | 240 if (!surface->Initialize()) |
241 return NULL; | 241 return NULL; |
242 | 242 |
243 return surface; | 243 return surface; |
244 } | 244 } |
245 case kGLImplementationEGLGLES2: { | 245 case kGLImplementationEGLGLES2: { |
246 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); | 246 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); |
247 if (!surface->Initialize(format)) | 247 if (!surface->Initialize()) |
248 return NULL; | 248 return NULL; |
249 | 249 |
250 return surface; | 250 return surface; |
251 } | 251 } |
252 case kGLImplementationDesktopGL: { | 252 case kGLImplementationDesktopGL: { |
253 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceWGL(size)); | 253 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceWGL(size)); |
254 if (!surface->Initialize(format)) | 254 if (!surface->Initialize()) |
255 return NULL; | 255 return NULL; |
256 | 256 |
257 return surface; | 257 return surface; |
258 } | 258 } |
259 case kGLImplementationMockGL: | 259 case kGLImplementationMockGL: |
260 return new GLSurfaceStub; | 260 return new GLSurfaceStub; |
261 default: | 261 default: |
262 NOTREACHED(); | 262 NOTREACHED(); |
263 return NULL; | 263 return NULL; |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 267 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
268 return GetDC(NULL); | 268 return GetDC(NULL); |
269 } | 269 } |
270 | 270 |
271 } // namespace gfx | 271 } // namespace gfx |
OLD | NEW |