[librsvg] transform_rect() - Avoid an allocation and simplify the loop a bit
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] transform_rect() - Avoid an allocation and simplify the loop a bit
- Date: Wed, 22 Apr 2020 22:45:43 +0000 (UTC)
commit 572e5ef1de97ef247ac9a1cac2e6795b76a93eee
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Apr 22 17:45:05 2020 -0500
transform_rect() - Avoid an allocation and simplify the loop a bit
rsvg_internals/src/transform.rs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/rsvg_internals/src/transform.rs b/rsvg_internals/src/transform.rs
index 4898f1fc..f338ede0 100644
--- a/rsvg_internals/src/transform.rs
+++ b/rsvg_internals/src/transform.rs
@@ -156,7 +156,7 @@ impl Transform {
}
pub fn transform_rect(&self, rect: &Rect) -> Rect {
- let points = vec![
+ let points = [
self.transform_point(rect.x0, rect.y0),
self.transform_point(rect.x1, rect.y0),
self.transform_point(rect.x0, rect.y1),
@@ -169,7 +169,7 @@ impl Transform {
(x, y, x, y)
};
- for &(x, y) in points.iter().take(4).skip(1) {
+ for &(x, y) in points.iter().skip(1) {
if x < xmin {
xmin = x;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]