diff options
| author | Ted Gould <ted@gould.cx> | 2008-10-11 15:16:23 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-10-11 15:16:23 +0000 |
| commit | 2f5eb047d9e05be5e68549ef6b75070d2faa7d2f (patch) | |
| tree | ca2e94164b6d7aaebfc17196ca46bfc825a7665a /src/libnr/nr-rect.cpp | |
| parent | Merge from trunk. (diff) | |
| download | inkscape-2f5eb047d9e05be5e68549ef6b75070d2faa7d2f.tar.gz inkscape-2f5eb047d9e05be5e68549ef6b75070d2faa7d2f.zip | |
Merging from trunk
(bzr r6884)
Diffstat (limited to 'src/libnr/nr-rect.cpp')
| -rw-r--r-- | src/libnr/nr-rect.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
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<NR::Rect> const &rect) { } } +NRRect::NRRect(boost::optional<Geom::Rect> 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<NR::Rect> NRRect::upgrade() const { if (nr_rect_d_test_empty_ptr(this)) { return boost::optional<NR::Rect>(); @@ -36,6 +47,14 @@ boost::optional<NR::Rect> NRRect::upgrade() const { } } +boost::optional<Geom::Rect> NRRect::upgrade_2geom() const { + if (nr_rect_d_test_empty_ptr(this)) { + return boost::optional<Geom::Rect>(); + } else { + return Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)); + } +} + /** * \param r0 Rectangle. * \param r1 Another rectangle. |
