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

Side by Side Diff: ui/gl/gl_share_group.cc

Issue 2347383002: X11: Use better visuals for OpenGL (Closed)
Patch Set: Fix various tests Created 4 years, 3 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
OLDNEW
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_share_group.h" 5 #include "ui/gl/gl_share_group.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_implementation.h"
11
12 #if defined(USE_X11)
13 #include "gl_share_group_glx.h"
14 #endif
10 15
11 namespace gl { 16 namespace gl {
12 17
13 GLShareGroup::GLShareGroup() 18 GLShareGroup::GLShareGroup()
14 : shared_context_(NULL) 19 : shared_context_(NULL)
15 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
16 , renderer_id_(-1) 21 , renderer_id_(-1)
17 #endif 22 #endif
18 { 23 {
19 } 24 }
(...skipping 20 matching lines...) Expand all
40 for (ContextSet::iterator it = contexts_.begin(); 45 for (ContextSet::iterator it = contexts_.begin();
41 it != contexts_.end(); 46 it != contexts_.end();
42 ++it) { 47 ++it) {
43 if ((*it)->GetHandle()) 48 if ((*it)->GetHandle())
44 return *it; 49 return *it;
45 } 50 }
46 51
47 return NULL; 52 return NULL;
48 } 53 }
49 54
50 void GLShareGroup::SetSharedContext(GLContext* context) { 55 void GLShareGroup::SetSharedContext(GLSurface* compatible, GLContext* context) {
51 DCHECK(contexts_.find(context) != contexts_.end()); 56 DCHECK(contexts_.find(context) != contexts_.end());
52 shared_context_ = context; 57 shared_context_ = context;
53 } 58 }
54 59
55 GLContext* GLShareGroup::GetSharedContext() { 60 GLContext* GLShareGroup::GetSharedContext(GLSurface* compatible) {
56 return shared_context_; 61 return shared_context_;
57 } 62 }
58 63
59 #if defined(OS_MACOSX) 64 #if defined(OS_MACOSX)
60 void GLShareGroup::SetRendererID(int renderer_id) { 65 void GLShareGroup::SetRendererID(int renderer_id) {
61 renderer_id_ = renderer_id; 66 renderer_id_ = renderer_id;
62 } 67 }
63 68
64 int GLShareGroup::GetRendererID() { 69 int GLShareGroup::GetRendererID() {
65 return renderer_id_; 70 return renderer_id_;
66 } 71 }
67 #endif 72 #endif
68 73
69 GLShareGroup::~GLShareGroup() { 74 GLShareGroup::~GLShareGroup() {
70 } 75 }
71 76
77 GLShareGroup* CreateGLShareGroup() {
78 #if defined(USE_X11)
79 if (GetGLImplementation() == kGLImplementationDesktopGL)
80 return new GLShareGroupGLX();
81 #endif
82 return new GLShareGroup();
83 }
84
72 } // namespace gl 85 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698