GLContextWGL.h (1649B)
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/. */ 6 7 #ifndef GLCONTEXTWGL_H_ 8 #define GLCONTEXTWGL_H_ 9 10 #include "GLContext.h" 11 #include "WGLLibrary.h" 12 13 namespace mozilla { 14 namespace gl { 15 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); 22 23 // From PBuffer 24 GLContextWGL(const GLContextDesc&, HANDLE aPbuffer, HDC aDC, HGLRC aContext, 25 int aPixelFormat); 26 27 ~GLContextWGL(); 28 29 virtual GLContextType GetContextType() const override { 30 return GLContextType::WGL; 31 } 32 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; 38 39 Maybe<SymbolLoader> GetSymbolLoader() const override { 40 return Some(sWGLLib.GetSymbolLoader()); 41 } 42 43 HGLRC Context() { return mContext; } 44 45 protected: 46 friend class GLContextProviderWGL; 47 48 HDC mDC; 49 HGLRC mContext; 50 HWND mWnd; 51 HANDLE mPBuffer; 52 int mPixelFormat; 53 54 public: 55 bool mIsDoubleBuffered = false; 56 }; 57 58 } // namespace gl 59 } // namespace mozilla 60 61 #endif // GLCONTEXTWGL_H_