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_context_cgl.h" | 5 #include "ui/gl/gl_context_cgl.h" |
6 | 6 |
7 #include <OpenGL/CGLRenderers.h> | 7 #include <OpenGL/CGLRenderers.h> |
8 #include <OpenGL/CGLTypes.h> | 8 #include <OpenGL/CGLTypes.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 SetCurrent(NULL, NULL); | 196 SetCurrent(NULL, NULL); |
197 CGLSetCurrentContext(NULL); | 197 CGLSetCurrentContext(NULL); |
198 } | 198 } |
199 | 199 |
200 bool GLContextCGL::IsCurrent(GLSurface* surface) { | 200 bool GLContextCGL::IsCurrent(GLSurface* surface) { |
201 bool native_context_is_current = CGLGetCurrentContext() == context_; | 201 bool native_context_is_current = CGLGetCurrentContext() == context_; |
202 | 202 |
203 // If our context is current then our notion of which GLContext is | 203 // If our context is current then our notion of which GLContext is |
204 // current must be correct. On the other hand, third-party code | 204 // current must be correct. On the other hand, third-party code |
205 // using OpenGL might change the current context. | 205 // using OpenGL might change the current context. |
206 DCHECK(!native_context_is_current || (GetCurrent() == this)); | 206 DCHECK(!native_context_is_current || (GetRealCurrent() == this)); |
207 | 207 |
208 if (!native_context_is_current) | 208 if (!native_context_is_current) |
209 return false; | 209 return false; |
210 | 210 |
211 return true; | 211 return true; |
212 } | 212 } |
213 | 213 |
214 void* GLContextCGL::GetHandle() { | 214 void* GLContextCGL::GetHandle() { |
215 return context_; | 215 return context_; |
216 } | 216 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 GpuPreference GLContextCGL::GetGpuPreference() { | 285 GpuPreference GLContextCGL::GetGpuPreference() { |
286 return gpu_preference_; | 286 return gpu_preference_; |
287 } | 287 } |
288 | 288 |
289 void ScopedCGLDestroyRendererInfo::operator()(CGLRendererInfoObj x) const { | 289 void ScopedCGLDestroyRendererInfo::operator()(CGLRendererInfoObj x) const { |
290 CGLDestroyRendererInfo(x); | 290 CGLDestroyRendererInfo(x); |
291 } | 291 } |
292 | 292 |
293 } // namespace gfx | 293 } // namespace gfx |
OLD | NEW |