diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-08-27 09:04:37 +0000 |
|---|---|---|
| committer | Krzysztof Kosinski <tweenk.pl@gmail.com> | 2011-08-27 09:04:37 +0000 |
| commit | 72cc39b9f0b340548f395c7f61ca9662b34aea09 (patch) | |
| tree | 34a0853cff6c6040bc2a0572dfa365280fce2601 /src/seltrans.cpp | |
| parent | Fix "snap guides" toggle (diff) | |
| download | inkscape-72cc39b9f0b340548f395c7f61ca9662b34aea09.tar.gz inkscape-72cc39b9f0b340548f395c7f61ca9662b34aea09.zip | |
Refactor SPItem bounding box methods: remove NRRect usage and make code
using them more obvious. Fix filter region computation.
(bzr r10582.1.1)
Diffstat (limited to 'src/seltrans.cpp')
| -rw-r--r-- | src/seltrans.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 3a204a49e..0e5e533fc 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -90,7 +90,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _grabbed(false), _show_handles(true), _bbox(), - _approximate_bbox(), + _visual_bbox(), _absolute_affine(Geom::Scale(1,1)), _opposite(Geom::Point(0,0)), _opposite_for_specpoints(Geom::Point(0,0)), @@ -104,7 +104,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getBool("/tools/bounding_box"); _snap_bbox_type = !prefs_bbox ? - SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; + SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX; g_return_if_fail(desktop != NULL); @@ -279,8 +279,8 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // First, determine the bounding box _bbox = selection->bounds(_snap_bbox_type); - _approximate_bbox = selection->bounds(SPItem::APPROXIMATE_BBOX); // Used for correctly scaling the strokewidth - _geometric_bbox = selection->bounds(SPItem::GEOMETRIC_BBOX); + _visual_bbox = selection->visualBounds(); // Used for correctly scaling the strokewidth + _geometric_bbox = selection->geometricBounds(); _point = p; if (_geometric_bbox) { @@ -336,7 +336,8 @@ void Inkscape::SelTrans::grab(Geom::Point const &p, gdouble x, gdouble y, bool s // More than 50 items will produce at least 200 bbox points, which might make Inkscape crawl // (see the comment a few lines above). In that case we will use the bbox of the selection as a whole for (unsigned i = 0; i < _items.size(); i++) { - getBBoxPoints(_items[i]->getBboxDesktop(_snap_bbox_type), &_bbox_points_for_translating, false, c, emp, mp); + Geom::OptRect b = _items[i]->desktopBounds(_snap_bbox_type); + getBBoxPoints(b, &_bbox_points_for_translating, false, c, emp, mp); } } else { _bbox_points_for_translating = _bbox_points; // use the bbox points of the selection as a whole @@ -696,7 +697,7 @@ void Inkscape::SelTrans::_updateVolatileState() //Update the bboxes _bbox = selection->bounds(_snap_bbox_type); - _approximate_bbox = selection->bounds(SPItem::APPROXIMATE_BBOX); + _visual_bbox = selection->visualBounds(); if (!_bbox) { _empty = true; @@ -898,8 +899,7 @@ void Inkscape::SelTrans::_selChanged(Inkscape::Selection */*selection*/) // reread in case it changed on the fly: int prefs_bbox = prefs->getBool("/tools/bounding_box"); _snap_bbox_type = !prefs_bbox ? - SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; - //SPItem::APPROXIMATE_BBOX will be replaced by SPItem::VISUAL_BBOX, as soon as the latter is implemented properly + SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX; _updateVolatileState(); _current_relative_affine.setIdentity(); @@ -1602,8 +1602,8 @@ Geom::Scale Inkscape::calcScaleFactors(Geom::Point const &initial_point, Geom::P Geom::Point Inkscape::SelTrans::_calcAbsAffineDefault(Geom::Scale const default_scale) { Geom::Affine abs_affine = Geom::Translate(-_origin) * Geom::Affine(default_scale) * Geom::Translate(_origin); - Geom::Point new_bbox_min = _approximate_bbox->min() * abs_affine; - Geom::Point new_bbox_max = _approximate_bbox->max() * abs_affine; + Geom::Point new_bbox_min = _visual_bbox->min() * abs_affine; + Geom::Point new_bbox_max = _visual_bbox->max() * abs_affine; bool transform_stroke = false; gdouble strokewidth = 0; @@ -1614,7 +1614,7 @@ Geom::Point Inkscape::SelTrans::_calcAbsAffineDefault(Geom::Scale const default_ strokewidth = _strokewidth; } - _absolute_affine = get_scale_transform_with_uniform_stroke (*_approximate_bbox, strokewidth, transform_stroke, + _absolute_affine = get_scale_transform_with_uniform_stroke (*_visual_bbox, strokewidth, transform_stroke, new_bbox_min[Geom::X], new_bbox_min[Geom::Y], new_bbox_max[Geom::X], new_bbox_max[Geom::Y]); // return the new handle position |
