Skip to content

Commit e5eee41

Browse files
s3bkpcwalton
authored andcommitted
Micro-optimize Contour::from_rect()
1 parent 5eb346f commit e5eee41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/src/outline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl Contour {
289289

290290
#[inline]
291291
pub fn from_rect(rect: RectF) -> Contour {
292-
let mut contour = Contour::new();
292+
let mut contour = Contour::with_capacity(4);
293293
contour.push_point(rect.origin(), PointFlags::empty(), false);
294294
contour.push_point(rect.upper_right(), PointFlags::empty(), false);
295295
contour.push_point(rect.lower_right(), PointFlags::empty(), false);

0 commit comments

Comments
 (0)