|
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 GLCONTEXTWGL_H_ |
|
8 #define GLCONTEXTWGL_H_ |
|
9 |
|
10 #include "GLContext.h" |
|
11 #include "WGLLibrary.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace gl { |
|
15 |
|
16 class GLContextWGL : public GLContext |
|
17 { |
|
18 public: |
|
19 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL) |
|
20 // From Window: (possibly for offscreen!) |
|
21 GLContextWGL(const SurfaceCaps& caps, |
|
22 GLContext* sharedContext, |
|
23 bool isOffscreen, |
|
24 HDC aDC, |
|
25 HGLRC aContext, |
|
26 HWND aWindow = nullptr); |
|
27 |
|
28 // From PBuffer |
|
29 GLContextWGL(const SurfaceCaps& caps, |
|
30 GLContext* sharedContext, |
|
31 bool isOffscreen, |
|
32 HANDLE aPbuffer, |
|
33 HDC aDC, |
|
34 HGLRC aContext, |
|
35 int aPixelFormat); |
|
36 |
|
37 ~GLContextWGL(); |
|
38 |
|
39 virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::WGL; } |
|
40 |
|
41 static GLContextWGL* Cast(GLContext* gl) { |
|
42 MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL); |
|
43 return static_cast<GLContextWGL*>(gl); |
|
44 } |
|
45 |
|
46 bool Init() MOZ_OVERRIDE; |
|
47 |
|
48 virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE; |
|
49 |
|
50 virtual bool IsCurrent() MOZ_OVERRIDE; |
|
51 |
|
52 void SetIsDoubleBuffered(bool aIsDB); |
|
53 |
|
54 virtual bool IsDoubleBuffered() const MOZ_OVERRIDE; |
|
55 |
|
56 virtual bool SupportsRobustness() const MOZ_OVERRIDE; |
|
57 |
|
58 virtual bool SwapBuffers() MOZ_OVERRIDE; |
|
59 |
|
60 virtual bool SetupLookupFunction() MOZ_OVERRIDE; |
|
61 |
|
62 HGLRC Context() { return mContext; } |
|
63 |
|
64 protected: |
|
65 friend class GLContextProviderWGL; |
|
66 |
|
67 HDC mDC; |
|
68 HGLRC mContext; |
|
69 HWND mWnd; |
|
70 HANDLE mPBuffer; |
|
71 int mPixelFormat; |
|
72 bool mIsDoubleBuffered; |
|
73 }; |
|
74 |
|
75 } |
|
76 } |
|
77 |
|
78 #endif // GLCONTEXTWGL_H_ |