summaryrefslogtreecommitdiffstats
path: root/src/display/sp-canvas.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-08-24 02:24:09 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-08-24 02:24:09 +0000
commite49d72f6012f3bc7a23ad8e0a3ab968b0bb8b3f7 (patch)
tree8fe5c38e5e2ff68ef977ba97f716a78d9a683c0c /src/display/sp-canvas.cpp
parentinitialize rect to 0,0,0,0 and do not redraw until dimensions are set; this r... (diff)
downloadinkscape-e49d72f6012f3bc7a23ad8e0a3ab968b0bb8b3f7.tar.gz
inkscape-e49d72f6012f3bc7a23ad8e0a3ab968b0bb8b3f7.zip
do not request redraw if an item has zero dimensions; also remove redundant redraw in sp_canvas_item_construct
(bzr r3579)
Diffstat (limited to 'src/display/sp-canvas.cpp')
-rw-r--r--src/display/sp-canvas.cpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index e2550e8e7..c185e1a1c 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -202,8 +202,6 @@ sp_canvas_item_construct (SPCanvasItem *item, SPCanvasGroup *parent, const gchar
group_add (SP_CANVAS_GROUP (item->parent), item);
sp_canvas_item_request_update (item);
- sp_canvas_request_redraw (item->canvas, (int)(item->x1), (int)(item->y1), (int)(item->x2 + 1), (int)(item->y2 + 1));
- item->canvas->need_repick = TRUE;
}
/**
@@ -213,7 +211,14 @@ static void
redraw_if_visible (SPCanvasItem *item)
{
if (item->flags & SP_CANVAS_ITEM_VISIBLE) {
- sp_canvas_request_redraw (item->canvas, (int)(item->x1), (int)(item->y1), (int)(item->x2 + 1), (int)(item->y2 + 1));
+ int x0 = (int)(item->x1);
+ int x1 = (int)(item->x2);
+ int y0 = (int)(item->y1);
+ int y1 = (int)(item->y2);
+
+ if (x0 !=0 || x1 !=0 || y0 !=0 || y1 !=0) {
+ sp_canvas_request_redraw (item->canvas, (int)(item->x1), (int)(item->y1), (int)(item->x2 + 1), (int)(item->y2 + 1));
+ }
}
}
@@ -464,8 +469,15 @@ sp_canvas_item_show (SPCanvasItem *item)
item->flags |= SP_CANVAS_ITEM_VISIBLE;
- sp_canvas_request_redraw (item->canvas, (int)(item->x1), (int)(item->y1), (int)(item->x2 + 1), (int)(item->y2 + 1));
- item->canvas->need_repick = TRUE;
+ int x0 = (int)(item->x1);
+ int x1 = (int)(item->x2);
+ int y0 = (int)(item->y1);
+ int y1 = (int)(item->y2);
+
+ if (x0 !=0 || x1 !=0 || y0 !=0 || y1 !=0) {
+ sp_canvas_request_redraw (item->canvas, (int)(item->x1), (int)(item->y1), (int)(item->x2 + 1), (int)(item->y2 + 1));
+ item->canvas->need_repick = TRUE;
+ }
}
/**
@@ -482,8 +494,15 @@ sp_canvas_item_hide (SPCanvasItem *item)
item->flags &= ~SP_CANVAS_ITEM_VISIBLE;
- sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)(item->x2 + 1), (int)(item->y2 + 1));
- item->canvas->need_repick = TRUE;
+ int x0 = (int)(item->x1);
+ int x1 = (int)(item->x2);
+ int y0 = (int)(item->y1);
+ int y1 = (int)(item->y2);
+
+ if (x0 !=0 || x1 !=0 || y0 !=0 || y1 !=0) {
+ sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)(item->x2 + 1), (int)(item->y2 + 1));
+ item->canvas->need_repick = TRUE;
+ }
}
/**