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