blob: 5492dc18c2e9e0580a0a624556b4bd8e7b6f049a [file] [log] [blame]
[email protected]c9e2cbbb2012-05-12 21:17:271// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]2f47fc452011-11-21 03:12:172// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]c9e2cbbb2012-05-12 21:17:275#ifndef UI_GL_GL_CONTEXT_NSVIEW_H_
6#define UI_GL_GL_CONTEXT_NSVIEW_H_
[email protected]2f47fc452011-11-21 03:12:177
8#import <AppKit/NSOpenGL.h>
9
10#include "base/compiler_specific.h"
[email protected]a8522032013-06-24 22:51:4611#include "base/mac/scoped_nsobject.h"
[email protected]c9e2cbbb2012-05-12 21:17:2712#include "ui/gl/gl_context.h"
[email protected]2f47fc452011-11-21 03:12:1713
14namespace gfx {
15
16class GLSurface;
17
18// GLContextNSView encapsulates an NSView-based GLContext. This is paired with
19// the GLSurfaceNSView class.
[email protected]1e9c0c82013-06-06 14:59:2420class GLContextNSView : public GLContextReal {
[email protected]2f47fc452011-11-21 03:12:1721 public:
22 explicit GLContextNSView(GLShareGroup* group);
[email protected]2f47fc452011-11-21 03:12:1723
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]988e5eb2013-11-06 06:01:4738 virtual ~GLContextNSView();
39
[email protected]a8522032013-06-24 22:51:4640 base::scoped_nsobject<NSOpenGLContext> context_;
[email protected]2f47fc452011-11-21 03:12:1741 GpuPreference gpu_preference_;
42
43 DISALLOW_COPY_AND_ASSIGN(GLContextNSView);
44};
45
46} // namespace gfx
47
[email protected]c9e2cbbb2012-05-12 21:17:2748#endif // UI_GL_GL_CONTEXT_NSVIEW_H_