Bug 1857841 - pt 3. Add a new page kind named "fresh" r=glandium
[gecko.git] / gfx / gl / GLContextWGL.h
blob9a86031d46764bd75f3c1007ec2bfcd922492100
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef GLCONTEXTWGL_H_
8 #define GLCONTEXTWGL_H_
10 #include "GLContext.h"
11 #include "WGLLibrary.h"
13 namespace mozilla {
14 namespace gl {
16 class GLContextWGL final : public GLContext {
17 public:
18 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL, override)
19 // From Window: (possibly for offscreen!)
20 GLContextWGL(const GLContextDesc&, HDC aDC, HGLRC aContext,
21 HWND aWindow = nullptr);
23 // From PBuffer
24 GLContextWGL(const GLContextDesc&, HANDLE aPbuffer, HDC aDC, HGLRC aContext,
25 int aPixelFormat);
27 ~GLContextWGL();
29 virtual GLContextType GetContextType() const override {
30 return GLContextType::WGL;
33 virtual bool MakeCurrentImpl() const override;
34 virtual bool IsCurrentImpl() const override;
35 virtual bool IsDoubleBuffered() const override { return mIsDoubleBuffered; }
36 virtual bool SwapBuffers() override;
37 virtual void GetWSIInfo(nsCString* const out) const override;
39 Maybe<SymbolLoader> GetSymbolLoader() const override {
40 return Some(sWGLLib.GetSymbolLoader());
43 HGLRC Context() { return mContext; }
45 protected:
46 friend class GLContextProviderWGL;
48 HDC mDC;
49 HGLRC mContext;
50 HWND mWnd;
51 HANDLE mPBuffer;
52 int mPixelFormat;
54 public:
55 bool mIsDoubleBuffered = false;
58 } // namespace gl
59 } // namespace mozilla
61 #endif // GLCONTEXTWGL_H_