OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/gl/gl_surface.h" | 5 #include "ui/gfx/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 "third_party/mesa/MesaLib/include/GL/osmesa.h" | 9 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" |
10 #include "ui/gfx/gl/gl_bindings.h" | 10 #include "ui/gfx/gl/gl_bindings.h" |
11 #include "ui/gfx/gl/gl_implementation.h" | 11 #include "ui/gfx/gl/gl_implementation.h" |
12 #include "ui/gfx/gl/gl_surface_cgl.h" | 12 #include "ui/gfx/gl/gl_surface_cgl.h" |
13 #include "ui/gfx/gl/gl_surface_osmesa.h" | 13 #include "ui/gfx/gl/gl_surface_osmesa.h" |
14 #include "ui/gfx/gl/gl_surface_stub.h" | 14 #include "ui/gfx/gl/gl_surface_stub.h" |
15 | 15 |
16 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
17 #include "ui/gfx/gl/gl_surface_nsview.h" | 17 #include "ui/gfx/gl/gl_surface_nsview.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 | 21 |
22 bool GLSurface::InitializeOneOffInternal() { | 22 bool GLSurface::InitializeOneOffInternal() { |
23 switch (GetGLImplementation()) { | 23 switch (GetGLImplementation()) { |
24 case kGLImplementationDesktopGL: | 24 case kGLImplementationDesktopGL: |
| 25 case kGLImplementationAppleGL: |
25 if (!GLSurfaceCGL::InitializeOneOff()) { | 26 if (!GLSurfaceCGL::InitializeOneOff()) { |
26 LOG(ERROR) << "GLSurfaceCGL::InitializeOneOff failed."; | 27 LOG(ERROR) << "GLSurfaceCGL::InitializeOneOff failed."; |
27 return false; | 28 return false; |
28 } | 29 } |
29 break; | 30 break; |
30 default: | 31 default: |
31 break; | 32 break; |
32 } | 33 } |
33 return true; | 34 return true; |
34 } | 35 } |
35 | 36 |
36 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( | 37 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
37 bool software, | 38 bool software, |
38 gfx::PluginWindowHandle window) { | 39 gfx::PluginWindowHandle window) { |
39 #if defined(USE_AURA) | 40 #if defined(USE_AURA) |
40 if (software) | 41 if (software) |
41 return NULL; | 42 return NULL; |
42 | 43 |
43 switch (GetGLImplementation()) { | 44 switch (GetGLImplementation()) { |
44 case kGLImplementationDesktopGL: { | 45 case kGLImplementationDesktopGL: |
| 46 case kGLImplementationAppleGL: { |
45 scoped_refptr<GLSurface> surface(new GLSurfaceNSView(window)); | 47 scoped_refptr<GLSurface> surface(new GLSurfaceNSView(window)); |
46 if (!surface->Initialize()) | 48 if (!surface->Initialize()) |
47 return NULL; | 49 return NULL; |
48 | 50 |
49 return surface; | 51 return surface; |
50 } | 52 } |
51 case kGLImplementationMockGL: | 53 case kGLImplementationMockGL: |
52 return new GLSurfaceStub; | 54 return new GLSurfaceStub; |
53 default: | 55 default: |
54 NOTREACHED(); | 56 NOTREACHED(); |
(...skipping 12 matching lines...) Expand all Loading... |
67 | 69 |
68 switch (GetGLImplementation()) { | 70 switch (GetGLImplementation()) { |
69 case kGLImplementationOSMesaGL: { | 71 case kGLImplementationOSMesaGL: { |
70 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, | 72 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, |
71 size)); | 73 size)); |
72 if (!surface->Initialize()) | 74 if (!surface->Initialize()) |
73 return NULL; | 75 return NULL; |
74 | 76 |
75 return surface; | 77 return surface; |
76 } | 78 } |
77 case kGLImplementationDesktopGL: { | 79 case kGLImplementationDesktopGL: |
| 80 case kGLImplementationAppleGL: { |
78 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceCGL(size)); | 81 scoped_refptr<GLSurface> surface(new PbufferGLSurfaceCGL(size)); |
79 if (!surface->Initialize()) | 82 if (!surface->Initialize()) |
80 return NULL; | 83 return NULL; |
81 | 84 |
82 return surface; | 85 return surface; |
83 } | 86 } |
84 case kGLImplementationMockGL: | 87 case kGLImplementationMockGL: |
85 return new GLSurfaceStub; | 88 return new GLSurfaceStub; |
86 default: | 89 default: |
87 NOTREACHED(); | 90 NOTREACHED(); |
88 return NULL; | 91 return NULL; |
89 } | 92 } |
90 } | 93 } |
91 | 94 |
92 } // namespace gfx | 95 } // namespace gfx |
OLD | NEW |