summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-08-29 20:39:07 +0000
committerjabiertxof <info@marker.es>2016-08-29 20:39:07 +0000
commit1b8b972f1e0d6ee32c1f85514ec334c654d1e29c (patch)
tree49e23896ee567d33e7c5dcaf31ecb7402cf80673 /src/display
parentFix a bug in pattern along path at first edit node after applied. Backport it... (diff)
downloadinkscape-1b8b972f1e0d6ee32c1f85514ec334c654d1e29c.tar.gz
inkscape-1b8b972f1e0d6ee32c1f85514ec334c654d1e29c.zip
Partial fix for bug 172063 while we find a better solution for XOR in helper lines
(bzr r15090)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/canvas-bpath.cpp34
-rw-r--r--src/display/canvas-bpath.h6
-rw-r--r--src/display/sp-ctrlline.cpp2
3 files changed, 29 insertions, 13 deletions
diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp
index 46b59d25a..fd10a96f5 100644
--- a/src/display/canvas-bpath.cpp
+++ b/src/display/canvas-bpath.cpp
@@ -53,6 +53,7 @@ sp_canvas_bpath_init (SPCanvasBPath * bpath)
bpath->stroke_linejoin = SP_STROKE_LINEJOIN_MITER;
bpath->stroke_linecap = SP_STROKE_LINECAP_BUTT;
bpath->stroke_miterlimit = 11.0;
+ bpath->phantom_line = false;
}
static void sp_canvas_bpath_destroy(SPCanvasItem *object)
@@ -71,7 +72,7 @@ static void sp_canvas_bpath_update(SPCanvasItem *item, Geom::Affine const &affin
{
SPCanvasBPath *cbp = SP_CANVAS_BPATH(item);
- item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
+ item->canvas->requestRedraw((int)item->x1 - 1, (int)item->y1 - 1, (int)item->x2 + 1 , (int)item->y2 + 1);
if (reinterpret_cast<SPCanvasItemClass *>(sp_canvas_bpath_parent_class)->update) {
reinterpret_cast<SPCanvasItemClass *>(sp_canvas_bpath_parent_class)->update(item, affine, flags);
@@ -86,10 +87,10 @@ static void sp_canvas_bpath_update(SPCanvasItem *item, Geom::Affine const &affin
Geom::OptRect bbox = bounds_exact_transformed(cbp->curve->get_pathvector(), affine);
if (bbox) {
- item->x1 = (int)bbox->min()[Geom::X] - 1;
- item->y1 = (int)bbox->min()[Geom::Y] - 1;
- item->x2 = (int)bbox->max()[Geom::X] + 1;
- item->y2 = (int)bbox->max()[Geom::Y] + 1;
+ item->x1 = (int)floor(bbox->min()[Geom::X]) - 1;
+ item->y1 = (int)floor(bbox->min()[Geom::Y]) - 1;
+ item->x2 = (int)ceil(bbox->max()[Geom::X]) + 1;
+ item->y2 = (int)ceil(bbox->max()[Geom::Y]) + 1;
} else {
item->x1 = 0;
item->y1 = 0;
@@ -131,7 +132,21 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf)
cairo_fill_preserve(buf->ct);
}
- if (dostroke) {
+ if (dostroke && cbp->phantom_line) {
+ ink_cairo_set_source_rgba32(buf->ct, 0xffffff7f);
+ cairo_set_line_width(buf->ct, 2);
+ if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) {
+ cairo_set_dash (buf->ct, cbp->dashes, 2, 0);
+ }
+ cairo_stroke(buf->ct);
+ cairo_set_tolerance(buf->ct, 0.5);
+ cairo_new_path(buf->ct);
+ feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area,
+ /* optimized_stroke = */ !dofill, 1);
+ ink_cairo_set_source_rgba32(buf->ct, cbp->stroke_rgba);
+ cairo_set_line_width(buf->ct, 1);
+ cairo_stroke(buf->ct);
+ } else if (dostroke) {
ink_cairo_set_source_rgba32(buf->ct, cbp->stroke_rgba);
cairo_set_line_width(buf->ct, 1);
if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) {
@@ -167,24 +182,25 @@ sp_canvas_bpath_point (SPCanvasItem *item, Geom::Point p, SPCanvasItem **actual_
}
SPCanvasItem *
-sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve)
+sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve, bool phantom_line)
{
g_return_val_if_fail (parent != NULL, NULL);
g_return_val_if_fail (SP_IS_CANVAS_GROUP (parent), NULL);
SPCanvasItem *item = sp_canvas_item_new (parent, SP_TYPE_CANVAS_BPATH, NULL);
- sp_canvas_bpath_set_bpath (SP_CANVAS_BPATH (item), curve);
+ sp_canvas_bpath_set_bpath (SP_CANVAS_BPATH (item), curve, phantom_line);
return item;
}
void
-sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve)
+sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve, bool phantom_line)
{
g_return_if_fail (cbp != NULL);
g_return_if_fail (SP_IS_CANVAS_BPATH (cbp));
+ cbp->phantom_line = phantom_line;
if (cbp->curve) {
cbp->curve = cbp->curve->unref();
}
diff --git a/src/display/canvas-bpath.h b/src/display/canvas-bpath.h
index 72eca6eeb..686eb7c5a 100644
--- a/src/display/canvas-bpath.h
+++ b/src/display/canvas-bpath.h
@@ -80,7 +80,7 @@ struct SPCanvasBPath {
SPStrokeJoinType stroke_linejoin;
SPStrokeCapType stroke_linecap;
gdouble stroke_miterlimit;
-
+ bool phantom_line;
/* State */
Shape *fill_shp;
Shape *stroke_shp;
@@ -92,9 +92,9 @@ struct SPCanvasBPathClass {
GType sp_canvas_bpath_get_type (void);
-SPCanvasItem *sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve);
+SPCanvasItem *sp_canvas_bpath_new (SPCanvasGroup *parent, SPCurve *curve, bool phantom_line = false);
-void sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve);
+void sp_canvas_bpath_set_bpath (SPCanvasBPath *cbp, SPCurve *curve, bool phantom_line = false);
void sp_canvas_bpath_set_fill (SPCanvasBPath *cbp, guint32 rgba, SPWindRule rule);
void sp_canvas_bpath_set_stroke (SPCanvasBPath *cbp, guint32 rgba, gdouble width, SPStrokeJoinType join, SPStrokeCapType cap, double dash=0, double gap=0);
diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp
index 1bde540c0..6c5674935 100644
--- a/src/display/sp-ctrlline.cpp
+++ b/src/display/sp-ctrlline.cpp
@@ -84,7 +84,7 @@ void sp_ctrlline_render(SPCanvasItem *item, SPCanvasBuf *buf)
Geom::Point s = cl->s * cl->affine;
Geom::Point e = cl->e * cl->affine;
- ink_cairo_set_source_rgba32(buf->ct, 0xffffffbf);
+ ink_cairo_set_source_rgba32(buf->ct, 0xffffff7f);
cairo_set_line_width(buf->ct, 2);
cairo_new_path(buf->ct);