Implement size_from_pattern

I tried to mimic the azure implementation but raqote doesn't have a
concept of horizontal or vertical repeat so this might be
wrong/incomplete but this is the last function needed to finally have
some tests pass
This commit is contained in:
Bastien Orivel 2019-08-08 17:10:59 +02:00
parent ed0dbafc72
commit 14ee093a5b

View file

@ -24,8 +24,18 @@ impl Backend for RaqoteBackend {
color.as_raqote().a != 0
}
fn size_from_pattern(&self, _rect: &Rect<f32>, _pattern: &Pattern) -> Option<Size2D<f32>> {
unimplemented!()
fn size_from_pattern(&self, rect: &Rect<f32>, pattern: &Pattern) -> Option<Size2D<f32>> {
match pattern {
Pattern::Raqote(raqote::Source::Image(image, extend, ..)) => {
match extend {
raqote::ExtendMode::Repeat => {
Some(rect.size)
},
_ => Some(Size2D::new(image.width as f32, image.height as f32))
}
},
_ => None
}
}
fn set_shadow_color<'a>(&mut self, _color: RGBA, _state: &mut CanvasPaintState<'a>) {