Partially implement radial gradients.

Missing: repeating radial gradients and keyword sizes.
This commit is contained in:
Pyfisch 2017-04-12 14:54:28 +02:00
parent 2c445169ad
commit f4bad2d920
4 changed files with 194 additions and 83 deletions

View file

@ -380,6 +380,21 @@ impl WebRenderDisplayItemConverter for DisplayItem {
rect.size,
webrender_traits::LayoutSize::zero());
}
DisplayItem::RadialGradient(ref item) => {
let rect = item.base.bounds.to_rectf();
let center = item.gradient.center.to_pointf();
let radius = item.gradient.radius.to_sizef();
let clip = item.base.clip.to_clip_region(builder);
let gradient = builder.create_radial_gradient(center,
radius,
item.gradient.stops.clone(),
ExtendMode::Clamp);
builder.push_radial_gradient(rect,
clip,
gradient,
rect.size,
webrender_traits::LayoutSize::zero());
}
DisplayItem::Line(..) => {
println!("TODO DisplayItem::Line");
}