Bug 966543 - null check mSurface in MacIOSurfaceTextureHostOGL. r=nical

This commit is contained in:
Matt Woodrow 2014-02-18 09:32:49 +13:00
parent b03da0f6e7
commit bccfc9bf4a

View File

@ -46,7 +46,7 @@ MacIOSurfaceTextureHostOGL::MacIOSurfaceTextureHostOGL(TextureFlags aFlags,
bool
MacIOSurfaceTextureHostOGL::Lock()
{
if (!mCompositor) {
if (!mCompositor || !mSurface) {
return false;
}
@ -95,11 +95,17 @@ MacIOSurfaceTextureSourceOGL::gl() const
gfx::SurfaceFormat
MacIOSurfaceTextureHostOGL::GetFormat() const {
if (!mSurface) {
return gfx::SurfaceFormat::UNKNOWN;
}
return mSurface->HasAlpha() ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8X8;
}
gfx::IntSize
MacIOSurfaceTextureHostOGL::GetSize() const {
if (!mSurface) {
return gfx::IntSize();
}
return gfx::IntSize(mSurface->GetDevicePixelWidth(),
mSurface->GetDevicePixelHeight());
}