OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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_GL_CONTEXT_NSVIEW_H_ | |
6 #define UI_GL_GL_CONTEXT_NSVIEW_H_ | |
7 | |
8 #import <AppKit/NSOpenGL.h> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/mac/scoped_nsobject.h" | |
12 #include "ui/gl/gl_context.h" | |
13 | |
14 namespace gfx { | |
15 | |
16 class GLSurface; | |
17 | |
18 // GLContextNSView encapsulates an NSView-based GLContext. This is paired with | |
19 // the GLSurfaceNSView class. | |
20 class GLContextNSView : public GLContextReal { | |
21 public: | |
22 explicit GLContextNSView(GLShareGroup* group); | |
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: | |
38 virtual ~GLContextNSView(); | |
39 | |
40 base::scoped_nsobject<NSOpenGLContext> context_; | |
41 GpuPreference gpu_preference_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(GLContextNSView); | |
44 }; | |
45 | |
46 } // namespace gfx | |
47 | |
48 #endif // UI_GL_GL_CONTEXT_NSVIEW_H_ | |
OLD | NEW |