1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/gl/GLContextGLX.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,81 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim: set ts=8 sts=4 et sw=4 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef GLCONTEXTGLX_H_ 1.11 +#define GLCONTEXTGLX_H_ 1.12 + 1.13 +#include "GLContext.h" 1.14 +#include "GLXLibrary.h" 1.15 + 1.16 +namespace mozilla { 1.17 +namespace gl { 1.18 + 1.19 +class GLContextGLX : public GLContext 1.20 +{ 1.21 +public: 1.22 + MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextGLX) 1.23 + static already_AddRefed<GLContextGLX> 1.24 + CreateGLContext(const SurfaceCaps& caps, 1.25 + GLContextGLX* shareContext, 1.26 + bool isOffscreen, 1.27 + Display* display, 1.28 + GLXDrawable drawable, 1.29 + GLXFBConfig cfg, 1.30 + bool deleteDrawable, 1.31 + gfxXlibSurface* pixmap = nullptr); 1.32 + 1.33 + ~GLContextGLX(); 1.34 + 1.35 + virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::GLX; } 1.36 + 1.37 + static GLContextGLX* Cast(GLContext* gl) { 1.38 + MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX); 1.39 + return static_cast<GLContextGLX*>(gl); 1.40 + } 1.41 + 1.42 + bool Init() MOZ_OVERRIDE; 1.43 + 1.44 + virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; 1.45 + 1.46 + virtual bool IsCurrent() MOZ_OVERRIDE; 1.47 + 1.48 + virtual bool SetupLookupFunction() MOZ_OVERRIDE; 1.49 + 1.50 + virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; 1.51 + 1.52 + virtual bool SupportsRobustness() const MOZ_OVERRIDE; 1.53 + 1.54 + virtual bool SwapBuffers() MOZ_OVERRIDE; 1.55 + 1.56 +private: 1.57 + friend class GLContextProviderGLX; 1.58 + 1.59 + GLContextGLX(const SurfaceCaps& caps, 1.60 + GLContext* shareContext, 1.61 + bool isOffscreen, 1.62 + Display *aDisplay, 1.63 + GLXDrawable aDrawable, 1.64 + GLXContext aContext, 1.65 + bool aDeleteDrawable, 1.66 + bool aDoubleBuffered, 1.67 + gfxXlibSurface *aPixmap); 1.68 + 1.69 + GLXContext mContext; 1.70 + Display *mDisplay; 1.71 + GLXDrawable mDrawable; 1.72 + bool mDeleteDrawable; 1.73 + bool mDoubleBuffered; 1.74 + 1.75 + GLXLibrary* mGLX; 1.76 + 1.77 + nsRefPtr<gfxXlibSurface> mPixmap; 1.78 + bool mOwnsContext; 1.79 +}; 1.80 + 1.81 +} 1.82 +} 1.83 + 1.84 +#endif // GLCONTEXTGLX_H_