OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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_GFX_GL_GL_CONTEXT_NSVIEW_H_ |
| 6 #define UI_GFX_GL_GL_CONTEXT_NSVIEW_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <OpenGL/CGLTypes.h> |
| 10 |
| 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_nsobject.h" |
| 13 #include "ui/gfx/gl/gl_context.h" |
| 14 |
| 15 #if defined(__OBJC__) |
| 16 @class NSOpenGLContext; |
| 17 @class NSOpenGLPixelFormat; |
| 18 #else |
| 19 class NSOpenGLContext; |
| 20 class NSOpenGLPixelFormat; |
| 21 #endif |
| 22 |
| 23 namespace gfx { |
| 24 |
| 25 class GLSurface; |
| 26 |
| 27 // GLContextNSView encapsulates an NSView-based GLContext. This is paired with |
| 28 // the GLSurfaceNSView class. |
| 29 class GLContextNSView : public GLContext { |
| 30 public: |
| 31 explicit GLContextNSView(GLShareGroup* group); |
| 32 virtual ~GLContextNSView(); |
| 33 |
| 34 // GLContext: |
| 35 virtual bool Initialize(GLSurface* surface, |
| 36 GpuPreference gpu_preference) OVERRIDE; |
| 37 virtual void Destroy() OVERRIDE; |
| 38 virtual bool MakeCurrent(GLSurface* surface) OVERRIDE; |
| 39 virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE; |
| 40 virtual bool IsCurrent(GLSurface* surface) OVERRIDE; |
| 41 virtual void* GetHandle() OVERRIDE; |
| 42 virtual void SetSwapInterval(int interval) OVERRIDE; |
| 43 |
| 44 private: |
| 45 scoped_nsobject<NSOpenGLContext> context_; |
| 46 GpuPreference gpu_preference_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(GLContextNSView); |
| 49 }; |
| 50 |
| 51 } // namespace gfx |
| 52 |
| 53 #endif // UI_GFX_GL_GL_CONTEXT_NSVIEW_H_ |
OLD | NEW |