[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 2f47fc45 | 2011-11-21 03:12:17 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 5 | #ifndef UI_GL_GL_CONTEXT_NSVIEW_H_ |
6 | #define UI_GL_GL_CONTEXT_NSVIEW_H_ | ||||
[email protected] | 2f47fc45 | 2011-11-21 03:12:17 | [diff] [blame] | 7 | |
8 | #import <AppKit/NSOpenGL.h> | ||||
9 | |||||
10 | #include "base/compiler_specific.h" | ||||
[email protected] | a852203 | 2013-06-24 22:51:46 | [diff] [blame] | 11 | #include "base/mac/scoped_nsobject.h" |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 12 | #include "ui/gl/gl_context.h" |
[email protected] | 2f47fc45 | 2011-11-21 03:12:17 | [diff] [blame] | 13 | |
14 | namespace gfx { | ||||
15 | |||||
16 | class GLSurface; | ||||
17 | |||||
18 | // GLContextNSView encapsulates an NSView-based GLContext. This is paired with | ||||
19 | // the GLSurfaceNSView class. | ||||
[email protected] | 1e9c0c8 | 2013-06-06 14:59:24 | [diff] [blame] | 20 | class GLContextNSView : public GLContextReal { |
[email protected] | 2f47fc45 | 2011-11-21 03:12:17 | [diff] [blame] | 21 | public: |
22 | explicit GLContextNSView(GLShareGroup* group); | ||||
[email protected] | 2f47fc45 | 2011-11-21 03:12:17 | [diff] [blame] | 23 | |
24 | // GLContext: | ||||
25 | virtual bool Initialize(GLSurface* surface, | ||||
26 | GpuPreference gpu_preference) OVERRIDE; | ||||
27 | virtual void Destroy() OVERRIDE; | ||||
28 | virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; | ||||
29 | virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; | ||||
30 | virtual bool IsCurrent(GLSurface* surface) OVERRIDE; | ||||
31 | virtual void* GetHandle() OVERRIDE; | ||||
32 | virtual void SetSwapInterval(int interval) OVERRIDE; | ||||
33 | |||||
34 | // Flush the |context_|. Swaps buffers. | ||||
35 | void FlushBuffer(); | ||||
36 | |||||
37 | private: | ||||
[email protected] | 988e5eb | 2013-11-06 06:01:47 | [diff] [blame] | 38 | virtual ~GLContextNSView(); |
39 | |||||
[email protected] | a852203 | 2013-06-24 22:51:46 | [diff] [blame] | 40 | base::scoped_nsobject<NSOpenGLContext> context_; |
[email protected] | 2f47fc45 | 2011-11-21 03:12:17 | [diff] [blame] | 41 | GpuPreference gpu_preference_; |
42 | |||||
43 | DISALLOW_COPY_AND_ASSIGN(GLContextNSView); | ||||
44 | }; | ||||
45 | |||||
46 | } // namespace gfx | ||||
47 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame] | 48 | #endif // UI_GL_GL_CONTEXT_NSVIEW_H_ |