1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set ts=8 sts=4 et sw=4 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 GLCONTEXTGLX_H_
8 #define GLCONTEXTGLX_H_
10 #include "GLContext.h"
11 #include "GLXLibrary.h"
16 class GLContextGLX
: public GLContext
19 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextGLX
)
20 static already_AddRefed
<GLContextGLX
>
21 CreateGLContext(const SurfaceCaps
& caps
,
22 GLContextGLX
* shareContext
,
28 gfxXlibSurface
* pixmap
= nullptr);
32 virtual GLContextType
GetContextType() const MOZ_OVERRIDE
{ return GLContextType::GLX
; }
34 static GLContextGLX
* Cast(GLContext
* gl
) {
35 MOZ_ASSERT(gl
->GetContextType() == GLContextType::GLX
);
36 return static_cast<GLContextGLX
*>(gl
);
39 bool Init() MOZ_OVERRIDE
;
41 virtual bool MakeCurrentImpl(bool aForce
) MOZ_OVERRIDE
;
43 virtual bool IsCurrent() MOZ_OVERRIDE
;
45 virtual bool SetupLookupFunction() MOZ_OVERRIDE
;
47 virtual bool IsDoubleBuffered() const MOZ_OVERRIDE
;
49 virtual bool SupportsRobustness() const MOZ_OVERRIDE
;
51 virtual bool SwapBuffers() MOZ_OVERRIDE
;
54 friend class GLContextProviderGLX
;
56 GLContextGLX(const SurfaceCaps
& caps
,
57 GLContext
* shareContext
,
60 GLXDrawable aDrawable
,
64 gfxXlibSurface
*aPixmap
);
68 GLXDrawable mDrawable
;
74 nsRefPtr
<gfxXlibSurface
> mPixmap
;
81 #endif // GLCONTEXTGLX_H_