Bug 1523495 - Adjust blur target sizes to avoid down-scaling artifacts. r=gw
authorNicolas Silva <nsilva@mozilla.com>
Wed, 06 Feb 2019 18:13:28 +0100
changeset 458696 782ec3fc98e0
parent 458695 4f7935bfb0eb
child 458697 1559889f35e7
push id35544
push userccoroiu@mozilla.com
push dateTue, 12 Feb 2019 16:29:08 +0000
treeherdermozilla-central@c849fb69e2e7 [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
@@ -2913,20 +2913,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,
                 );