| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 } | 296 } |
| 297 case kGLImplementationMockGL: | 297 case kGLImplementationMockGL: |
| 298 return new GLSurfaceStub; | 298 return new GLSurfaceStub; |
| 299 default: | 299 default: |
| 300 NOTREACHED(); | 300 NOTREACHED(); |
| 301 return NULL; | 301 return NULL; |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 305 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
| 306 const gfx::Size& size, GLSurface::Format format) { | 306 const gfx::Size& size) { |
| 307 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); | 307 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); |
| 308 switch (GetGLImplementation()) { | 308 switch (GetGLImplementation()) { |
| 309 case kGLImplementationOSMesaGL: { | 309 case kGLImplementationOSMesaGL: { |
| 310 scoped_refptr<GLSurface> surface( | 310 scoped_refptr<GLSurface> surface( |
| 311 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); | 311 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); |
| 312 if (!surface->Initialize(format)) | 312 if (!surface->Initialize()) |
| 313 return NULL; | 313 return NULL; |
| 314 | 314 |
| 315 return surface; | 315 return surface; |
| 316 } | 316 } |
| 317 case kGLImplementationDesktopGL: { | 317 case kGLImplementationDesktopGL: { |
| 318 scoped_refptr<GLSurface> surface( | 318 scoped_refptr<GLSurface> surface( |
| 319 new UnmappedNativeViewGLSurfaceGLX(size)); | 319 new UnmappedNativeViewGLSurfaceGLX(size)); |
| 320 if (!surface->Initialize(format)) | 320 if (!surface->Initialize()) |
| 321 return NULL; | 321 return NULL; |
| 322 | 322 |
| 323 return surface; | 323 return surface; |
| 324 } | 324 } |
| 325 case kGLImplementationEGLGLES2: { | 325 case kGLImplementationEGLGLES2: { |
| 326 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); | 326 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); |
| 327 if (!surface->Initialize(format)) | 327 if (!surface->Initialize()) |
| 328 return NULL; | 328 return NULL; |
| 329 | 329 |
| 330 return surface; | 330 return surface; |
| 331 } | 331 } |
| 332 case kGLImplementationMockGL: | 332 case kGLImplementationMockGL: |
| 333 return new GLSurfaceStub; | 333 return new GLSurfaceStub; |
| 334 default: | 334 default: |
| 335 NOTREACHED(); | 335 NOTREACHED(); |
| 336 return NULL; | 336 return NULL; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 340 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 341 return gfx::GetXDisplay(); | 341 return gfx::GetXDisplay(); |
| 342 } | 342 } |
| 343 | 343 |
| 344 } // namespace gfx | 344 } // namespace gfx |
| OLD | NEW |