mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
ed0dbafc72
commit
14ee093a5b
1 changed files with 12 additions and 2 deletions
|
@ -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>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue