author Franziskus Kiefer <>
Fri, 01 Jun 2018 09:44:01 +0200
changeset 420853 4f9eec6361279d8657ffc4e6ef5c84e8f5d08c56
parent 397824 ba269efce3cedf4a733276b913135febb5be3228
child 432261 176dcc5da6fe5f0596a32015e710054b03da88ce
permissions -rw-r--r--
Bug 1460617 - land NSS 8232a58332dd UPGRADE_NSS_RELEASE, r=me

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */


#include "GLContext.h"
#include "WGLLibrary.h"

namespace mozilla {
namespace gl {

class GLContextWGL final : public GLContext
    // From Window: (possibly for offscreen!)
    GLContextWGL(CreateContextFlags flags,
                 const SurfaceCaps& caps,
                 bool isOffscreen,
                 HDC aDC,
                 HGLRC aContext,
                 HWND aWindow = nullptr);

    // From PBuffer
    GLContextWGL(CreateContextFlags flags,
                 const SurfaceCaps& caps,
                 bool isOffscreen,
                 HANDLE aPbuffer,
                 HDC aDC,
                 HGLRC aContext,
                 int aPixelFormat);


    virtual GLContextType GetContextType() const override { return GLContextType::WGL; }

    bool Init() override;
    virtual bool MakeCurrentImpl() const override;
    virtual bool IsCurrentImpl() const override;
    virtual bool IsDoubleBuffered() const override { return mIsDoubleBuffered; }
    virtual bool SwapBuffers() override;
    virtual bool SetupLookupFunction() override;
    virtual void GetWSIInfo(nsCString* const out) const override;
    HGLRC Context() { return mContext; }

    friend class GLContextProviderWGL;

    HDC mDC;
    HGLRC mContext;
    HWND mWnd;
    HANDLE mPBuffer;
    int mPixelFormat;
    bool mIsDoubleBuffered;