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

Side by Side 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: & cleanup 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 unified diff | Download patch
OLDNEW
(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 base {
14
15 template<>
16 struct ScopedTypeRefTraits<CGLContextObj> {
17 static void Retain(CGLContextObj object) {
18 CGLRetainContext(object);
19 }
20 static void Release(CGLContextObj object) {
21 CGLReleaseContext(object);
22 }
23 };
24
25 template<>
26 struct ScopedTypeRefTraits<CGLPixelFormatObj> {
27 static void Retain(CGLPixelFormatObj object) {
28 CGLRetainPixelFormat(object);
29 }
30 static void Release(CGLPixelFormatObj object) {
31 CGLReleasePixelFormat(object);
32 }
33 };
34
35 } // namespace base
36
37 namespace gfx {
38
39 class GL_EXPORT ScopedCGLSetCurrentContext {
40 public:
41 ScopedCGLSetCurrentContext(CGLContextObj context);
Mark Mentovai 2014/02/07 19:53:41 explicit?
ccameron 2014/02/07 20:58:04 Done.
42 ~ScopedCGLSetCurrentContext();
43 private:
44 // Note that if a context is destroyed when it is current, then the current
45 // context is changed to NULL. Take out a reference on |previous_context_| to
46 // preserve this behavior (when this falls out of scope, |previous_context_|
47 // will be made current, then released, so NULL will be current if that
48 // release destroys the context).
49 base::ScopedTypeRef<CGLContextObj> previous_context_;
Mark Mentovai 2014/02/07 19:53:41 DISALLOW_COPY_AND_ASSIGN?
ccameron 2014/02/07 20:58:04 Done.
50 };
51
52 } // namespace gfx
53
54 #endif // UI_GL_CGL_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698