From c7731033ef400fccb6a49d830ded86068fcd3432 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 5 Feb 2014 12:29:11 +0100 Subject: Fix for Bug #1250685 (Unnecessary gender-specific terms in code). Fixed bugs: - https://launchpad.net/bugs/1250685 (bzr r12997) --- src/livarot/PathCutting.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/livarot/PathCutting.cpp') diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 201f64b54..0dc7ede50 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -641,21 +641,21 @@ Path** Path::SubPathsWithNesting(int &outNb,bool killNoSurf,int nbNest,int* } curAdd=NULL; } - Path* hasDad=NULL; + Path* hasParent=NULL; for (int j=0;j= 0 ) { - int dadMvt=conts[nesting[j]]; + int parentMvt=conts[nesting[j]]; for (int k=0;kdescr_cmd.empty() == false && res[k]->descr_cmd[0]->associated == dadMvt ) { - hasDad=res[k]; + if ( res[k] && res[k]->descr_cmd.empty() == false && res[k]->descr_cmd[0]->associated == parentMvt ) { + hasParent=res[k]; break; } } } if ( conts[j] > i ) break; } - if ( hasDad ) { - curAdd=hasDad; + if ( hasParent ) { + curAdd=hasParent; increment=true; } else { curAdd=new Path; -- cgit v1.2.3 From 1d31728fb7399f48d272560a290dc990b75a197e Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Tue, 11 Mar 2014 15:52:08 +0100 Subject: Change stroke-dasharray and stroke-dashoffset handling to match other properties. Split style.h into more manageable size files. (bzr r13135) --- src/livarot/PathCutting.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/livarot/PathCutting.cpp') diff --git a/src/livarot/PathCutting.cpp b/src/livarot/PathCutting.cpp index 0dc7ede50..49b2c5a78 100644 --- a/src/livarot/PathCutting.cpp +++ b/src/livarot/PathCutting.cpp @@ -58,31 +58,36 @@ void Path::DashPolyline(float head,float tail,float body,int nbD,float *dashs,b void Path::DashPolylineFromStyle(SPStyle *style, float scale, float min_len) { - if (style->stroke_dash.n_dash) { + if (!style->stroke_dasharray.values.empty()) { double dlen = 0.0; - for (int i = 0; i < style->stroke_dash.n_dash; i++) { - dlen += style->stroke_dash.dash[i] * scale; + // Find total length + for (unsigned i = 0; i < style->stroke_dasharray.values.size(); i++) { + dlen += style->stroke_dasharray.values[i] * scale; } if (dlen >= min_len) { - NRVpathDash dash; - dash.offset = style->stroke_dash.offset * scale; - dash.n_dash = style->stroke_dash.n_dash; - dash.dash = g_new(double, dash.n_dash); - for (int i = 0; i < dash.n_dash; i++) { - dash.dash[i] = style->stroke_dash.dash[i] * scale; + // Extract out dash pattern (relative positions) + double dash_offset = style->stroke_dashoffset.value * scale; + size_t n_dash = style->stroke_dasharray.values.size(); + double *dash = g_new(double, n_dash); + for (unsigned i = 0; i < n_dash; i++) { + dash[i] = style->stroke_dasharray.values[i] * scale; } - int nbD=dash.n_dash; + + // Convert relative positions to absolute postions + int nbD = n_dash; float *dashs=(float*)malloc((nbD+1)*sizeof(float)); - while ( dash.offset >= dlen ) dash.offset-=dlen; - dashs[0]=dash.dash[0]; + while ( dash_offset >= dlen ) dash_offset-=dlen; + dashs[0]=dash[0]; for (int i=1; iDashPolyline(0.0, 0.0, dlen, nbD, dashs, true, dash.offset); + this->DashPolyline(0.0, 0.0, dlen, nbD, dashs, true, dash_offset); + free(dashs); - g_free(dash.dash); + g_free(dash); } } } -- cgit v1.2.3