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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 SetCurrent(NULL, NULL); | 208 SetCurrent(NULL, NULL); |
209 CGLSetCurrentContext(NULL); | 209 CGLSetCurrentContext(NULL); |
210 } | 210 } |
211 | 211 |
212 bool GLContextCGL::IsCurrent(GLSurface* surface) { | 212 bool GLContextCGL::IsCurrent(GLSurface* surface) { |
213 bool native_context_is_current = CGLGetCurrentContext() == context_; | 213 bool native_context_is_current = CGLGetCurrentContext() == context_; |
214 | 214 |
215 // If our context is current then our notion of which GLContext is | 215 // If our context is current then our notion of which GLContext is |
216 // current must be correct. On the other hand, third-party code | 216 // current must be correct. On the other hand, third-party code |
217 // using OpenGL might change the current context. | 217 // using OpenGL might change the current context. |
218 DCHECK(!native_context_is_current || (GetCurrent() == this)); | 218 DCHECK(!native_context_is_current || (GetRealCurrent() == this)); |
219 | 219 |
220 if (!native_context_is_current) | 220 if (!native_context_is_current) |
221 return false; | 221 return false; |
222 | 222 |
223 return true; | 223 return true; |
224 } | 224 } |
225 | 225 |
226 void* GLContextCGL::GetHandle() { | 226 void* GLContextCGL::GetHandle() { |
227 return context_; | 227 return context_; |
228 } | 228 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 GLContextCGL::~GLContextCGL() { | 294 GLContextCGL::~GLContextCGL() { |
295 Destroy(); | 295 Destroy(); |
296 } | 296 } |
297 | 297 |
298 GpuPreference GLContextCGL::GetGpuPreference() { | 298 GpuPreference GLContextCGL::GetGpuPreference() { |
299 return gpu_preference_; | 299 return gpu_preference_; |
300 } | 300 } |
301 | 301 |
302 } // namespace gfx | 302 } // namespace gfx |
OLD | NEW |