diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-08-28 22:53:56 +0000 |
|---|---|---|
| committer | Krzysztof Kosinski <tweenk.pl@gmail.com> | 2011-08-28 22:53:56 +0000 |
| commit | f4b79d4a8edc870f099fb9194c8493ec04012ad1 (patch) | |
| tree | 2951d5171168abc288c00d09d04f5e5737e779d5 /src/gradient-chemistry.cpp | |
| parent | Tie the snapping of rectangle corners and quadrant points of ellipses to the ... (diff) | |
| parent | Completely remove libnr (diff) | |
| download | inkscape-f4b79d4a8edc870f099fb9194c8493ec04012ad1.tar.gz inkscape-f4b79d4a8edc870f099fb9194c8493ec04012ad1.zip | |
Completely remove libnr
(bzr r10589)
Diffstat (limited to 'src/gradient-chemistry.cpp')
| -rw-r--r-- | src/gradient-chemistry.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index f803d7bf8..990695068 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -16,6 +16,8 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <2geom/transforms.h> +#include <2geom/bezier-curve.h> #include "style.h" #include "document-private.h" @@ -30,14 +32,12 @@ #include "sp-text.h" #include "sp-tspan.h" -#include <2geom/transforms.h> #include "xml/repr.h" #include "svg/svg.h" #include "svg/svg-color.h" #include "svg/css-ostringstream.h" #include "preferences.h" -#include "libnr/nr-point-fns.h" #define noSP_GR_VERBOSE // Terminology: @@ -296,7 +296,7 @@ SPGradient *sp_gradient_reset_to_userspace(SPGradient *gr, SPItem *item) // calculate the bbox of the item item->document->ensureUpToDate(); - Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine + Geom::OptRect bbox = item->visualBounds(); // we need "true" bbox without item_i2d_affine if (!bbox) return gr; @@ -363,7 +363,7 @@ SPGradient *sp_gradient_convert_to_userspace(SPGradient *gr, SPItem *item, gchar // calculate the bbox of the item item->document->ensureUpToDate(); Geom::Affine bbox2user; - Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine + Geom::OptRect bbox = item->visualBounds(); // we need "true" bbox without item_i2d_affine if ( bbox ) { bbox2user = Geom::Affine(bbox->dimensions()[Geom::X], 0, 0, bbox->dimensions()[Geom::Y], @@ -838,7 +838,9 @@ void sp_item_gradient_set_coords(SPItem *item, guint point_type, guint point_i, case POINT_LG_MID: { // using X-coordinates only to determine the offset, assuming p has been snapped to the vector from begin to end. - double offset = get_offset_between_points (p, Geom::Point(lg->x1.computed, lg->y1.computed), Geom::Point(lg->x2.computed, lg->y2.computed)); + Geom::Point begin(lg->x1.computed, lg->y1.computed); + Geom::Point end(lg->x2.computed, lg->y2.computed); + double offset = Geom::LineSegment(begin, end).nearestPoint(p); SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (lg, false); lg->ensureVector(); lg->vector.stops.at(point_i).offset = offset; @@ -931,8 +933,8 @@ void sp_item_gradient_set_coords(SPItem *item, guint point_type, guint point_i, case POINT_RG_MID1: { Geom::Point start = Geom::Point (rg->cx.computed, rg->cy.computed); - Geom::Point end = Geom::Point (rg->cx.computed + rg->r.computed, rg->cy.computed); - double offset = get_offset_between_points (p, start, end); + Geom::Point end = Geom::Point (rg->cx.computed + rg->r.computed, rg->cy.computed); + double offset = Geom::LineSegment(start, end).nearestPoint(p); SPGradient *vector = sp_gradient_get_forked_vector_if_necessary (rg, false); rg->ensureVector(); rg->vector.stops.at(point_i).offset = offset; @@ -948,7 +950,7 @@ void sp_item_gradient_set_coords(SPItem *item, guint point_type, guint point_i, case POINT_RG_MID2: Geom::Point start = Geom::Point (rg->cx.computed, rg->cy.computed); Geom::Point end = Geom::Point (rg->cx.computed, rg->cy.computed - rg->r.computed); - double offset = get_offset_between_points (p, start, end); + double offset = Geom::LineSegment(start, end).nearestPoint(p); SPGradient *vector = sp_gradient_get_forked_vector_if_necessary(rg, false); rg->ensureVector(); rg->vector.stops.at(point_i).offset = offset; @@ -1063,7 +1065,7 @@ Geom::Point sp_item_gradient_get_coords(SPItem *item, guint point_type, guint po if (SP_GRADIENT(gradient)->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) { item->document->ensureUpToDate(); - Geom::OptRect bbox = item->getBounds(Geom::identity()); // we need "true" bbox without item_i2d_affine + Geom::OptRect bbox = item->visualBounds(); // we need "true" bbox without item_i2d_affine if (bbox) { p *= Geom::Affine(bbox->dimensions()[Geom::X], 0, 0, bbox->dimensions()[Geom::Y], |
