diff options
author | Bastien Orivel <eijebong@bananium.fr> | 2019-08-08 17:10:59 +0200 |
---|---|---|
committer | Bastien Orivel <eijebong@bananium.fr> | 2019-08-21 19:08:18 +0200 |
commit | 14ee093a5b57953073432ead358cbbc80b1b1837 (patch) | |
tree | 54d2391ead420c0babf4e4cd2c01e45a418fd632 /components/canvas/raqote_backend.rs | |
parent | ed0dbafc72b99ab2d2e97c7ed748d32026e9d880 (diff) | |
download | servo-14ee093a5b57953073432ead358cbbc80b1b1837.tar.gz servo-14ee093a5b57953073432ead358cbbc80b1b1837.zip |
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
Diffstat (limited to 'components/canvas/raqote_backend.rs')
-rw-r--r-- | components/canvas/raqote_backend.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index 573ee2bb8ff..1c31346661a 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -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>) { |