Add `Contour::with_capacity()` from #289

This commit is contained in:
Patrick Walton 2020-03-27 10:06:56 -07:00
parent b29ffdf3fa
commit 15718d297c
1 changed files with 10 additions and 0 deletions

View File

@ -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 {