| 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" |
| 11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
| 12 #include "ui/gl/gl_implementation.h" | 12 #include "ui/gl/gl_implementation.h" |
| 13 #include "ui/gl/gl_surface_cgl.h" | 13 #include "ui/gl/gl_surface_cgl.h" |
| 14 #include "ui/gl/gl_surface_osmesa.h" | 14 #include "ui/gl/gl_surface_osmesa.h" |
| 15 #include "ui/gl/gl_surface_stub.h" | 15 #include "ui/gl/gl_surface_stub.h" |
| 16 #include "ui/gl/gl_surface_nsview.h" | |
| 17 | 16 |
| 18 namespace gfx { | 17 namespace gfx { |
| 19 | 18 |
| 20 bool GLSurface::InitializeOneOffInternal() { | 19 bool GLSurface::InitializeOneOffInternal() { |
| 21 switch (GetGLImplementation()) { | 20 switch (GetGLImplementation()) { |
| 22 case kGLImplementationDesktopGL: | 21 case kGLImplementationDesktopGL: |
| 23 case kGLImplementationAppleGL: | 22 case kGLImplementationAppleGL: |
| 24 if (!GLSurfaceCGL::InitializeOneOff()) { | 23 if (!GLSurfaceCGL::InitializeOneOff()) { |
| 25 LOG(ERROR) << "GLSurfaceCGL::InitializeOneOff failed."; | 24 LOG(ERROR) << "GLSurfaceCGL::InitializeOneOff failed."; |
| 26 return false; | 25 return false; |
| 27 } | 26 } |
| 28 break; | 27 break; |
| 29 default: | 28 default: |
| 30 break; | 29 break; |
| 31 } | 30 } |
| 32 return true; | 31 return true; |
| 33 } | 32 } |
| 34 | 33 |
| 35 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 34 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
| 36 gfx::AcceleratedWidget window) { | 35 gfx::AcceleratedWidget window) { |
| 37 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); | 36 TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); |
| 38 switch (GetGLImplementation()) { | 37 switch (GetGLImplementation()) { |
| 39 case kGLImplementationDesktopGL: | 38 case kGLImplementationDesktopGL: |
| 40 case kGLImplementationAppleGL: { | 39 case kGLImplementationAppleGL: { |
| 41 scoped_refptr<GLSurface> surface(new GLSurfaceNSView(window)); | 40 NOTIMPLEMENTED() << "No onscreen support on Mac."; |
| 42 if (!surface->Initialize()) | 41 return NULL; |
| 43 return NULL; | |
| 44 | |
| 45 return surface; | |
| 46 } | 42 } |
| 47 case kGLImplementationMockGL: | 43 case kGLImplementationMockGL: |
| 48 return new GLSurfaceStub; | 44 return new GLSurfaceStub; |
| 49 default: | 45 default: |
| 50 NOTREACHED(); | 46 NOTREACHED(); |
| 51 return NULL; | 47 return NULL; |
| 52 } | 48 } |
| 53 } | 49 } |
| 54 | 50 |
| 55 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 51 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 74 } | 70 } |
| 75 case kGLImplementationMockGL: | 71 case kGLImplementationMockGL: |
| 76 return new GLSurfaceStub; | 72 return new GLSurfaceStub; |
| 77 default: | 73 default: |
| 78 NOTREACHED(); | 74 NOTREACHED(); |
| 79 return NULL; | 75 return NULL; |
| 80 } | 76 } |
| 81 } | 77 } |
| 82 | 78 |
| 83 } // namespace gfx | 79 } // namespace gfx |
| OLD | NEW |