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/widgets/dash-selector.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/widgets/dash-selector.cpp') diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp index afc81e574..fce7a9d9f 100644 --- a/src/widgets/dash-selector.cpp +++ b/src/widgets/dash-selector.cpp @@ -39,7 +39,7 @@ static double dash_4_1[] = {4.0, 1.0, -1.0}; static double dash_1_2[] = {1.0, 2.0, -1.0}; static double dash_1_4[] = {1.0, 4.0, -1.0}; -#define bd_len 7 // must correspond to the number of entries in the next line +static size_t BD_LEN = 7; // must correspond to the number of entries in the next line static double *builtin_dashes[] = {dash_0, dash_1_1, dash_2_1, dash_4_1, dash_1_2, dash_1_4, NULL}; static double **dashes = NULL; @@ -124,12 +124,12 @@ void SPDashSelector::init_dashes() { for (std::vector::iterator i = dash_prefs.begin(); i != dash_prefs.end(); ++i) { sp_style_read_from_prefs(style, *i); - if (style->stroke_dash.n_dash > 0) { - dashes[pos] = g_new (double, style->stroke_dash.n_dash + 1); + if (!style->stroke_dasharray.values.empty()) { + dashes[pos] = g_new (double, style->stroke_dasharray.values.size() + 1); double *d = dashes[pos]; - int i = 0; - for (; i < style->stroke_dash.n_dash; i++) { - d[i] = style->stroke_dash.dash[i]; + unsigned i = 0; + for (; i < style->stroke_dasharray.values.size(); i++) { + d[i] = style->stroke_dasharray.values[i]; } d[i] = -1; } else { @@ -138,12 +138,12 @@ void SPDashSelector::init_dashes() { pos += 1; } } else { // This code may never execute - a new preferences.xml is created for a new user. Maybe if the user deletes dashes from preferences.xml? - dashes = g_new (double *, bd_len + 2); // +1 for custom slot, +1 for terminator slot - int i; - for(i=0;i