OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_GL_CGL_UTIL_H_ |
| 6 #define UI_GL_CGL_UTIL_H_ |
| 7 |
| 8 #include <OpenGL/OpenGL.h> |
| 9 |
| 10 #include "base/mac/scoped_typeref.h" |
| 11 #include "ui/gl/gl_export.h" |
| 12 |
| 13 namespace gfx { |
| 14 |
| 15 typedef base::ScopedTypeRef< |
| 16 CGLContextObj, |
| 17 CGLContextObj, |
| 18 CGLRetainContext, |
| 19 CGLReleaseContext> |
| 20 ScopedCGLContextObjRef; |
| 21 |
| 22 typedef base::ScopedTypeRef< |
| 23 CGLPixelFormatObj, |
| 24 CGLPixelFormatObj, |
| 25 CGLRetainPixelFormat, |
| 26 CGLReleasePixelFormat> |
| 27 ScopedCGLPixelFormatObjRef; |
| 28 |
| 29 class GL_EXPORT ScopedCGLSetCurrentContext { |
| 30 public: |
| 31 ScopedCGLSetCurrentContext(CGLContextObj context); |
| 32 ~ScopedCGLSetCurrentContext(); |
| 33 private: |
| 34 // Note that if a context is destroyed when it is current, then the current |
| 35 // context is changed to NULL. Take out a reference on |previous_context_| to |
| 36 // preserve this behavior (when this falls out of scope, |previous_context_| |
| 37 // will be made current, then released, so NULL will be current if that |
| 38 // release destroys the context). |
| 39 ScopedCGLContextObjRef previous_context_; |
| 40 }; |
| 41 |
| 42 } // namespace gfx |
| 43 |
| 44 #endif // UI_GL_CGL_UTIL_H_ |
OLD | NEW |