Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: ui/gfx/gl/gl_context_mac.cc

Issue 7021014: GLContext no longer holds a pointer to a GLSurface. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" 8 #include "third_party/mesa/MesaLib/include/GL/osmesa.h"
9 #include "ui/gfx/gl/gl_bindings.h" 9 #include "ui/gfx/gl/gl_bindings.h"
10 #include "ui/gfx/gl/gl_context_cgl.h" 10 #include "ui/gfx/gl/gl_context_cgl.h"
11 #include "ui/gfx/gl/gl_context_osmesa.h" 11 #include "ui/gfx/gl/gl_context_osmesa.h"
12 #include "ui/gfx/gl/gl_context_stub.h" 12 #include "ui/gfx/gl/gl_context_stub.h"
13 #include "ui/gfx/gl/gl_implementation.h" 13 #include "ui/gfx/gl/gl_implementation.h"
14 #include "ui/gfx/gl/gl_surface_cgl.h" 14 #include "ui/gfx/gl/gl_surface_cgl.h"
15 #include "ui/gfx/gl/gl_surface_osmesa.h" 15 #include "ui/gfx/gl/gl_surface_osmesa.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 18
19 GLContext* GLContext::CreateGLContext(GLSurface* compatible_surface, 19 GLContext* GLContext::CreateGLContext(GLContext* shared_context,
20 GLContext* shared_context) { 20 GLSurface* compatible_surface) {
21 scoped_ptr<GLSurface> surface(compatible_surface);
22
23 switch (GetGLImplementation()) { 21 switch (GetGLImplementation()) {
24 case kGLImplementationDesktopGL: { 22 case kGLImplementationDesktopGL: {
25 scoped_ptr<GLContextCGL> context( 23 scoped_ptr<GLContextCGL> context(new GLContextCGL);
26 new GLContextCGL( 24 if (!context->Initialize(shared_context, compatible_surface))
27 static_cast<GLSurfaceCGL*>(surface.release())));
28 if (!context->Initialize(shared_context))
29 return NULL; 25 return NULL;
30 26
31 return context.release(); 27 return context.release();
32 } 28 }
33 case kGLImplementationOSMesaGL: { 29 case kGLImplementationOSMesaGL: {
34 scoped_ptr<GLContextOSMesa> context( 30 scoped_ptr<GLContextOSMesa> context(new GLContextOSMesa);
35 new GLContextOSMesa( 31 if (!context->Initialize(shared_context, compatible_surface))
36 static_cast<GLSurfaceOSMesa*>(surface.release())));
37 if (!context->Initialize(OSMESA_RGBA, shared_context))
38 return NULL; 32 return NULL;
39 33
40 return context.release(); 34 return context.release();
41 } 35 }
42 case kGLImplementationMockGL: 36 case kGLImplementationMockGL:
43 return new GLContextStub; 37 return new GLContextStub;
44 default: 38 default:
45 NOTREACHED(); 39 NOTREACHED();
46 return NULL; 40 return NULL;
47 } 41 }
48 } 42 }
49 43
50 } // namespace gfx 44 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698