mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Add check for handling equal radial gradients
This commit is contained in:
parent
d87e5d831b
commit
16f06f24c5
1 changed files with 8 additions and 1 deletions
|
@ -677,9 +677,16 @@ impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
|
||||||
},
|
},
|
||||||
RadialGradient(style) => {
|
RadialGradient(style) => {
|
||||||
let stops = style.stops.into_iter().map(|s| s.to_raqote()).collect();
|
let stops = style.stops.into_iter().map(|s| s.to_raqote()).collect();
|
||||||
let gradient = raqote::Gradient { stops };
|
let mut gradient = raqote::Gradient { stops };
|
||||||
let center1 = Point2D::new(style.x0 as f32, style.y0 as f32);
|
let center1 = Point2D::new(style.x0 as f32, style.y0 as f32);
|
||||||
let center2 = Point2D::new(style.x1 as f32, style.y1 as f32);
|
let center2 = Point2D::new(style.x1 as f32, style.y1 as f32);
|
||||||
|
let equal_centers = center1 == center2;
|
||||||
|
let equal_radius = style.r0 == style.r1;
|
||||||
|
if equal_centers && equal_radius {
|
||||||
|
// TODO
|
||||||
|
// hack to make Pattern::is_zero_size_gradient() return true
|
||||||
|
gradient.stops.clear();
|
||||||
|
}
|
||||||
Some(raqote::Source::new_two_circle_radial_gradient(
|
Some(raqote::Source::new_two_circle_radial_gradient(
|
||||||
gradient,
|
gradient,
|
||||||
center1,
|
center1,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue