gfx/gl/GLContextWGL.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/gl/GLContextWGL.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,78 @@
     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 GLCONTEXTWGL_H_
    1.11 +#define GLCONTEXTWGL_H_
    1.12 +
    1.13 +#include "GLContext.h"
    1.14 +#include "WGLLibrary.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace gl {
    1.18 +
    1.19 +class GLContextWGL : public GLContext
    1.20 +{
    1.21 +public:
    1.22 +    MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL)
    1.23 +    // From Window: (possibly for offscreen!)
    1.24 +    GLContextWGL(const SurfaceCaps& caps,
    1.25 +                 GLContext* sharedContext,
    1.26 +                 bool isOffscreen,
    1.27 +                 HDC aDC,
    1.28 +                 HGLRC aContext,
    1.29 +                 HWND aWindow = nullptr);
    1.30 +
    1.31 +    // From PBuffer
    1.32 +    GLContextWGL(const SurfaceCaps& caps,
    1.33 +                 GLContext* sharedContext,
    1.34 +                 bool isOffscreen,
    1.35 +                 HANDLE aPbuffer,
    1.36 +                 HDC aDC,
    1.37 +                 HGLRC aContext,
    1.38 +                 int aPixelFormat);
    1.39 +
    1.40 +    ~GLContextWGL();
    1.41 +
    1.42 +    virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::WGL; }
    1.43 +
    1.44 +    static GLContextWGL* Cast(GLContext* gl) {
    1.45 +        MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
    1.46 +        return static_cast<GLContextWGL*>(gl);
    1.47 +    }
    1.48 +
    1.49 +    bool Init() MOZ_OVERRIDE;
    1.50 +
    1.51 +    virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
    1.52 +
    1.53 +    virtual bool IsCurrent() MOZ_OVERRIDE;
    1.54 +
    1.55 +    void SetIsDoubleBuffered(bool aIsDB);
    1.56 +
    1.57 +    virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
    1.58 +
    1.59 +    virtual bool SupportsRobustness() const MOZ_OVERRIDE;
    1.60 +
    1.61 +    virtual bool SwapBuffers() MOZ_OVERRIDE;
    1.62 +
    1.63 +    virtual bool SetupLookupFunction() MOZ_OVERRIDE;
    1.64 +
    1.65 +    HGLRC Context() { return mContext; }
    1.66 +
    1.67 +protected:
    1.68 +    friend class GLContextProviderWGL;
    1.69 +
    1.70 +    HDC mDC;
    1.71 +    HGLRC mContext;
    1.72 +    HWND mWnd;
    1.73 +    HANDLE mPBuffer;
    1.74 +    int mPixelFormat;
    1.75 +    bool mIsDoubleBuffered;
    1.76 +};
    1.77 +
    1.78 +}
    1.79 +}
    1.80 +
    1.81 +#endif // GLCONTEXTWGL_H_

mercurial