OLD | NEW |
---|---|
(Empty) | |
1 // 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.
| |
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, CGLRetainContext, CGLReleaseContext> | |
17 ScopedCGLContextObjRef; | |
18 | |
19 typedef base::ScopedTypeRef< | |
20 CGLPixelFormatObj, CGLRetainPixelFormat, CGLReleasePixelFormat> | |
21 ScopedCGLPixelFormatObjRef; | |
22 | |
23 class GL_EXPORT ScopedCGLSetCurrentContext { | |
24 public: | |
25 ScopedCGLSetCurrentContext(CGLContextObj context); | |
26 ~ScopedCGLSetCurrentContext(); | |
27 private: | |
28 // Note that if a context is destroyed when it is current, then the current | |
29 // context is changed to NULL. Take out a reference on |previous_context_| to | |
30 // preserve this behavior (when this falls out of scope, |previous_context_| | |
31 // will be made current, then released, so NULL will be current if that | |
32 // release destroys the context). | |
33 ScopedCGLContextObjRef previous_context_; | |
34 }; | |
35 | |
36 } // namespace gfx | |
37 | |
38 #endif // UI_GL_CGL_UTIL_H_ | |
OLD | NEW |