Bug 1523495 - Adjust blur target sizes to avoid down-scaling artifacts. r=gw
☠☠ backed out by 3e2806772432 ☠ ☠
authorNicolas Silva <nsilva@mozilla.com>
Wed, 06 Feb 2019 18:13:28 +0100
changeset 458530 8d99e173cdf6268c7b69690882f15ab5bed8f6f2
parent 458529 8db55f13f405d58f343756ff8548736e4af627f9
child 458531 23406bc3398087547a7723550dd14f074acde7eb
push id35537
push userbtara@mozilla.com
push dateMon, 11 Feb 2019 21:55:45 +0000
treeherdermozilla-central@b9187fa10f13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgw
bugs1523495
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1523495 - Adjust blur target sizes to avoid down-scaling artifacts. r=gw Differential Revision: https://phabricator.services.mozilla.com/D18855
gfx/wr/webrender/src/picture.rs
--- a/gfx/wr/webrender/src/picture.rs
+++ b/gfx/wr/webrender/src/picture.rs
@@ -2909,20 +2909,27 @@ impl PicturePrimitive {
                 // The clipped field is the part of the picture that is visible
                 // on screen. The unclipped field is the screen-space rect of
                 // the complete picture, if no screen / clip-chain was applied
                 // (this includes the extra space for blur region). To ensure
                 // that we draw a large enough part of the picture to get correct
                 // blur results, inflate that clipped area by the blur range, and
                 // then intersect with the total screen rect, to minimize the
                 // allocation size.
-                let device_rect = clipped
+                let mut device_rect = clipped
                     .inflate(inflation_factor, inflation_factor)
                     .intersection(&unclipped.to_i32())
                     .unwrap();
+                // Adjust the size to avoid introducing sampling errors during the down-scaling passes.
+                // what would be even better is to rasterize the picture at the down-scaled size
+                // directly.
+                device_rect.size = RenderTask::adjusted_blur_source_size(
+                    device_rect.size,
+                    blur_std_deviation,
+                );
 
                 let uv_rect_kind = calculate_uv_rect_kind(
                     &pic_rect,
                     &transform,
                     &device_rect,
                     frame_context.device_pixel_scale,
                     true,
                 );