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 <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/mac/mac_util.h" | 12 #include "base/mac/mac_util.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "third_party/mesa/src/include/GL/osmesa.h" | |
15 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
16 #include "ui/gl/gl_context.h" | 15 #include "ui/gl/gl_context.h" |
17 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
18 #include "ui/gl/gl_surface_osmesa.h" | 17 #include "ui/gl/gl_surface_osmesa.h" |
19 #include "ui/gl/gl_surface_stub.h" | 18 #include "ui/gl/gl_surface_stub.h" |
20 #include "ui/gl/gpu_switching_manager.h" | 19 #include "ui/gl/gpu_switching_manager.h" |
21 | 20 |
22 namespace gfx { | 21 namespace gfx { |
23 namespace { | 22 namespace { |
24 | 23 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 NOTREACHED(); | 122 NOTREACHED(); |
124 return NULL; | 123 return NULL; |
125 } | 124 } |
126 } | 125 } |
127 | 126 |
128 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 127 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
129 const gfx::Size& size) { | 128 const gfx::Size& size) { |
130 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); | 129 TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface"); |
131 switch (GetGLImplementation()) { | 130 switch (GetGLImplementation()) { |
132 case kGLImplementationOSMesaGL: { | 131 case kGLImplementationOSMesaGL: { |
133 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(OSMESA_RGBA, | 132 scoped_refptr<GLSurface> surface( |
134 size)); | 133 new GLSurfaceOSMesa(OSMesaSurfaceFormatRGBA, size)); |
135 if (!surface->Initialize()) | 134 if (!surface->Initialize()) |
136 return NULL; | 135 return NULL; |
137 | 136 |
138 return surface; | 137 return surface; |
139 } | 138 } |
140 case kGLImplementationDesktopGL: | 139 case kGLImplementationDesktopGL: |
141 case kGLImplementationAppleGL: { | 140 case kGLImplementationAppleGL: { |
142 scoped_refptr<GLSurface> surface(new NoOpGLSurface(size)); | 141 scoped_refptr<GLSurface> surface(new NoOpGLSurface(size)); |
143 if (!surface->Initialize()) | 142 if (!surface->Initialize()) |
144 return NULL; | 143 return NULL; |
145 | 144 |
146 return surface; | 145 return surface; |
147 } | 146 } |
148 case kGLImplementationMockGL: | 147 case kGLImplementationMockGL: |
149 return new GLSurfaceStub; | 148 return new GLSurfaceStub; |
150 default: | 149 default: |
151 NOTREACHED(); | 150 NOTREACHED(); |
152 return NULL; | 151 return NULL; |
153 } | 152 } |
154 } | 153 } |
155 | 154 |
156 } // namespace gfx | 155 } // namespace gfx |
OLD | NEW |