| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 gfx::AcceleratedWidget window_; | 45 gfx::AcceleratedWidget window_; |
| 46 GC pixmap_graphics_context_; | 46 GC pixmap_graphics_context_; |
| 47 Pixmap pixmap_; | 47 Pixmap pixmap_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); | 49 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceOSMesa); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 bool GLSurface::InitializeOneOffInternal() { | 52 bool GLSurface::InitializeOneOffInternal() { |
| 53 switch (GetGLImplementation()) { | 53 switch (GetGLImplementation()) { |
| 54 case kGLImplementationDesktopGL: | 54 case kGLImplementationDesktopGL: |
| 55 case kGLImplementationDesktopGLCoreProfile: | |
| 56 if (!GLSurfaceGLX::InitializeOneOff()) { | 55 if (!GLSurfaceGLX::InitializeOneOff()) { |
| 57 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; | 56 LOG(ERROR) << "GLSurfaceGLX::InitializeOneOff failed."; |
| 58 return false; | 57 return false; |
| 59 } | 58 } |
| 60 break; | 59 break; |
| 61 case kGLImplementationOSMesaGL: | 60 case kGLImplementationOSMesaGL: |
| 62 if (!NativeViewGLSurfaceOSMesa::InitializeOneOff()) { | 61 if (!NativeViewGLSurfaceOSMesa::InitializeOneOff()) { |
| 63 LOG(ERROR) << "NativeViewGLSurfaceOSMesa::InitializeOneOff failed."; | 62 LOG(ERROR) << "NativeViewGLSurfaceOSMesa::InitializeOneOff failed."; |
| 64 return false; | 63 return false; |
| 65 } | 64 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); | 276 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); |
| 278 switch (GetGLImplementation()) { | 277 switch (GetGLImplementation()) { |
| 279 case kGLImplementationOSMesaGL: { | 278 case kGLImplementationOSMesaGL: { |
| 280 scoped_refptr<GLSurface> surface( | 279 scoped_refptr<GLSurface> surface( |
| 281 new NativeViewGLSurfaceOSMesa(window)); | 280 new NativeViewGLSurfaceOSMesa(window)); |
| 282 if (!surface->Initialize()) | 281 if (!surface->Initialize()) |
| 283 return NULL; | 282 return NULL; |
| 284 | 283 |
| 285 return surface; | 284 return surface; |
| 286 } | 285 } |
| 287 case kGLImplementationDesktopGL: | 286 case kGLImplementationDesktopGL: { |
| 288 case kGLImplementationDesktopGLCoreProfile: { | |
| 289 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX(window)); | 287 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceGLX(window)); |
| 290 if (!surface->Initialize()) | 288 if (!surface->Initialize()) |
| 291 return NULL; | 289 return NULL; |
| 292 | 290 |
| 293 return surface; | 291 return surface; |
| 294 } | 292 } |
| 295 case kGLImplementationEGLGLES2: { | 293 case kGLImplementationEGLGLES2: { |
| 296 DCHECK(window != gfx::kNullAcceleratedWidget); | 294 DCHECK(window != gfx::kNullAcceleratedWidget); |
| 297 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL(window)); | 295 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceEGL(window)); |
| 298 if (!surface->Initialize()) | 296 if (!surface->Initialize()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 313 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); | 311 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); |
| 314 switch (GetGLImplementation()) { | 312 switch (GetGLImplementation()) { |
| 315 case kGLImplementationOSMesaGL: { | 313 case kGLImplementationOSMesaGL: { |
| 316 scoped_refptr<GLSurface> surface( | 314 scoped_refptr<GLSurface> surface( |
| 317 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); | 315 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); |
| 318 if (!surface->Initialize()) | 316 if (!surface->Initialize()) |
| 319 return NULL; | 317 return NULL; |
| 320 | 318 |
| 321 return surface; | 319 return surface; |
| 322 } | 320 } |
| 323 case kGLImplementationDesktopGL: | 321 case kGLImplementationDesktopGL: { |
| 324 case kGLImplementationDesktopGLCoreProfile: { | |
| 325 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size)); | 322 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceGLX(size)); |
| 326 if (!surface->Initialize()) | 323 if (!surface->Initialize()) |
| 327 return NULL; | 324 return NULL; |
| 328 | 325 |
| 329 return surface; | 326 return surface; |
| 330 } | 327 } |
| 331 case kGLImplementationEGLGLES2: { | 328 case kGLImplementationEGLGLES2: { |
| 332 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); | 329 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceEGL(size)); |
| 333 if (!surface->Initialize()) | 330 if (!surface->Initialize()) |
| 334 return NULL; | 331 return NULL; |
| 335 | 332 |
| 336 return surface; | 333 return surface; |
| 337 } | 334 } |
| 338 case kGLImplementationMockGL: | 335 case kGLImplementationMockGL: |
| 339 return new GLSurfaceStub; | 336 return new GLSurfaceStub; |
| 340 default: | 337 default: |
| 341 NOTREACHED(); | 338 NOTREACHED(); |
| 342 return NULL; | 339 return NULL; |
| 343 } | 340 } |
| 344 } | 341 } |
| 345 | 342 |
| 346 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 343 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 347 return gfx::GetXDisplay(); | 344 return gfx::GetXDisplay(); |
| 348 } | 345 } |
| 349 | 346 |
| 350 } // namespace gfx | 347 } // namespace gfx |
| OLD | NEW |