Add stroke_rectangle
This method should be able to leverage performance improvements in lyon's `tessellate_rectangle` over `tessellate_path`.
This commit is contained in:
parent
abd323181d
commit
ec39390c23
4 changed files with 100 additions and 0 deletions
|
|
@ -168,6 +168,31 @@ impl geometry::frame::Backend for Frame {
|
|||
});
|
||||
}
|
||||
|
||||
fn stroke_rectangle<'a>(
|
||||
&mut self,
|
||||
top_left: Point,
|
||||
size: Size,
|
||||
stroke: impl Into<Stroke<'a>>,
|
||||
) {
|
||||
let Some(path) = convert_path(&Path::rectangle(top_left, size))
|
||||
.and_then(|path| path.transform(self.transform))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
let stroke = stroke.into();
|
||||
let skia_stroke = into_stroke(&stroke);
|
||||
|
||||
let mut paint = into_paint(stroke.style);
|
||||
paint.shader.transform(self.transform);
|
||||
|
||||
self.primitives.push(Primitive::Stroke {
|
||||
path,
|
||||
paint,
|
||||
stroke: skia_stroke,
|
||||
});
|
||||
}
|
||||
|
||||
fn fill_text(&mut self, text: impl Into<geometry::Text>) {
|
||||
let text = text.into();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue