mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-11 22:41:02 +00:00
Bug 964976 - Prevent crash of unsupported pixel format gralloc allocation. r=nical
This commit is contained in:
parent
8e0d266e53
commit
aea08d0bde
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user