Bug 1032573 part 4 - Add AnimationTimeline::ToTimelineTime helper method; r=dbaron
[gecko.git] / gfx / gl / GLContextCGL.h
blobef78e11870077c0a5b0f61247d3fc20ec10b67f2
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef GLCONTEXTCGL_H_
8 #define GLCONTEXTCGL_H_
10 #include "GLContext.h"
12 #include "OpenGL/OpenGL.h"
14 #ifdef __OBJC__
15 #include <AppKit/NSOpenGL.h>
16 #else
17 typedef void NSOpenGLContext;
18 #endif
20 namespace mozilla {
21 namespace gl {
23 class GLContextCGL : public GLContext
25 friend class GLContextProviderCGL;
27 NSOpenGLContext *mContext;
29 public:
30 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextCGL)
31 GLContextCGL(const SurfaceCaps& caps,
32 GLContext *shareContext,
33 NSOpenGLContext *context,
34 bool isOffscreen = false);
36 ~GLContextCGL();
38 virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::CGL; }
40 static GLContextCGL* Cast(GLContext* gl) {
41 MOZ_ASSERT(gl->GetContextType() == GLContextType::CGL);
42 return static_cast<GLContextCGL*>(gl);
45 bool Init() MOZ_OVERRIDE;
47 NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
48 CGLContextObj GetCGLContext() const;
50 virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
52 virtual bool IsCurrent() MOZ_OVERRIDE;
54 virtual GLenum GetPreferredARGB32Format() const MOZ_OVERRIDE;
56 virtual bool SetupLookupFunction() MOZ_OVERRIDE;
58 virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
60 virtual bool SupportsRobustness() const MOZ_OVERRIDE;
62 virtual bool SwapBuffers() MOZ_OVERRIDE;
68 #endif // GLCONTEXTCGL_H_