summaryrefslogtreecommitdiffstats
path: root/src/live_effects/lpe-offset.cpp
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-05-22 20:05:55 +0000
committerJabiertxof <jabier.arraiza@marker.es>2019-05-22 20:05:55 +0000
commit8436fb1882de33d192730ace9c61aab98b043db0 (patch)
tree43ac5344cf4651d7cf259a5fae19d88482245de3 /src/live_effects/lpe-offset.cpp
parentRemove ResourceManager dep on Glib::object. (diff)
downloadinkscape-8436fb1882de33d192730ace9c61aab98b043db0.tar.gz
inkscape-8436fb1882de33d192730ace9c61aab98b043db0.zip
Speed improvemets to offset LPE
Diffstat (limited to 'src/live_effects/lpe-offset.cpp')
-rw-r--r--src/live_effects/lpe-offset.cpp44
1 files changed, 12 insertions, 32 deletions
diff --git a/src/live_effects/lpe-offset.cpp b/src/live_effects/lpe-offset.cpp
index 0b3d5e2cb..124d7a612 100644
--- a/src/live_effects/lpe-offset.cpp
+++ b/src/live_effects/lpe-offset.cpp
@@ -302,37 +302,16 @@ LPEOffset::doEffect_path(Geom::PathVector const & path_in)
if (offset == 0.0) {
return path_in;
}
- Geom::PathVector work;
Geom::PathVector ret;
Geom::PathVector open_ret;
Geom::PathVector ret_outline;
Geom::PathIntersectionGraph *pig;
- for (Geom::PathVector::const_iterator path_it = original_pathv.begin(); path_it != original_pathv.end(); ++path_it) {
+ for (Geom::PathVector::const_iterator path_it = filled_rule_pathv.begin(); path_it != filled_rule_pathv.end(); ++path_it) {
Geom::Path original = (*path_it);
if (original.empty()) {
continue;
}
- bool added = false;
- for (auto cross:Geom::self_crossings(original)) {
- if (!Geom::are_near(cross.ta, cross.tb)) {
- Geom::PathVector tmp;
- tmp.push_back(original);
- sp_flatten(tmp, fill_nonZero);
- work.insert(work.begin(), tmp.begin(), tmp.end());
- added = true;
- break;
- }
- }
- if (!added) {
- work.push_back(original);
- }
- }
- for (Geom::PathVector::const_iterator path_it = work.begin(); path_it != work.end(); ++path_it) {
- Geom::Path original = (*path_it);
- if (original.empty()) {
- continue;
- }
- int wdg = offset_winding(work, original);
+ int wdg = offset_winding(filled_rule_pathv, original);
bool path_inside = wdg % 2 != 0;
double gap_size = -0.5;
bool closed = original.closed();
@@ -409,9 +388,11 @@ LPEOffset::doEffect_path(Geom::PathVector const & path_in)
Geom::Path big;
Geom::Path gap;
Geom::Path small;
- outline.push_back(with_dir);
- outline.push_back(against_dir);
- sp_flatten(outline, fill_nonZero);
+ if (offset < 0) {
+ outline.push_back(with_dir);
+ outline.push_back(against_dir);
+ sp_flatten(outline, fill_nonZero);
+ }
if (reversed || !closed) {
big = with_dir;
gap = with_dir_gap;
@@ -452,21 +433,20 @@ LPEOffset::doEffect_path(Geom::PathVector const & path_in)
tmp.push_back(big);
}
}
- if (path_inside) {
- outline.clear();
- outline.push_back(big);
- }
ret.insert(ret.end(), tmp.begin(), tmp.end());
- ret_outline.insert(ret_outline.end(), outline.begin(), outline.end());
+ if (offset < 0) {
+ ret_outline.insert(ret_outline.end(), outline.begin(), outline.end());
+ }
}
- sp_flatten(ret_outline, fill_nonZero);
if (offset < 0) {
+ sp_flatten(ret_outline, fill_nonZero);
pig = new Geom::PathIntersectionGraph(ret, ret_outline);
if (pig && !ret_outline.empty() && !ret.empty()) {
ret = pig->getAminusB();
}
}
+
sp_flatten(ret, fill_nonZero);
ret.insert(ret.end(), open_ret.begin(), open_ret.end());