2014-01-07 20:02:18 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set ts=8 sts=4 et sw=4 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef GLCONTEXTWGL_H_
|
|
|
|
#define GLCONTEXTWGL_H_
|
|
|
|
|
|
|
|
#include "GLContext.h"
|
|
|
|
#include "WGLLibrary.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gl {
|
|
|
|
|
|
|
|
class GLContextWGL : public GLContext
|
|
|
|
{
|
|
|
|
public:
|
2014-03-09 18:40:49 +00:00
|
|
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(GLContextWGL)
|
2014-01-07 20:02:18 +00:00
|
|
|
// From Window: (possibly for offscreen!)
|
|
|
|
GLContextWGL(const SurfaceCaps& caps,
|
|
|
|
GLContext* sharedContext,
|
|
|
|
bool isOffscreen,
|
|
|
|
HDC aDC,
|
|
|
|
HGLRC aContext,
|
|
|
|
HWND aWindow = nullptr);
|
|
|
|
|
|
|
|
// From PBuffer
|
|
|
|
GLContextWGL(const SurfaceCaps& caps,
|
|
|
|
GLContext* sharedContext,
|
|
|
|
bool isOffscreen,
|
|
|
|
HANDLE aPbuffer,
|
|
|
|
HDC aDC,
|
|
|
|
HGLRC aContext,
|
2014-01-10 18:55:23 +00:00
|
|
|
int aPixelFormat);
|
2014-01-07 20:02:18 +00:00
|
|
|
|
|
|
|
~GLContextWGL();
|
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual GLContextType GetContextType() const MOZ_OVERRIDE { return GLContextType::WGL; }
|
2014-01-07 20:02:18 +00:00
|
|
|
|
|
|
|
static GLContextWGL* Cast(GLContext* gl) {
|
2014-01-10 18:55:24 +00:00
|
|
|
MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
|
2014-01-07 20:02:18 +00:00
|
|
|
return static_cast<GLContextWGL*>(gl);
|
|
|
|
}
|
2014-01-07 20:02:18 +00:00
|
|
|
|
2014-04-15 14:57:26 +00:00
|
|
|
bool Init() MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual bool MakeCurrentImpl(bool aForce) MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual bool IsCurrent() MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
|
|
|
void SetIsDoubleBuffered(bool aIsDB);
|
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual bool IsDoubleBuffered() const MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual bool SupportsRobustness() const MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual bool SwapBuffers() MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
2014-03-04 02:47:43 +00:00
|
|
|
virtual bool SetupLookupFunction() MOZ_OVERRIDE;
|
2014-01-07 20:02:18 +00:00
|
|
|
|
|
|
|
HGLRC Context() { return mContext; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
friend class GLContextProviderWGL;
|
|
|
|
|
|
|
|
HDC mDC;
|
|
|
|
HGLRC mContext;
|
|
|
|
HWND mWnd;
|
|
|
|
HANDLE mPBuffer;
|
|
|
|
int mPixelFormat;
|
|
|
|
bool mIsDoubleBuffered;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // GLCONTEXTWGL_H_
|