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 GLCONTEXTGLX_H_ michael@0: #define GLCONTEXTGLX_H_ michael@0: michael@0: #include "GLContext.h" michael@0: #include "GLXLibrary.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gl { michael@0: michael@0: class GLContextGLX : public GLContext michael@0: { michael@0: public: michael@0: MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextGLX) michael@0: static already_AddRefed michael@0: CreateGLContext(const SurfaceCaps& caps, michael@0: GLContextGLX* shareContext, michael@0: bool isOffscreen, michael@0: Display* display, michael@0: GLXDrawable drawable, michael@0: GLXFBConfig cfg, michael@0: bool deleteDrawable, michael@0: gfxXlibSurface* pixmap = nullptr); michael@0: michael@0: ~GLContextGLX(); michael@0: michael@0: virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::GLX; } michael@0: michael@0: static GLContextGLX* Cast(GLContext* gl) { michael@0: MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX); 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: virtual bool SetupLookupFunction() MOZ_OVERRIDE; 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: private: michael@0: friend class GLContextProviderGLX; michael@0: michael@0: GLContextGLX(const SurfaceCaps& caps, michael@0: GLContext* shareContext, michael@0: bool isOffscreen, michael@0: Display *aDisplay, michael@0: GLXDrawable aDrawable, michael@0: GLXContext aContext, michael@0: bool aDeleteDrawable, michael@0: bool aDoubleBuffered, michael@0: gfxXlibSurface *aPixmap); michael@0: michael@0: GLXContext mContext; michael@0: Display *mDisplay; michael@0: GLXDrawable mDrawable; michael@0: bool mDeleteDrawable; michael@0: bool mDoubleBuffered; michael@0: michael@0: GLXLibrary* mGLX; michael@0: michael@0: nsRefPtr mPixmap; michael@0: bool mOwnsContext; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif // GLCONTEXTGLX_H_