Add an `Outline::with_capacity()` method

This commit is contained in:
Sebastian K 2020-06-24 17:40:51 -07:00 committed by Patrick Walton
parent 4dea6aa258
commit 5eb346f77d
1 changed files with 9 additions and 0 deletions

View File

@ -61,6 +61,15 @@ impl Outline {
} }
} }
/// Returns a new `Outline` with storage for `capacity` contours preallocated.
#[inline]
pub fn with_capacity(capacity: usize) -> Outline {
Outline {
contours: Vec::with_capacity(capacity),
bounds: RectF::default(),
}
}
#[inline] #[inline]
pub fn from_segments<I>(segments: I) -> Outline pub fn from_segments<I>(segments: I) -> Outline
where where