From 15718d297ccc8c8cb9475cbf770920dc816245fe Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 27 Mar 2020 10:06:56 -0700 Subject: [PATCH] Add `Contour::with_capacity()` from #289 --- content/src/outline.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/src/outline.rs b/content/src/outline.rs index 2949ca06..92033220 100644 --- a/content/src/outline.rs +++ b/content/src/outline.rs @@ -234,6 +234,16 @@ impl Contour { } } + #[inline] + pub fn with_capacity(length: usize) -> Contour { + Contour { + points: Vec::with_capacity(length), + flags: Vec::with_capacity(length), + bounds: RectF::default(), + closed: false, + } + } + // Replaces this contour with a new one, with arrays preallocated to match `self`. #[inline] pub(crate) fn take(&mut self) -> Contour {