Implement some of GenericDrawTarget's methods for raqote

This commit is contained in:
pylbrecht 2019-07-08 18:29:17 +02:00 committed by Bastien Orivel
parent 398929ffef
commit 7005c24e40

View file

@ -121,6 +121,11 @@ impl<'a> StrokeOptions<'a> {
StrokeOptions::Raqote(options, _) => options.cap = _val.to_raqote_style(), StrokeOptions::Raqote(options, _) => options.cap = _val.to_raqote_style(),
} }
} }
pub fn as_raqote(&self) -> &raqote::StrokeStyle {
match self {
StrokeOptions::Raqote(options, _) => options,
}
}
} }
impl DrawOptions { impl DrawOptions {
@ -235,28 +240,33 @@ impl GenericDrawTarget for raqote::DrawTarget {
unimplemented!(); unimplemented!();
} }
fn get_transform(&self) -> Transform2D<f32> { fn get_transform(&self) -> Transform2D<f32> {
unimplemented!(); *self.get_transform()
} }
fn pop_clip(&mut self) { fn pop_clip(&mut self) {
unimplemented!(); self.pop_clip();
} }
fn push_clip(&mut self, _path: &Path) { fn push_clip(&mut self, path: &Path) {
unimplemented!(); self.push_clip(path.as_raqote());
} }
fn set_transform(&mut self, _matrix: &Transform2D<f32>) { fn set_transform(&mut self, matrix: &Transform2D<f32>) {
unimplemented!(); self.set_transform(matrix);
} }
fn snapshot(&self) -> SourceSurface { fn snapshot(&self) -> SourceSurface {
unimplemented!(); unimplemented!();
} }
fn stroke( fn stroke(
&mut self, &mut self,
_path: &Path, path: &Path,
_pattern: Pattern, pattern: Pattern,
_stroke_options: &StrokeOptions, stroke_options: &StrokeOptions,
_draw_options: &DrawOptions, draw_options: &DrawOptions,
) { ) {
unimplemented!(); self.stroke(
path.as_raqote(),
pattern.as_raqote(),
stroke_options.as_raqote(),
draw_options.as_raqote(),
);
} }
fn stroke_line( fn stroke_line(
&mut self, &mut self,