Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Unified Diff: ui/gl/cgl_util.h

Issue 157063002: Add helpers for CGL types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..20d05f30b83e07b4cdeaebb340114f2705484206
--- /dev/null
+++ b/ui/gl/cgl_util.h
@@ -0,0 +1,44 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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,
+ CGLContextObj,
+ CGLRetainContext,
+ CGLReleaseContext>
+ ScopedCGLContextObjRef;
+
+typedef base::ScopedTypeRef<
+ CGLPixelFormatObj,
+ 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_
« base/mac/scoped_typeref.h ('K') | « base/mac/scoped_typeref.h ('k') | ui/gl/cgl_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698