2014-01-08 00:02:18 +04:00
|
|
|
/* -*- 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef GLCONTEXTWGL_H_
|
|
|
|
#define GLCONTEXTWGL_H_
|
|
|
|
|
|
|
|
#include "GLContext.h"
|
|
|
|
#include "WGLLibrary.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
|
|
|
|
class GLContextWGL : public GLContext
|
|
|
|
{
|
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL, override)
|
2014-01-08 00:02:18 +04:00
|
|
|
// From Window: (possibly for offscreen!)
|
|
|
|
GLContextWGL(const SurfaceCaps& caps,
|
|
|
|
GLContext* sharedContext,
|
|
|
|
bool isOffscreen,
|
|
|
|
HDC aDC,
|
|
|
|
HGLRC aContext,
|
|
|
|
HWND aWindow = nullptr);
|
|
|
|
|
|
|
|
// From PBuffer
|
|
|
|
GLContextWGL(const SurfaceCaps& caps,
|
|
|
|
GLContext* sharedContext,
|
|
|
|
bool isOffscreen,
|
|
|
|
HANDLE aPbuffer,
|
|
|
|
HDC aDC,
|
|
|
|
HGLRC aContext,
|
2014-01-10 22:55:23 +04:00
|
|
|
int aPixelFormat);
|
2014-01-08 00:02:18 +04:00
|
|
|
|
|
|
|
~GLContextWGL();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLContextType GetContextType() const override { return GLContextType::WGL; }
|
2014-01-08 00:02:18 +04:00
|
|
|
|
|
|
|
static GLContextWGL* Cast(GLContext* gl) {
|
2014-01-10 22:55:24 +04:00
|
|
|
MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
|
2014-01-08 00:02:18 +04:00
|
|
|
return static_cast<GLContextWGL*>(gl);
|
|
|
|
}
|
2014-01-08 00:02:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
bool Init() override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool MakeCurrentImpl(bool aForce) override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsCurrent() override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
|
|
|
void SetIsDoubleBuffered(bool aIsDB);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsDoubleBuffered() const override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool SupportsRobustness() const override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool SwapBuffers() override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool SetupLookupFunction() override;
|
2014-01-08 00:02:18 +04:00
|
|
|
|
|
|
|
HGLRC Context() { return mContext; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
friend class GLContextProviderWGL;
|
|
|
|
|
|
|
|
HDC mDC;
|
|
|
|
HGLRC mContext;
|
|
|
|
HWND mWnd;
|
|
|
|
HANDLE mPBuffer;
|
|
|
|
int mPixelFormat;
|
|
|
|
bool mIsDoubleBuffered;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // GLCONTEXTWGL_H_
|