Bug 958369 - 5/5 - Make ContextType a typed enum - r=jgilbert

This commit is contained in:
Benoit Jacob 2014-01-10 13:55:24 -05:00
parent f2062e25d7
commit 4374a80063
10 changed files with 26 additions and 26 deletions

View File

@ -1290,7 +1290,7 @@ WebGLContext::MaybeRestoreContext()
if (mContextStatus != ContextNotLost || gl == nullptr)
return;
bool isEGL = gl->GetContextType() == gl::ContextTypeEGL,
bool isEGL = gl->GetContextType() == gl::GLContextType::EGL,
isANGLE = gl->IsANGLE();
GLContext::ContextResetARB resetStatus = GLContext::CONTEXT_NO_ERROR;

View File

@ -274,7 +274,7 @@ public:
}
virtual GLContextType GetContextType() {
return ContextTypeUnknown;
return GLContextType::Unknown;
}
virtual bool IsCurrent() = 0;

View File

@ -34,10 +34,10 @@ public:
~GLContextCGL();
virtual GLContextType GetContextType() MOZ_OVERRIDE { return ContextTypeCGL; }
virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::CGL; }
static GLContextCGL* Cast(GLContext* gl) {
MOZ_ASSERT(gl->GetContextType() == ContextTypeCGL);
MOZ_ASSERT(gl->GetContextType() == GLContextType::CGL);
return static_cast<GLContextCGL*>(gl);
}

View File

@ -38,10 +38,10 @@ public:
~GLContextEGL();
virtual GLContextType GetContextType() MOZ_OVERRIDE { return ContextTypeEGL; }
virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::EGL; }
static GLContextEGL* Cast(GLContext* gl) {
MOZ_ASSERT(gl->GetContextType() == ContextTypeEGL);
MOZ_ASSERT(gl->GetContextType() == GLContextType::EGL);
return static_cast<GLContextEGL*>(gl);
}

View File

@ -28,10 +28,10 @@ public:
~GLContextGLX();
virtual GLContextType GetContextType() MOZ_OVERRIDE { return ContextTypeGLX; }
virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::GLX; }
static GLContextGLX* Cast(GLContext* gl) {
MOZ_ASSERT(gl->GetContextType() == ContextTypeGLX);
MOZ_ASSERT(gl->GetContextType() == GLContextType::GLX);
return static_cast<GLContextGLX*>(gl);
}

View File

@ -27,13 +27,13 @@ MOZ_BEGIN_ENUM_CLASS(SharedTextureBufferType)
IOSurface
MOZ_END_ENUM_CLASS(SharedTextureBufferType)
enum GLContextType {
ContextTypeUnknown,
ContextTypeWGL,
ContextTypeCGL,
ContextTypeGLX,
ContextTypeEGL
};
MOZ_BEGIN_ENUM_CLASS(GLContextType)
Unknown,
WGL,
CGL,
GLX,
EGL
MOZ_END_ENUM_CLASS(GLContextType)
struct GLFormats
{

View File

@ -35,10 +35,10 @@ public:
~GLContextWGL();
virtual GLContextType GetContextType() MOZ_OVERRIDE { return ContextTypeWGL; }
virtual GLContextType GetContextType() MOZ_OVERRIDE { return GLContextType::WGL; }
static GLContextWGL* Cast(GLContext* gl) {
MOZ_ASSERT(gl->GetContextType() == ContextTypeWGL);
MOZ_ASSERT(gl->GetContextType() == GLContextType::WGL);
return static_cast<GLContextWGL*>(gl);
}

View File

@ -153,7 +153,7 @@ SharedTextureHandle CreateSharedHandle(GLContext* gl,
SharedTextureBufferType bufferType)
{
// unimplemented outside of EGL
if (gl->GetContextType() != ContextTypeEGL)
if (gl->GetContextType() != GLContextType::EGL)
return 0;
// Both EGLImage and SurfaceTexture only support same-process currently, but
@ -196,7 +196,7 @@ void ReleaseSharedHandle(GLContext* gl,
SharedTextureHandle sharedHandle)
{
// unimplemented outside of EGL
if (gl->GetContextType() != ContextTypeEGL)
if (gl->GetContextType() != GLContextType::EGL)
return;
if (shareType != SharedTextureShareType::SameProcess) {
@ -233,7 +233,7 @@ bool GetSharedHandleDetails(GLContext* gl,
SharedHandleDetails& details)
{
// unimplemented outside of EGL
if (gl->GetContextType() != ContextTypeEGL)
if (gl->GetContextType() != GLContextType::EGL)
return false;
if (shareType != SharedTextureShareType::SameProcess)
@ -271,7 +271,7 @@ bool AttachSharedHandle(GLContext* gl,
SharedTextureHandle sharedHandle)
{
// unimplemented outside of EGL
if (gl->GetContextType() != ContextTypeEGL)
if (gl->GetContextType() != GLContextType::EGL)
return false;
if (shareType != SharedTextureShareType::SameProcess)

View File

@ -30,10 +30,10 @@ CreateTextureImage(GLContext* gl,
{
switch (gl->GetContextType()) {
#ifdef XP_MACOSX
case ContextTypeCGL:
case GLContextType::CGL:
return CreateTextureImageCGL(gl, aSize, aContentType, aWrapMode, aFlags, aImageFormat);
#endif
case ContextTypeEGL:
case GLContextType::EGL:
return CreateTextureImageEGL(gl, aSize, aContentType, aWrapMode, aFlags, aImageFormat);
default:
return CreateBasicTextureImage(gl, aSize, aContentType, aWrapMode, aFlags, aImageFormat);
@ -50,10 +50,10 @@ TileGenFunc(GLContext* gl,
{
switch (gl->GetContextType()) {
#ifdef XP_MACOSX
case ContextTypeCGL:
case GLContextType::CGL:
return TileGenFuncCGL(gl, aSize, aContentType, aFlags, aImageFormat);
#endif
case ContextTypeEGL:
case GLContextType::EGL:
return TileGenFuncEGL(gl, aSize, aContentType, aFlags, aImageFormat);
default:
return nullptr;

View File

@ -47,7 +47,7 @@ ClientCanvasLayer::Initialize(const Data& aData)
SurfaceFactory_GL* factory = nullptr;
if (!mForceReadback) {
if (ClientManager()->AsShadowForwarder()->GetCompositorBackendType() == mozilla::layers::LAYERS_OPENGL) {
if (mGLContext->GetContextType() == ContextTypeEGL) {
if (mGLContext->GetContextType() == GLContextType::EGL) {
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
if (!isCrossProcess) {