From 3a397e8ee01a91cfb79ab8221fb4273d4f935510 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Fri, 24 Aug 2007 01:58:15 +0000 Subject: [PATCH] do not redraw until moved for the first time; this fixes the flicker at 0,0 whenever a new ctrl is created --- src/display/sodipodi-ctrl.cpp | 4 ++++ src/display/sodipodi-ctrl.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 71786fd96..27f53633c 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -104,6 +104,7 @@ sp_ctrl_init (SPCtrl *ctrl) ctrl->stroked = 0; ctrl->fill_color = 0x000000ff; ctrl->stroke_color = 0x000000ff; + ctrl->_moved = false; ctrl->box.x0 = ctrl->box.y0 = ctrl->box.x1 = ctrl->box.y1 = 0; ctrl->cache = NULL; @@ -204,6 +205,8 @@ sp_ctrl_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags sp_canvas_item_reset_bounds (item); + if (!ctrl->_moved) return; + if (ctrl->shown) { sp_canvas_request_redraw (item->canvas, ctrl->box.x0, ctrl->box.y0, ctrl->box.x1 + 1, ctrl->box.y1 + 1); } @@ -491,4 +494,5 @@ sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf) void SPCtrl::moveto (NR::Point const p) { sp_canvas_item_affine_absolute (SP_CANVAS_ITEM (this), NR::Matrix(NR::translate (p))); + _moved = true; } diff --git a/src/display/sodipodi-ctrl.h b/src/display/sodipodi-ctrl.h index c0e584ce2..2b2254d14 100644 --- a/src/display/sodipodi-ctrl.h +++ b/src/display/sodipodi-ctrl.h @@ -47,6 +47,7 @@ struct SPCtrl : public SPCanvasItem{ guint stroked : 1; guint32 fill_color; guint32 stroke_color; + bool _moved; NRRectL box; /* NB! x1 & y1 are included */ guchar *cache; -- 2.30.2