Bug 1254151 - use B8G8R8X8 for 24 bit depth visuals in nsShmImage with Cairo. r=jrmuizel

This commit is contained in:
Lee Salzman 2016-03-08 11:18:13 -05:00
parent 392b122471
commit 37e22e44ca

View File

@ -163,6 +163,8 @@ nsShmImage::CreateImage(const IntSize& aSize)
return false;
}
BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend();
mFormat = SurfaceFormat::UNKNOWN;
switch (mDepth) {
case 32:
@ -175,10 +177,12 @@ nsShmImage::CreateImage(const IntSize& aSize)
case 24:
// Only support the BGRX layout, and report it as BGRA to the compositor.
// The alpha channel will be discarded when we put the image.
// Cairo/pixman lacks some fast paths for compositing BGRX onto BGRA, so
// just report it as BGRX directly in that case.
if (mVisual->red_mask == 0xff0000 &&
mVisual->green_mask == 0xff00 &&
mVisual->blue_mask == 0xff) {
mFormat = SurfaceFormat::B8G8R8A8;
mFormat = backend == BackendType::CAIRO ? SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8;
}
break;
case 16: