Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central #3548

Merged
merged 6 commits into from Feb 12, 2019
Prev

Backed out 5 changesets (bug 1523495) for reftest failures in file://…

…/builds/worker/workspace/build/tests/reftest/tests/gfx/tests/reftest/1523776.html CLOSED TREE

Backed out changeset 3d8ac233a5d1 (bug 1523495)
Backed out changeset 09de2f84aa1c (bug 1523495)
Backed out changeset 23406bc33980 (bug 1523495)
Backed out changeset 8d99e173cdf6 (bug 1523495)
Backed out changeset 8db55f13f405 (bug 1523495)

[wrupdater] From https://hg.mozilla.org/mozilla-central/rev/3e2806772432aed7e1e9b5e4372b186d7846f40f
  • Loading branch information
shindli authored and moz-gfx committed Feb 11, 2019
commit 8a8f5472939726e489ae914827f63f3407f413b0
@@ -2914,17 +2914,10 @@ impl PicturePrimitive {
// blur results, inflate that clipped area by the blur range, and
// then intersect with the total screen rect, to minimize the
// allocation size.
let mut device_rect = clipped
let 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,
@@ -2963,7 +2956,7 @@ impl PicturePrimitive {
PictureCompositeMode::Filter(FilterOp::DropShadow(offset, blur_radius, color)) => {
let blur_std_deviation = blur_radius * frame_context.device_pixel_scale.0;
let blur_range = (blur_std_deviation * BLUR_SAMPLE_SCALE).ceil() as i32;
let rounded_std_dev = blur_std_deviation.round();

// 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
@@ -2972,13 +2965,10 @@ impl PicturePrimitive {
// blur results, inflate that clipped area by the blur range, and
// then intersect with the total screen rect, to minimize the
// allocation size.
let mut device_rect = clipped.inflate(blur_range, blur_range)
.intersection(&unclipped.to_i32())
.unwrap();
device_rect.size = RenderTask::adjusted_blur_source_size(
device_rect.size,
rounded_std_dev,
);
let device_rect = clipped
.inflate(blur_range, blur_range)
.intersection(&unclipped.to_i32())
.unwrap();

let uv_rect_kind = calculate_uv_rect_kind(
&pic_rect,
@@ -3002,7 +2992,7 @@ impl PicturePrimitive {
let picture_task_id = frame_state.render_tasks.add(picture_task);

let blur_render_task = RenderTask::new_blur(
rounded_std_dev,
blur_std_deviation.round(),
picture_task_id,
frame_state.render_tasks,
RenderTargetKind::Color,
@@ -626,25 +626,6 @@ impl RenderTask {
)
}

// In order to do the blur down-scaling passes without introducing errors, we need the
// source of each down-scale pass to be a multuple of two. If need be, this inflates
// the source size so that each down-scale pass will sample correctly.
pub fn adjusted_blur_source_size(original_size: DeviceIntSize, mut std_dev: f32) -> DeviceIntSize {
let mut adjusted_size = original_size;
let mut scale_factor = 1.0;
while std_dev > MAX_BLUR_STD_DEVIATION {
if adjusted_size.width < MIN_DOWNSCALING_RT_SIZE ||
adjusted_size.height < MIN_DOWNSCALING_RT_SIZE {
break;
}
std_dev *= 0.5;
scale_factor *= 2.0;
adjusted_size = (original_size.to_f32() / scale_factor).ceil().to_i32();
}

adjusted_size * scale_factor as i32
}

// Construct a render task to apply a blur to a primitive.
// The render task chain that is constructed looks like:
//
Binary file not shown.
Binary file not shown.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.