diff options
| author | Ted Gould <ted@gould.cx> | 2008-11-21 05:24:08 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-11-21 05:24:08 +0000 |
| commit | 44a3a78fb6a3863c0c7f3c1193837337e68a67e4 (patch) | |
| tree | 1722ee5ec6f88c881cd4124923354b3c1311501b /src/helper/geom.cpp | |
| parent | Merge from trunk (diff) | |
| download | inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.tar.gz inkscape-44a3a78fb6a3863c0c7f3c1193837337e68a67e4.zip | |
Merge from fe-moved
(bzr r6891)
Diffstat (limited to 'src/helper/geom.cpp')
| -rw-r--r-- | src/helper/geom.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/helper/geom.cpp b/src/helper/geom.cpp index 84f967860..c79cd829a 100644 --- a/src/helper/geom.cpp +++ b/src/helper/geom.cpp @@ -149,23 +149,21 @@ cubic_bbox (Geom::Coord x000, Geom::Coord y000, Geom::Coord x001, Geom::Coord y0 } } -Geom::Rect +Geom::OptRect bounds_fast_transformed(Geom::PathVector const & pv, Geom::Matrix const & t) { return bounds_exact_transformed(pv, t); //use this as it is faster for now! :) // return Geom::bounds_fast(pv * t); } -Geom::Rect +Geom::OptRect bounds_exact_transformed(Geom::PathVector const & pv, Geom::Matrix const & t) { - Geom::Rect bbox; - if (pv.empty()) - return bbox; + return Geom::OptRect(); Geom::Point initial = pv.front().initialPoint() * t; - bbox = Geom::Rect(initial, initial); // obtain well defined bbox as starting point to unionWith + Geom::Rect bbox(initial, initial); // obtain well defined bbox as starting point to unionWith for (Geom::PathVector::const_iterator it = pv.begin(); it != pv.end(); ++it) { bbox.expandTo(it->initialPoint() * t); @@ -494,6 +492,19 @@ pathv_to_linear_and_cubic_beziers( Geom::PathVector const &pathv ) return output; } + +/** + * rounds all corners of the rectangle 'outwards', i.e. x0 and y0 are floored, x1 and y1 are ceiled. + */ +void round_rectangle_outwards(Geom::Rect & rect) { + Geom::Interval ints[2]; + for (int i=0; i < 2; i++) { + ints[i] = Geom::Interval(std::floor(rect[i][0]), std::ceil(rect[i][1])); + } + rect = Geom::Rect(ints[0], ints[1]); +} + + namespace Geom { bool transform_equalp(Geom::Matrix const &m0, Geom::Matrix const &m1, Geom::Coord const epsilon) { |
