|
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/. */ |
|
6 |
|
7 #ifndef GLCONTEXTGLX_H_ |
|
8 #define GLCONTEXTGLX_H_ |
|
9 |
|
10 #include "GLContext.h" |
|
11 #include "GLXLibrary.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace gl { |
|
15 |
|
16 class GLContextGLX : public GLContext |
|
17 { |
|
18 public: |
|
19 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextGLX) |
|
20 static already_AddRefed<GLContextGLX> |
|
21 CreateGLContext(const SurfaceCaps& caps, |
|
22 GLContextGLX* shareContext, |
|
23 bool isOffscreen, |
|
24 Display* display, |
|
25 GLXDrawable drawable, |
|
26 GLXFBConfig cfg, |
|
27 bool deleteDrawable, |
|
28 gfxXlibSurface* pixmap = nullptr); |
|
29 |
|
30 ~GLContextGLX(); |
|
31 |
|
32 virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::GLX; } |
|
33 |
|
34 static GLContextGLX* Cast(GLContext* gl) { |
|
35 MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX); |
|
36 return static_cast<GLContextGLX*>(gl); |
|
37 } |
|
38 |
|
39 bool Init() MOZ_OVERRIDE; |
|
40 |
|
41 virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; |
|
42 |
|
43 virtual bool IsCurrent() MOZ_OVERRIDE; |
|
44 |
|
45 virtual bool SetupLookupFunction() MOZ_OVERRIDE; |
|
46 |
|
47 virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; |
|
48 |
|
49 virtual bool SupportsRobustness() const MOZ_OVERRIDE; |
|
50 |
|
51 virtual bool SwapBuffers() MOZ_OVERRIDE; |
|
52 |
|
53 private: |
|
54 friend class GLContextProviderGLX; |
|
55 |
|
56 GLContextGLX(const SurfaceCaps& caps, |
|
57 GLContext* shareContext, |
|
58 bool isOffscreen, |
|
59 Display *aDisplay, |
|
60 GLXDrawable aDrawable, |
|
61 GLXContext aContext, |
|
62 bool aDeleteDrawable, |
|
63 bool aDoubleBuffered, |
|
64 gfxXlibSurface *aPixmap); |
|
65 |
|
66 GLXContext mContext; |
|
67 Display *mDisplay; |
|
68 GLXDrawable mDrawable; |
|
69 bool mDeleteDrawable; |
|
70 bool mDoubleBuffered; |
|
71 |
|
72 GLXLibrary* mGLX; |
|
73 |
|
74 nsRefPtr<gfxXlibSurface> mPixmap; |
|
75 bool mOwnsContext; |
|
76 }; |
|
77 |
|
78 } |
|
79 } |
|
80 |
|
81 #endif // GLCONTEXTGLX_H_ |