зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1708122 - Fix the radial gradient optimization. r=gfx-reviewers,lsalzman
The bounds of a radial gradient primitive's radius have to be scaled by the end_offset parameter. Differential Revision: https://phabricator.services.mozilla.com/D114344
This commit is contained in:
Родитель
bf05d4e1a2
Коммит
fc544d4e99
|
@ -385,6 +385,7 @@ pub fn optimize_radial_gradient(
|
|||
tile_spacing: &mut LayoutSize,
|
||||
clip_rect: &LayoutRect,
|
||||
radius: LayoutSize,
|
||||
end_offset: f32,
|
||||
extend_mode: ExtendMode,
|
||||
stops: &[GradientStopKey],
|
||||
solid_parts: &mut dyn FnMut(&LayoutRect, ColorU),
|
||||
|
@ -403,8 +404,8 @@ pub fn optimize_radial_gradient(
|
|||
}
|
||||
|
||||
// Bounding box of the "interesting" part of the gradient.
|
||||
let min = prim_rect.origin + center.to_vector() - radius.to_vector();
|
||||
let max = prim_rect.origin + center.to_vector() + radius.to_vector();
|
||||
let min = prim_rect.origin + center.to_vector() - radius.to_vector() * end_offset;
|
||||
let max = prim_rect.origin + center.to_vector() + radius.to_vector() * end_offset;
|
||||
|
||||
// The (non-repeated) gradient primitive rect.
|
||||
let gradient_rect = LayoutRect {
|
||||
|
@ -444,7 +445,6 @@ pub fn optimize_radial_gradient(
|
|||
if b < threshold { b = 0.0 }
|
||||
}
|
||||
|
||||
|
||||
if l + t + r + b == 0.0 {
|
||||
// No adjustment to make;
|
||||
return;
|
||||
|
|
|
@ -1322,6 +1322,7 @@ impl<'a> SceneBuilder<'a> {
|
|||
&mut tile_spacing,
|
||||
&layout.clip_rect,
|
||||
info.gradient.radius,
|
||||
info.gradient.end_offset,
|
||||
info.gradient.extend_mode,
|
||||
&stops,
|
||||
&mut |solid_rect, color| {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
root:
|
||||
items:
|
||||
- type: radial-gradient
|
||||
bounds: 50 50 500 500
|
||||
center: 150 150
|
||||
radius: 80 160
|
||||
stops: [0, red, 1, [0,0,0,0]]
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
root:
|
||||
items:
|
||||
- type: radial-gradient
|
||||
bounds: 50 50 500 500
|
||||
center: 150 150
|
||||
radius: 20 40
|
||||
stops: [0, red, 4, [0,0,0,0]]
|
|
@ -111,6 +111,7 @@ fuzzy-range(<=1,1) == gradient_cache_hardstop_clip.yaml gradient_cache_hardstop_
|
|||
|
||||
# Exercise the radial gradient optimization code path
|
||||
== radial-optimized.yaml radial-optimized-ref.yaml
|
||||
== radial-optimized-2.yaml radial-optimized-2-ref.yaml
|
||||
== radial-tiling-optimized.yaml radial-tiling-optimized-ref.yaml
|
||||
|
||||
# Exercise the cached gradient scaling code path
|
||||
|
|
Загрузка…
Ссылка в новой задаче