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

Side by Side Diff: ui/gfx/gl/gl_context_win.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 "ui/gfx/gl/gl_context.h" 5 #include "ui/gfx/gl/gl_context.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_context_egl.h" 11 #include "ui/gfx/gl/gl_context_egl.h"
12 #include "ui/gfx/gl/gl_context_osmesa.h" 12 #include "ui/gfx/gl/gl_context_osmesa.h"
13 #include "ui/gfx/gl/gl_context_stub.h" 13 #include "ui/gfx/gl/gl_context_stub.h"
14 #include "ui/gfx/gl/gl_context_wgl.h" 14 #include "ui/gfx/gl/gl_context_wgl.h"
15 #include "ui/gfx/gl/gl_implementation.h" 15 #include "ui/gfx/gl/gl_implementation.h"
16 #include "ui/gfx/gl/gl_surface_egl.h" 16 #include "ui/gfx/gl/gl_surface_egl.h"
17 #include "ui/gfx/gl/gl_surface_osmesa.h" 17 #include "ui/gfx/gl/gl_surface_osmesa.h"
18 #include "ui/gfx/gl/gl_surface_stub.h" 18 #include "ui/gfx/gl/gl_surface_stub.h"
19 #include "ui/gfx/gl/gl_surface_wgl.h" 19 #include "ui/gfx/gl/gl_surface_wgl.h"
20 20
21 namespace gfx { 21 namespace gfx {
22 22
23 GLContext* GLContext::CreateGLContext(GLSurface* compatible_surface, 23 GLContext* GLContext::CreateGLContext(GLContext* shared_context) {
24 GLContext* shared_context) {
25 scoped_ptr<GLSurface> surface(compatible_surface);
26
27 switch (GetGLImplementation()) { 24 switch (GetGLImplementation()) {
28 case kGLImplementationOSMesaGL: { 25 case kGLImplementationOSMesaGL: {
29 scoped_ptr<GLContextOSMesa> context( 26 scoped_ptr<GLContextOSMesa> context(new GLContextOSMesa);
30 new GLContextOSMesa(static_cast<GLSurfaceOSMesa*>(
31 surface.release())));
32 if (!context->Initialize(OSMESA_RGBA, shared_context)) 27 if (!context->Initialize(OSMESA_RGBA, shared_context))
33 return NULL; 28 return NULL;
34 29
35 return context.release(); 30 return context.release();
36 } 31 }
37 case kGLImplementationEGLGLES2: { 32 case kGLImplementationEGLGLES2: {
38 scoped_ptr<GLContextEGL> context( 33 scoped_ptr<GLContextEGL> context(new GLContextEGL);
39 new GLContextEGL(static_cast<GLSurfaceEGL*>(
40 surface.release())));
41 if (!context->Initialize(shared_context)) 34 if (!context->Initialize(shared_context))
42 return NULL; 35 return NULL;
43 36
44 return context.release(); 37 return context.release();
45 } 38 }
46 case kGLImplementationDesktopGL: { 39 case kGLImplementationDesktopGL: {
47 scoped_ptr<GLContextWGL> context( 40 scoped_ptr<GLContextWGL> context(new GLContextWGL);
48 new GLContextWGL(static_cast<GLSurfaceWGL*>(
49 surface.release())));
50 if (!context->Initialize(shared_context)) 41 if (!context->Initialize(shared_context))
51 return NULL; 42 return NULL;
52 43
53 return context.release(); 44 return context.release();
54 } 45 }
55 case kGLImplementationMockGL: 46 case kGLImplementationMockGL:
56 return new GLContextStub; 47 return new GLContextStub;
57 default: 48 default:
58 NOTREACHED(); 49 NOTREACHED();
59 return NULL; 50 return NULL;
60 } 51 }
61 } 52 }
62 53
63 } // namespace gfx 54 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698