From 06eed5fc614250f08e9836c205d2131f4275e8ea Mon Sep 17 00:00:00 2001 From: buliabyak Date: Mon, 9 Mar 2009 00:42:26 +0000 Subject: [PATCH] for zero-length lines, do not request canvas redraw and do not attempt to draw --- src/display/sp-ctrlline.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp index be0b8d1c6..033c8d1f8 100644 --- a/src/display/sp-ctrlline.cpp +++ b/src/display/sp-ctrlline.cpp @@ -103,6 +103,9 @@ sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf) if (!buf->ct) return; + if (cl->s == cl->e) + return; + sp_canvas_prepare_buffer (buf); guint32 rgba = cl->rgba; @@ -134,15 +137,21 @@ sp_ctrlline_update (SPCanvasItem *item, Geom::Matrix const &affine, unsigned int cl->affine = affine; - Geom::Point s = cl->s * affine; - Geom::Point e = cl->e * affine; + if (cl->s == cl->e) { + item->x1 = item->x2 = item->y1 = item->y2 = 0; + } else { - item->x1 = round(MIN(s[Geom::X], e[Geom::X]) - 1); - item->y1 = round(MIN(s[Geom::Y], e[Geom::Y]) - 1); - item->x2 = round(MAX(s[Geom::X], e[Geom::X]) + 1); - item->y2 = round(MAX(s[Geom::Y], e[Geom::Y]) + 1); + Geom::Point s = cl->s * affine; + Geom::Point e = cl->e * affine; - sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); + item->x1 = round(MIN(s[Geom::X], e[Geom::X]) - 1); + item->y1 = round(MIN(s[Geom::Y], e[Geom::Y]) - 1); + item->x2 = round(MAX(s[Geom::X], e[Geom::X]) + 1); + item->y2 = round(MAX(s[Geom::Y], e[Geom::Y]) + 1); + + sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2); + + } } void -- 2.30.2