From 1b8b972f1e0d6ee32c1f85514ec334c654d1e29c Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 22:39:07 +0200 Subject: Partial fix for bug 172063 while we find a better solution for XOR in helper lines (bzr r15090) --- src/display/canvas-bpath.cpp | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'src/display/canvas-bpath.cpp') 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(sp_canvas_bpath_parent_class)->update) { reinterpret_cast(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(); } -- cgit v1.2.3 From b0285abe2d1329a012c116f359551a40112708df Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 29 Aug 2016 22:52:05 +0200 Subject: Decrease contrast of phantom bpath (bzr r15091) --- src/display/canvas-bpath.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/display/canvas-bpath.cpp') diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index fd10a96f5..fc6b79b43 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -133,7 +133,7 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) } if (dostroke && cbp->phantom_line) { - ink_cairo_set_source_rgba32(buf->ct, 0xffffff7f); + ink_cairo_set_source_rgba32(buf->ct, 0xffffff4d); 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); -- cgit v1.2.3