Bug 1596513: Part 3: Ensure drop shadow blur radius does not exceed MAX_BLUR after scale factors are applied r=gfx-reviewers,nical

This was causing one of the large drop-shadow wrench reftests to timeout.
This is only a partial fix, as we should be checking the scale factors earlier on when sanitizing the
filter input. This will ensure we match what the non-WR backend is doing and will prevent overinflation.

Differential Revision: https://phabricator.services.mozilla.com/D64197

--HG--
extra : moz-landing-system : lando
This commit is contained in:
cbrewster 2020-02-28 17:39:05 +00:00
Родитель ac38c6d0ab
Коммит eeba610e4b
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -96,7 +96,7 @@
use api::{MixBlendMode, PipelineId, PremultipliedColorF, FilterPrimitiveKind};
use api::{PropertyBinding, PropertyBindingId, FilterPrimitive, FontRenderMode};
use api::{DebugFlags, RasterSpace, ImageKey, ColorF, ColorU, PrimitiveFlags};
use api::{DebugFlags, RasterSpace, ImageKey, ColorF, ColorU, PrimitiveFlags, MAX_BLUR_RADIUS};
use api::units::*;
use crate::box_shadow::{BLUR_SAMPLE_SCALE};
use crate::clip::{ClipStore, ClipChainInstance, ClipDataHandle, ClipChainId};
@ -4383,9 +4383,13 @@ impl PicturePrimitive {
let mut blur_render_task_id = picture_task_id;
let scale_factors = scale_factors(&transform);
for shadow in shadows {
let std_dev = shadow.blur_radius * device_pixel_scale.0;
// TODO(cbrewster): We should take the scale factors into account when clamping the max
// std deviation for the blur earlier so that we don't overinflate.
blur_render_task_id = RenderTask::new_blur(
DeviceSize::new(std_dev * scale_factors.0, std_dev * scale_factors.1),
DeviceSize::new(
f32::min(shadow.blur_radius * scale_factors.0, MAX_BLUR_RADIUS) * device_pixel_scale.0,
f32::min(shadow.blur_radius * scale_factors.1, MAX_BLUR_RADIUS) * device_pixel_scale.0,
),
picture_task_id,
frame_state.render_tasks,
RenderTargetKind::Color,