From fc7d14a59a4d96ede180252d2421c83a243ef12a Mon Sep 17 00:00:00 2001 From: Brad Werth Date: Wed, 25 May 2022 18:58:21 +0000 Subject: [PATCH] Bug 1752919: Make tiled images respect opacity applied as color. r=gw This eliminates the need to determine when WebRender will apply opacity without a filter, since it will now always apply opacity correctly for both tiled and untiled images. Differential Revision: https://phabricator.services.mozilla.com/D147102 --- gfx/wr/webrender/src/batch.rs | 2 +- layout/painting/nsDisplayList.cpp | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/gfx/wr/webrender/src/batch.rs b/gfx/wr/webrender/src/batch.rs index 6fd8b54b343a..03a3b9a9f259 100644 --- a/gfx/wr/webrender/src/batch.rs +++ b/gfx/wr/webrender/src/batch.rs @@ -2435,7 +2435,7 @@ impl BatchBuilder { let mut gpu_blocks = Vec::::with_capacity(3 + max_tiles_per_header * 2); for chunk in image_instance.visible_tiles.chunks(max_tiles_per_header) { gpu_blocks.clear(); - gpu_blocks.push(PremultipliedColorF::WHITE.into()); //color + gpu_blocks.push(image_data.color.premultiplied().into()); //color gpu_blocks.push(PremultipliedColorF::WHITE.into()); //bg color gpu_blocks.push([-1.0, 0.0, 0.0, 0.0].into()); //stretch size // negative first value makes the shader code ignore it and use the local size instead diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index c2f0d7c78ade..bf4b4b14670c 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -3380,15 +3380,6 @@ static bool RoundedRectContainsRect(const nsRect& aRoundedRect, bool nsDisplayBackgroundImage::CanApplyOpacity( WebRenderLayerManager* aManager, nsDisplayListBuilder* aBuilder) const { - // Bug 1752919: WebRender does not properly handle opacity flattening for - // images larger than 4096 dest pixels. - static const nscoord WR_NSCOORD_LIMIT = - NSIntPixelsToAppUnits(4096, AppUnitsPerCSSPixel()); - if MOZ_UNLIKELY (mDestRect.width > WR_NSCOORD_LIMIT || - mDestRect.height > WR_NSCOORD_LIMIT) { - return false; - } - return CanBuildWebRenderDisplayItems(aManager, aBuilder); } -- 2.11.4.GIT