+static void svg_get_dash(gfx_node_t *node, svg_dash *d)
+{
+ double offset;
+ int mult;
+ if (node->dash_on <= 0 || node->dash_off <= 0) {
+ d->dash_enable = 0;
+ return;
+ }
+ d->dash_enable = 1;
+ d->dash_len = node->dash_on + node->dash_off;
+ /* dash on/off adjustment due to round caps */
+ d->dash_adjust = 0.8 * node->size;
+ d->adjusted_on = node->dash_on - d->dash_adjust;
+ if (d->adjusted_on < 0.01)
+ d->adjusted_on = 0.01;
+ d->adjusted_off = d->dash_len - d->adjusted_on;
+ /* dash offset calc */
+ if (node->path[0].x == node->path[1].x) /* only good for horz/vert lines */
+ offset = node->path[0].y;
+ else
+ offset = node->path[0].x;
+ mult = (int)fabs(offset / d->dash_len);
+ d->dash_offset = offset - mult * d->dash_len;
+ if (node->path[0].x < node->path[1].x || node->path[0].y < node->path[1].y)
+ d->dash_offset = d->dash_len - d->dash_offset;
+}
+