michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim: set ts=8 sts=4 et sw=4 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef GLCONTEXTWGL_H_ michael@0: #define GLCONTEXTWGL_H_ michael@0: michael@0: #include "GLContext.h" michael@0: #include "WGLLibrary.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gl { michael@0: michael@0: class GLContextWGL : public GLContext michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL) michael@0: // From Window: (possibly for offscreen!) michael@0: GLContextWGL(const SurfaceCaps& caps, michael@0: GLContext* sharedContext, michael@0: bool isOffscreen, michael@0: HDC aDC, michael@0: HGLRC aContext, michael@0: HWND aWindow = nullptr); michael@0: michael@0: // From PBuffer michael@0: GLContextWGL(const SurfaceCaps& caps, michael@0: GLContext* sharedContext, michael@0: bool isOffscreen, michael@0: HANDLE aPbuffer, michael@0: HDC aDC, michael@0: HGLRC aContext, michael@0: int aPixelFormat); michael@0: michael@0: ~GLContextWGL(); michael@0: michael@0: virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::WGL; } michael@0: michael@0: static GLContextWGL* Cast(GLContext* gl) { michael@0: MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL); michael@0: return static_cast(gl); michael@0: } michael@0: michael@0: bool Init() MOZ_OVERRIDE; michael@0: michael@0: virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; michael@0: michael@0: virtual bool IsCurrent() MOZ_OVERRIDE; michael@0: michael@0: void SetIsDoubleBuffered(bool aIsDB); michael@0: michael@0: virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; michael@0: michael@0: virtual bool SupportsRobustness() const MOZ_OVERRIDE; michael@0: michael@0: virtual bool SwapBuffers() MOZ_OVERRIDE; michael@0: michael@0: virtual bool SetupLookupFunction() MOZ_OVERRIDE; michael@0: michael@0: HGLRC Context() { return mContext; } michael@0: michael@0: protected: michael@0: friend class GLContextProviderWGL; michael@0: michael@0: HDC mDC; michael@0: HGLRC mContext; michael@0: HWND mWnd; michael@0: HANDLE mPBuffer; michael@0: int mPixelFormat; michael@0: bool mIsDoubleBuffered; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif // GLCONTEXTWGL_H_