From cb91f40d7a48383a4c723a015f33dfa82070b5ee Mon Sep 17 00:00:00 2001 From: Sebastian Date: Sat, 28 Mar 2020 19:22:39 +0300 Subject: [PATCH] add Contour::clear --- content/src/outline.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/content/src/outline.rs b/content/src/outline.rs index e9a6d4eb..421de7a9 100644 --- a/content/src/outline.rs +++ b/content/src/outline.rs @@ -281,6 +281,15 @@ impl Contour { ) } + /// restore self to the state of Contour::new(), but keep the points buffer allocated + #[inline] + pub fn clear(&mut self) { + self.points.clear(); + self.flags.clear(); + self.bounds = RectF::default(); + self.closed = false; + } + #[inline] pub fn iter(&self, flags: ContourIterFlags) -> ContourIter { ContourIter {