From 2f5eb047d9e05be5e68549ef6b75070d2faa7d2f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sat, 11 Oct 2008 11:16:23 -0400 Subject: Merging from trunk (bzr r6884) --- src/libnr/nr-rect.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/libnr/nr-rect.cpp') diff --git a/src/libnr/nr-rect.cpp b/src/libnr/nr-rect.cpp index 77af27417..620782996 100644 --- a/src/libnr/nr-rect.cpp +++ b/src/libnr/nr-rect.cpp @@ -28,6 +28,17 @@ NRRect::NRRect(boost::optional const &rect) { } } +NRRect::NRRect(boost::optional const &rect) { + if (rect) { + x0 = rect->min()[Geom::X]; + y0 = rect->min()[Geom::Y]; + x1 = rect->max()[Geom::X]; + y1 = rect->max()[Geom::Y]; + } else { + nr_rect_d_set_empty(this); + } +} + boost::optional NRRect::upgrade() const { if (nr_rect_d_test_empty_ptr(this)) { return boost::optional(); @@ -36,6 +47,14 @@ boost::optional NRRect::upgrade() const { } } +boost::optional NRRect::upgrade_2geom() const { + if (nr_rect_d_test_empty_ptr(this)) { + return boost::optional(); + } else { + return Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)); + } +} + /** * \param r0 Rectangle. * \param r1 Another rectangle. -- cgit v1.2.3