Bug 776876 - msvc nullptr fix for GLContextProviderEGL. r=joe

This commit is contained in:
Jim Mathies 2012-07-25 04:27:00 -05:00
parent c66bf9fff7
commit 7accc36bbe

View File

@ -888,10 +888,10 @@ SharedTextureHandle
GLContextEGL::CreateSharedHandle(TextureImage::TextureShareType aType)
{
if (aType != TextureImage::ThreadShared)
return nsnull;
return 0;
if (!mShareWithEGLImage)
return nsnull;
return 0;
MakeCurrent();
GLuint texture = 0;
@ -903,7 +903,7 @@ GLContextEGL::CreateSharedHandle(TextureImage::TextureShareType aType)
if (!tex->CreateEGLImage()) {
NS_ERROR("EGLImage creation for EGLTextureWrapper failed");
ReleaseSharedHandle(aType, (SharedTextureHandle)tex);
return nsnull;
return 0;
}
// Raw pointer shared across threads
return (SharedTextureHandle)tex;
@ -917,35 +917,35 @@ GLContextEGL::CreateSharedHandle(TextureImage::TextureShareType aType,
// Both EGLImage and SurfaceTexture only support ThreadShared currently, but
// it's possible to make SurfaceTexture work across processes. We should do that.
if (aType != TextureImage::ThreadShared)
return nsnull;
return 0;
switch (aBufferType) {
#ifdef MOZ_WIDGET_ANDROID
case SharedTextureBufferType::SurfaceTexture:
if (!IsExtensionSupported(GLContext::OES_EGL_image_external)) {
NS_WARNING("Missing GL_OES_EGL_image_external");
return nsnull;
return 0;
}
return (SharedTextureHandle) new SurfaceTextureWrapper(reinterpret_cast<nsSurfaceTexture*>(aBuffer));
#endif
case SharedTextureBufferType::TextureID: {
if (!mShareWithEGLImage)
return nsnull;
return 0;
GLuint texture = (GLuint)aBuffer;
EGLTextureWrapper* tex = new EGLTextureWrapper(this, texture, false);
if (!tex->CreateEGLImage()) {
NS_ERROR("EGLImage creation for EGLTextureWrapper failed");
delete tex;
return nsnull;
return 0;
}
return (SharedTextureHandle)tex;
}
default:
NS_ERROR("Unknown shared texture buffer type");
return nsnull;
return 0;
}
}