Implement need_to_draw_shadow

This commit is contained in:
Bastien Orivel 2019-08-08 16:40:38 +02:00
parent 559b28ce7b
commit ed0dbafc72
2 changed files with 12 additions and 4 deletions

View file

@ -20,8 +20,8 @@ impl Backend for RaqoteBackend {
unimplemented!()
}
fn need_to_draw_shadow(&self, _color: &Color) -> bool {
unimplemented!()
fn need_to_draw_shadow(&self, color: &Color) -> bool {
color.as_raqote().a != 0
}
fn size_from_pattern(&self, _rect: &Rect<f32>, _pattern: &Pattern) -> Option<Size2D<f32>> {
@ -84,7 +84,7 @@ impl<'a> CanvasPaintState<'a> {
shadow_offset_x: 0.0,
shadow_offset_y: 0.0,
shadow_blur: 0.0,
shadow_color: Color::Raqote(()),
shadow_color: Color::Raqote(raqote::SolidSource { r: 0, g: 0, b: 0, a: 0 }),
}
}
}
@ -450,3 +450,11 @@ impl<'a> ToRaqoteSource<'a> for FillOrStrokeStyle {
}
}
}
impl Color {
fn as_raqote(&self) -> &raqote::SolidSource {
match self {
Color::Raqote(s) => s,
}
}
}