summaryrefslogtreecommitdiffstats
path: root/src/libnr/nr-rect.cpp
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-03-11 21:41:42 +0000
committermental <mental@users.sourceforge.net>2007-03-11 21:41:42 +0000
commit7146a6c31b8507c9dfba86d3e91fa8c42e955e06 (patch)
tree8b2af16f2ed3611f9ac3ec26dfcd34694ed974ed /src/libnr/nr-rect.cpp
parentEliminate remaining sources of empty NR::Rects (diff)
downloadinkscape-7146a6c31b8507c9dfba86d3e91fa8c42e955e06.tar.gz
inkscape-7146a6c31b8507c9dfba86d3e91fa8c42e955e06.zip
ban empty rectangles entirely and remove isEmpty test
(bzr r2606)
Diffstat (limited to 'src/libnr/nr-rect.cpp')
-rw-r--r--src/libnr/nr-rect.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp
index 2d4629d42..a9487045a 100644
--- a/src/libnr/nr-rect.cpp
+++ b/src/libnr/nr-rect.cpp
@@ -244,7 +244,12 @@ namespace NR {
Rect::Rect(const Point &p0, const Point &p1)
: _min(std::min(p0[X], p1[X]), std::min(p0[Y], p1[Y])),
- _max(std::max(p0[X], p1[X]), std::max(p0[Y], p1[Y])) {}
+ _max(std::max(p0[X], p1[X]), std::max(p0[Y], p1[Y]))
+{
+ if ( _min[X] == _max[X] || _min[Y] == _max[Y] ) {
+ throw EmptyRectangle();
+ }
+}
/** returns the four corners of the rectangle in the correct winding order */
Point Rect::corner(unsigned i) const {