gfx/gl/GLContextCGL.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* vim: set ts=8 sts=4 et sw=4 tw=80: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef GLCONTEXTCGL_H_
michael@0 8 #define GLCONTEXTCGL_H_
michael@0 9
michael@0 10 #include "GLContext.h"
michael@0 11
michael@0 12 #include "OpenGL/OpenGL.h"
michael@0 13
michael@0 14 #ifdef __OBJC__
michael@0 15 #include <AppKit/NSOpenGL.h>
michael@0 16 #else
michael@0 17 typedef void NSOpenGLContext;
michael@0 18 #endif
michael@0 19
michael@0 20 namespace mozilla {
michael@0 21 namespace gl {
michael@0 22
michael@0 23 class GLContextCGL : public GLContext
michael@0 24 {
michael@0 25 friend class GLContextProviderCGL;
michael@0 26
michael@0 27 NSOpenGLContext *mContext;
michael@0 28
michael@0 29 public:
michael@0 30 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextCGL)
michael@0 31 GLContextCGL(const SurfaceCaps& caps,
michael@0 32 GLContext *shareContext,
michael@0 33 NSOpenGLContext *context,
michael@0 34 bool isOffscreen = false);
michael@0 35
michael@0 36 ~GLContextCGL();
michael@0 37
michael@0 38 virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::CGL; }
michael@0 39
michael@0 40 static GLContextCGL* Cast(GLContext* gl) {
michael@0 41 MOZ_ASSERT(gl->GetContextType() == GLContextType::CGL);
michael@0 42 return static_cast<GLContextCGL*>(gl);
michael@0 43 }
michael@0 44
michael@0 45 bool Init() MOZ_OVERRIDE;
michael@0 46
michael@0 47 NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
michael@0 48 CGLContextObj GetCGLContext() const;
michael@0 49
michael@0 50 virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
michael@0 51
michael@0 52 virtual bool IsCurrent() MOZ_OVERRIDE;
michael@0 53
michael@0 54 virtual GLenum GetPreferredARGB32Format() const MOZ_OVERRIDE;
michael@0 55
michael@0 56 virtual bool SetupLookupFunction() MOZ_OVERRIDE;
michael@0 57
michael@0 58 virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
michael@0 59
michael@0 60 virtual bool SupportsRobustness() const MOZ_OVERRIDE;
michael@0 61
michael@0 62 virtual bool SwapBuffers() MOZ_OVERRIDE;
michael@0 63 };
michael@0 64
michael@0 65 }
michael@0 66 }
michael@0 67
michael@0 68 #endif // GLCONTEXTCGL_H_

mercurial