[librsvg: 4/5] Add a sanity check to PixelRectangle



commit e6cfd7de485e14c3f7f21bba4677e96a8d84d903
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Sat Sep 15 12:41:01 2018 +0300

    Add a sanity check to PixelRectangle

 rsvg_internals/src/surface_utils/iterators.rs | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/rsvg_internals/src/surface_utils/iterators.rs b/rsvg_internals/src/surface_utils/iterators.rs
index ea74b9ed..477006ca 100644
--- a/rsvg_internals/src/surface_utils/iterators.rs
+++ b/rsvg_internals/src/surface_utils/iterators.rs
@@ -69,6 +69,12 @@ impl<'a> PixelRectangle<'a> {
         assert!(bounds.y1 >= bounds.y0);
         assert!(bounds.y1 <= surface.height());
 
+        // Non-None EdgeMode values need at least one pixel available.
+        if edge_mode != EdgeMode::None {
+            assert!(bounds.x1 > bounds.x0);
+            assert!(bounds.y1 > bounds.y0);
+        }
+
         assert!(rectangle.x1 >= rectangle.x0);
         assert!(rectangle.y1 >= rectangle.y0);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]