Index: ui/gl/cgl_util.h |
diff --git a/ui/gl/cgl_util.h b/ui/gl/cgl_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c9dfff94ec161f622698fa849fada27f6fcf6433 |
--- /dev/null |
+++ b/ui/gl/cgl_util.h |
@@ -0,0 +1,38 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
Avi (use Gerrit)
2014/02/07 01:45:29
no (c)
ccameron
2014/02/07 06:57:49
Done.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_GL_CGL_UTIL_H_ |
+#define UI_GL_CGL_UTIL_H_ |
+ |
+#include <OpenGL/OpenGL.h> |
+ |
+#include "base/mac/scoped_typeref.h" |
+#include "ui/gl/gl_export.h" |
+ |
+namespace gfx { |
+ |
+typedef base::ScopedTypeRef< |
+ CGLContextObj, CGLRetainContext, CGLReleaseContext> |
+ ScopedCGLContextObjRef; |
+ |
+typedef base::ScopedTypeRef< |
+ CGLPixelFormatObj, CGLRetainPixelFormat, CGLReleasePixelFormat> |
+ ScopedCGLPixelFormatObjRef; |
+ |
+class GL_EXPORT ScopedCGLSetCurrentContext { |
+ public: |
+ ScopedCGLSetCurrentContext(CGLContextObj context); |
+ ~ScopedCGLSetCurrentContext(); |
+ private: |
+ // Note that if a context is destroyed when it is current, then the current |
+ // context is changed to NULL. Take out a reference on |previous_context_| to |
+ // preserve this behavior (when this falls out of scope, |previous_context_| |
+ // will be made current, then released, so NULL will be current if that |
+ // release destroys the context). |
+ ScopedCGLContextObjRef previous_context_; |
+}; |
+ |
+} // namespace gfx |
+ |
+#endif // UI_GL_CGL_UTIL_H_ |