2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2018-11-30 18:39:55 +03:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-01-08 00:02:18 +04:00
|
|
|
/* 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 {
|
|
|
|
|
2018-01-03 05:30:15 +03:00
|
|
|
class GLContextWGL final : public GLContext {
|
2014-01-08 00:02:18 +04:00
|
|
|
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!)
|
2020-06-15 21:25:55 +03:00
|
|
|
GLContextWGL(const GLContextDesc&, HDC aDC, HGLRC aContext,
|
2014-01-08 00:02:18 +04:00
|
|
|
HWND aWindow = nullptr);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-01-08 00:02:18 +04:00
|
|
|
// From PBuffer
|
2020-06-15 21:25:55 +03:00
|
|
|
GLContextWGL(const GLContextDesc&, HANDLE aPbuffer, HDC aDC, HGLRC aContext,
|
2014-01-10 22:55:23 +04:00
|
|
|
int aPixelFormat);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-01-08 00:02:18 +04:00
|
|
|
~GLContextWGL();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual GLContextType GetContextType() const override {
|
|
|
|
return GLContextType::WGL;
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-08-15 23:21:37 +03:00
|
|
|
virtual bool MakeCurrentImpl() const override;
|
2017-08-11 23:54:40 +03:00
|
|
|
virtual bool IsCurrentImpl() const override;
|
2018-01-03 05:30:15 +03:00
|
|
|
virtual bool IsDoubleBuffered() const override { return mIsDoubleBuffered; }
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool SwapBuffers() override;
|
2017-01-31 05:58:52 +03:00
|
|
|
virtual void GetWSIInfo(nsCString* const out) const override;
|
2019-02-23 00:17:28 +03:00
|
|
|
|
|
|
|
Maybe<SymbolLoader> GetSymbolLoader() const override {
|
|
|
|
return Some(sWGLLib.GetSymbolLoader());
|
|
|
|
}
|
|
|
|
|
2014-01-08 00:02:18 +04:00
|
|
|
HGLRC Context() { return mContext; }
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-01-08 00:02:18 +04:00
|
|
|
protected:
|
|
|
|
friend class GLContextProviderWGL;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2014-01-08 00:02:18 +04:00
|
|
|
HDC mDC;
|
|
|
|
HGLRC mContext;
|
|
|
|
HWND mWnd;
|
|
|
|
HANDLE mPBuffer;
|
|
|
|
int mPixelFormat;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-01-03 05:30:15 +03:00
|
|
|
public:
|
2018-08-18 01:21:26 +03:00
|
|
|
bool mIsDoubleBuffered = false;
|
2014-01-08 00:02:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gl
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // GLCONTEXTWGL_H_
|