Bug 964976 - Prevent crash of unsupported pixel format gralloc allocation. r=nical

This commit is contained in:
Sotaro Ikeda 2014-01-30 11:17:10 -05:00
parent 5f37657f54
commit 38e9a6c028

View File

@ -172,6 +172,9 @@ PixelFormatForImageFormat(gfxImageFormat aFormat)
return android::PIXEL_FORMAT_RGBX_8888;
case gfxImageFormat::RGB16_565:
return android::PIXEL_FORMAT_RGB_565;
case gfxImageFormat::A8:
NS_WARNING("gralloc does not support gfxImageFormat::A8");
return android::PIXEL_FORMAT_UNKNOWN;
default:
MOZ_CRASH("Unknown gralloc pixel format");
}
@ -430,6 +433,10 @@ ISurfaceAllocator::PlatformAllocSurfaceDescriptor(const gfx::IntSize& aSize,
PGrallocBufferChild* gc;
bool defaultRBSwap;
if (PixelFormatForContentType(aContent) == android::PIXEL_FORMAT_UNKNOWN) {
return false;
}
if (aCaps & USING_GL_RENDERING_ONLY) {
gc = AllocGrallocBuffer(aSize,
PixelFormatForContentType(aContent),