mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 1384839 - Part4. Use A8 format when painting mask image. r=kats
MozReview-Commit-ID: 9vMkBxRNAUv --HG-- extra : rebase_source : 164011beb656b7b97f0854baeedabbe85c2f9321
This commit is contained in:
parent
fa25e69f8d
commit
a1f704c881
@ -19,13 +19,16 @@ namespace layers {
|
||||
class UpdateImageHelper
|
||||
{
|
||||
public:
|
||||
UpdateImageHelper(ImageContainer* aImageContainer, ImageClient* aImageClient, gfx::IntSize aImageSize) :
|
||||
UpdateImageHelper(ImageContainer* aImageContainer,
|
||||
ImageClient* aImageClient,
|
||||
gfx::IntSize aImageSize,
|
||||
gfx::SurfaceFormat aFormat) :
|
||||
mImageContainer(aImageContainer),
|
||||
mImageClient(aImageClient),
|
||||
mImageSize(aImageSize),
|
||||
mIsLocked(false)
|
||||
{
|
||||
mTexture = mImageClient->GetTextureClientRecycler()->CreateOrRecycle(gfx::SurfaceFormat::B8G8R8A8,
|
||||
mTexture = mImageClient->GetTextureClientRecycler()->CreateOrRecycle(aFormat,
|
||||
mImageSize,
|
||||
BackendSelector::Content,
|
||||
TextureFlags::DEFAULT);
|
||||
|
@ -448,9 +448,12 @@ WebRenderLayerManager::GenerateFallbackData(nsDisplayItem* aItem,
|
||||
}
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat format = aItem->GetType() == nsDisplayItem::TYPE_MASK ?
|
||||
gfx::SurfaceFormat::A8 : gfx::SurfaceFormat::B8G8R8A8;
|
||||
if (!geometry || !invalidRegion.IsEmpty() || fallbackData->IsInvalid()) {
|
||||
if (gfxPrefs::WebRenderBlobImages()) {
|
||||
RefPtr<gfx::DrawEventRecorderMemory> recorder = MakeAndAddRef<gfx::DrawEventRecorderMemory>();
|
||||
// TODO: should use 'format' to replace gfx::SurfaceFormat::B8G8R8X8. Currently blob image doesn't support A8 format.
|
||||
RefPtr<gfx::DrawTarget> dummyDt =
|
||||
gfx::Factory::CreateDrawTarget(gfx::BackendType::SKIA, gfx::IntSize(1, 1), gfx::SurfaceFormat::B8G8R8X8);
|
||||
RefPtr<gfx::DrawTarget> dt = gfx::Factory::CreateRecordingDrawTarget(recorder, dummyDt, imageSize.ToUnknownSize());
|
||||
@ -467,7 +470,7 @@ WebRenderLayerManager::GenerateFallbackData(nsDisplayItem* aItem,
|
||||
RefPtr<ImageContainer> imageContainer = LayerManager::CreateImageContainer();
|
||||
|
||||
{
|
||||
UpdateImageHelper helper(imageContainer, imageClient, imageSize.ToUnknownSize());
|
||||
UpdateImageHelper helper(imageContainer, imageClient, imageSize.ToUnknownSize(), format);
|
||||
{
|
||||
RefPtr<gfx::DrawTarget> dt = helper.GetDrawTarget();
|
||||
PaintItemByDrawTarget(aItem, dt, aImageRect, aOffset, aDisplayListBuilder);
|
||||
|
@ -57,7 +57,7 @@ WebRenderPaintedLayer::UpdateImageClient()
|
||||
IntRect bounds = visibleRegion.GetBounds();
|
||||
IntSize imageSize = bounds.Size();
|
||||
|
||||
UpdateImageHelper helper(mImageContainer, mImageClient, imageSize);
|
||||
UpdateImageHelper helper(mImageContainer, mImageClient, imageSize, gfx::SurfaceFormat::B8G8R8A8);
|
||||
|
||||
{
|
||||
RefPtr<DrawTarget> target = helper.GetDrawTarget();
|
||||
|
Loading…
Reference in New Issue
Block a user