summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2014-03-11 21:35:40 +0000
committerJabiertxof <jtx@jtx.marker.es>2014-03-11 21:35:40 +0000
commitf1a9da5054b58970118be15fafeec021fb225200 (patch)
tree021f563b4cd15cd646ef55843ed101ec2c316e8e /src/widgets
parentupdate to trunk (diff)
parentChange stroke-dasharray and stroke-dashoffset handling to match other propert... (diff)
downloadinkscape-f1a9da5054b58970118be15fafeec021fb225200.tar.gz
inkscape-f1a9da5054b58970118be15fafeec021fb225200.zip
update to trunk
(bzr r11950.1.290)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dash-selector.cpp20
-rw-r--r--src/widgets/stroke-style.cpp14
2 files changed, 17 insertions, 17 deletions
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<Glib::ustring>::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<bd_len;i++) {
+ dashes = g_new (double *, BD_LEN + 2); // +1 for custom slot, +1 for terminator slot
+ unsigned i;
+ for(i=0;i<BD_LEN;i++) {
dashes[i] = builtin_dashes[i];
}
- pos = bd_len;
+ pos = BD_LEN;
}
// make a place to hold the custom dashes, up to 15 positions long (+ terminator)
dashes[pos] = g_new (double, 16);
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index dbfb1bcd2..9567f81ba 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -727,18 +727,18 @@ StrokeStyle::getItemColorForMarker(SPItem *item, Inkscape::PaintTarget fill_or_s
void
StrokeStyle::setDashSelectorFromStyle(SPDashSelector *dsel, SPStyle *style)
{
- if (style->stroke_dash.n_dash > 0) {
+ if (!style->stroke_dasharray.values.empty()) {
double d[64];
- int len = MIN(style->stroke_dash.n_dash, 64);
- for (int i = 0; i < len; i++) {
+ size_t len = MIN(style->stroke_dasharray.values.size(), 64);
+ for (unsigned i = 0; i < len; i++) {
if (style->stroke_width.computed != 0)
- d[i] = style->stroke_dash.dash[i] / style->stroke_width.computed;
+ d[i] = style->stroke_dasharray.values[i] / style->stroke_width.computed;
else
- d[i] = style->stroke_dash.dash[i]; // is there a better thing to do for stroke_width==0?
+ d[i] = style->stroke_dasharray.values[i]; // is there a better thing to do for stroke_width==0?
}
dsel->set_dash(len, d, style->stroke_width.computed != 0 ?
- style->stroke_dash.offset / style->stroke_width.computed :
- style->stroke_dash.offset);
+ style->stroke_dashoffset.value / style->stroke_width.computed :
+ style->stroke_dashoffset.value);
} else {
dsel->set_dash(0, NULL, 0.0);
}