gfx/gl/GLContextCGL.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/gl/GLContextCGL.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* vim: set ts=8 sts=4 et sw=4 tw=80: */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef GLCONTEXTCGL_H_
    1.11 +#define GLCONTEXTCGL_H_
    1.12 +
    1.13 +#include "GLContext.h"
    1.14 +
    1.15 +#include "OpenGL/OpenGL.h"
    1.16 +
    1.17 +#ifdef __OBJC__
    1.18 +#include <AppKit/NSOpenGL.h>
    1.19 +#else
    1.20 +typedef void NSOpenGLContext;
    1.21 +#endif
    1.22 +
    1.23 +namespace mozilla {
    1.24 +namespace gl {
    1.25 +
    1.26 +class GLContextCGL : public GLContext
    1.27 +{
    1.28 +    friend class GLContextProviderCGL;
    1.29 +
    1.30 +    NSOpenGLContext *mContext;
    1.31 +
    1.32 +public:
    1.33 +    MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextCGL)
    1.34 +    GLContextCGL(const SurfaceCaps& caps,
    1.35 +                 GLContext *shareContext,
    1.36 +                 NSOpenGLContext *context,
    1.37 +                 bool isOffscreen = false);
    1.38 +
    1.39 +    ~GLContextCGL();
    1.40 +
    1.41 +    virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::CGL; }
    1.42 +
    1.43 +    static GLContextCGL* Cast(GLContext* gl) {
    1.44 +        MOZ_ASSERT(gl->GetContextType() == GLContextType::CGL);
    1.45 +        return static_cast<GLContextCGL*>(gl);
    1.46 +    }
    1.47 +
    1.48 +    bool Init() MOZ_OVERRIDE;
    1.49 +
    1.50 +    NSOpenGLContext* GetNSOpenGLContext() const { return mContext; }
    1.51 +    CGLContextObj GetCGLContext() const;
    1.52 +
    1.53 +    virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
    1.54 +
    1.55 +    virtual bool IsCurrent() MOZ_OVERRIDE;
    1.56 +
    1.57 +    virtual GLenum GetPreferredARGB32Format() const MOZ_OVERRIDE;
    1.58 +
    1.59 +    virtual bool SetupLookupFunction() MOZ_OVERRIDE;
    1.60 +
    1.61 +    virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
    1.62 +
    1.63 +    virtual bool SupportsRobustness() const MOZ_OVERRIDE;
    1.64 +
    1.65 +    virtual bool SwapBuffers() MOZ_OVERRIDE;
    1.66 +};
    1.67 +
    1.68 +}
    1.69 +}
    1.70 +
    1.71 +#endif // GLCONTEXTCGL_H_

mercurial