| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "third_party/mesa/src/include/GL/osmesa.h" | 10 #include "third_party/mesa/src/include/GL/osmesa.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 return false; | 29 return false; |
| 30 } | 30 } |
| 31 break; | 31 break; |
| 32 default: | 32 default: |
| 33 break; | 33 break; |
| 34 } | 34 } |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 38 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
| 39 bool software, | |
| 40 gfx::AcceleratedWidget window) { | 39 gfx::AcceleratedWidget window) { |
| 41 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); | 40 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); |
| 42 #if defined(USE_AURA) | 41 #if defined(USE_AURA) |
| 43 if (software) | |
| 44 return NULL; | |
| 45 | |
| 46 switch (GetGLImplementation()) { | 42 switch (GetGLImplementation()) { |
| 47 case kGLImplementationDesktopGL: | 43 case kGLImplementationDesktopGL: |
| 48 case kGLImplementationAppleGL: { | 44 case kGLImplementationAppleGL: { |
| 49 scoped_refptr<GLSurface> surface(new GLSurfaceNSView(window)); | 45 scoped_refptr<GLSurface> surface(new GLSurfaceNSView(window)); |
| 50 if (!surface->Initialize()) | 46 if (!surface->Initialize()) |
| 51 return NULL; | 47 return NULL; |
| 52 | 48 |
| 53 return surface; | 49 return surface; |
| 54 } | 50 } |
| 55 case kGLImplementationMockGL: | 51 case kGLImplementationMockGL: |
| 56 return new GLSurfaceStub; | 52 return new GLSurfaceStub; |
| 57 default: | 53 default: |
| 58 NOTREACHED(); | 54 NOTREACHED(); |
| 59 return NULL; | 55 return NULL; |
| 60 } | 56 } |
| 61 #else | 57 #else |
| 62 return CreateOffscreenGLSurface(software, gfx::Size(1,1)); | 58 return CreateOffscreenGLSurface(gfx::Size(1, 1)); |
| 63 #endif | 59 #endif |
| 64 } | 60 } |
| 65 | 61 |
| 66 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 62 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
| 67 bool software, | |
| 68 const gfx::Size& size) { | 63 const gfx::Size& size) { |
| 69 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); | 64 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); |
| 70 if (software) | |
| 71 return NULL; | |
| 72 | |
| 73 switch (GetGLImplementation()) { | 65 switch (GetGLImplementation()) { |
| 74 case kGLImplementationOSMesaGL: { | 66 case kGLImplementationOSMesaGL: { |
| 75 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, | 67 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, |
| 76 size)); | 68 size)); |
| 77 if (!surface->Initialize()) | 69 if (!surface->Initialize()) |
| 78 return NULL; | 70 return NULL; |
| 79 | 71 |
| 80 return surface; | 72 return surface; |
| 81 } | 73 } |
| 82 case kGLImplementationDesktopGL: | 74 case kGLImplementationDesktopGL: |
| 83 case kGLImplementationAppleGL: { | 75 case kGLImplementationAppleGL: { |
| 84 scoped_refptr<GLSurface> surface(new NoOpGLSurfaceCGL(size)); | 76 scoped_refptr<GLSurface> surface(new NoOpGLSurfaceCGL(size)); |
| 85 if (!surface->Initialize()) | 77 if (!surface->Initialize()) |
| 86 return NULL; | 78 return NULL; |
| 87 | 79 |
| 88 return surface; | 80 return surface; |
| 89 } | 81 } |
| 90 case kGLImplementationMockGL: | 82 case kGLImplementationMockGL: |
| 91 return new GLSurfaceStub; | 83 return new GLSurfaceStub; |
| 92 default: | 84 default: |
| 93 NOTREACHED(); | 85 NOTREACHED(); |
| 94 return NULL; | 86 return NULL; |
| 95 } | 87 } |
| 96 } | 88 } |
| 97 | 89 |
| 98 } // namespace gfx | 90 } // namespace gfx |
| OLD | NEW |