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 extern "C" { | 5 extern "C" { |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 } | 7 } |
8 | 8 |
9 #include "ui/gl/gl_context_glx.h" | 9 #include "ui/gl/gl_context_glx.h" |
10 | 10 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 LOG(ERROR) << "glXMakeCurrent failed in ReleaseCurrent"; | 150 LOG(ERROR) << "glXMakeCurrent failed in ReleaseCurrent"; |
151 } | 151 } |
152 | 152 |
153 bool GLContextGLX::IsCurrent(GLSurface* surface) { | 153 bool GLContextGLX::IsCurrent(GLSurface* surface) { |
154 bool native_context_is_current = | 154 bool native_context_is_current = |
155 glXGetCurrentContext() == static_cast<GLXContext>(context_); | 155 glXGetCurrentContext() == static_cast<GLXContext>(context_); |
156 | 156 |
157 // If our context is current then our notion of which GLContext is | 157 // If our context is current then our notion of which GLContext is |
158 // current must be correct. On the other hand, third-party code | 158 // current must be correct. On the other hand, third-party code |
159 // using OpenGL might change the current context. | 159 // using OpenGL might change the current context. |
160 DCHECK(!native_context_is_current || (GetCurrent() == this)); | 160 DCHECK(!native_context_is_current || (GetRealCurrent() == this)); |
161 | 161 |
162 if (!native_context_is_current) | 162 if (!native_context_is_current) |
163 return false; | 163 return false; |
164 | 164 |
165 if (surface) { | 165 if (surface) { |
166 if (glXGetCurrentDrawable() != | 166 if (glXGetCurrentDrawable() != |
167 reinterpret_cast<GLXDrawable>(surface->GetHandle())) { | 167 reinterpret_cast<GLXDrawable>(surface->GetHandle())) { |
168 return false; | 168 return false; |
169 } | 169 } |
170 } | 170 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { | 220 bool GLContextGLX::WasAllocatedUsingRobustnessExtension() { |
221 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); | 221 return GLSurfaceGLX::IsCreateContextRobustnessSupported(); |
222 } | 222 } |
223 | 223 |
224 GLContextGLX::~GLContextGLX() { | 224 GLContextGLX::~GLContextGLX() { |
225 Destroy(); | 225 Destroy(); |
226 } | 226 } |
227 | 227 |
228 } // namespace gfx | 228 } // namespace gfx |
OLD | NEW |