diff options
| author | bulia byak <buliabyak@gmail.com> | 2007-08-24 02:19:06 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2007-08-24 02:19:06 +0000 |
| commit | d564e6cf1476c8402e8310f087f09970bd5f7f61 (patch) | |
| tree | 6c4cb81b3b90e6943bdf7a07553c92887a33de82 /src/display/sodipodi-ctrlrect.cpp | |
| parent | do not redraw until moved for the first time; this fixes the flicker at 0,0 w... (diff) | |
| download | inkscape-d564e6cf1476c8402e8310f087f09970bd5f7f61.tar.gz inkscape-d564e6cf1476c8402e8310f087f09970bd5f7f61.zip | |
initialize rect to 0,0,0,0 and do not redraw until dimensions are set; this removes another reason for flicker at 0.0
(bzr r3578)
Diffstat (limited to 'src/display/sodipodi-ctrlrect.cpp')
| -rw-r--r-- | src/display/sodipodi-ctrlrect.cpp | 112 |
1 files changed, 60 insertions, 52 deletions
diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index 05449f2bb..1eee3a860 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -171,7 +171,9 @@ void CtrlRect::init() _shadow = 0; _area.x0 = _area.y0 = 0; - _area.x1 = _area.y1 = -1; + _area.x1 = _area.y1 = 0; + + _rect = NR::Rect(NR::Point(0,0),NR::Point(0,0)); _shadow_size = 0; @@ -183,7 +185,8 @@ void CtrlRect::init() void CtrlRect::render(SPCanvasBuf *buf) { - if ((_area.x0 < buf->rect.x1) && + if ((_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) && + (_area.x0 < buf->rect.x1) && (_area.y0 < buf->rect.y1) && ((_area.x1 + _shadow_size) >= buf->rect.x0) && ((_area.y1 + _shadow_size) >= buf->rect.y0)) { @@ -222,28 +225,30 @@ void CtrlRect::update(NR::Matrix const &affine, unsigned int flags) sp_canvas_item_reset_bounds(this); - /* Request redraw old */ - if (!_has_fill) { - /* Top */ - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x1 + 1, _area.y0 + 1); - /* Left */ - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x0 + 1, _area.y1 + 1); - /* Right */ - sp_canvas_request_redraw(canvas, - _area.x1 - 1, _area.y0 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); - /* Bottom */ - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y1 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); - } else { - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + if (_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) { + /* Request redraw old */ + if (!_has_fill) { + /* Top */ + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y0 - 1, + _area.x1 + 1, _area.y0 + 1); + /* Left */ + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y0 - 1, + _area.x0 + 1, _area.y1 + 1); + /* Right */ + sp_canvas_request_redraw(canvas, + _area.x1 - 1, _area.y0 - 1, + _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + /* Bottom */ + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y1 - 1, + _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + } else { + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y0 - 1, + _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + } } NR::Rect bbox(_rect.min() * affine, _rect.max() * affine); @@ -254,35 +259,38 @@ void CtrlRect::update(NR::Matrix const &affine, unsigned int flags) _area.y1 = (int) floor(bbox.max()[NR::Y] + 0.5); _shadow_size = _shadow; - - /* Request redraw new */ - if (!_has_fill) { - /* Top */ - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x1 + 1, _area.y0 + 1); - /* Left */ - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x0 + 1, _area.y1 + 1); - /* Right */ - sp_canvas_request_redraw(canvas, - _area.x1 - 1, _area.y0 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); - /* Bottom */ - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y1 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); - } else { - sp_canvas_request_redraw(canvas, - _area.x0 - 1, _area.y0 - 1, - _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + + if (_area.x0 != 0 || _area.x1 != 0 || _area.y0 != 0 || _area.y1 != 0) { + /* Request redraw new */ + if (!_has_fill) { + /* Top */ + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y0 - 1, + _area.x1 + 1, _area.y0 + 1); + /* Left */ + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y0 - 1, + _area.x0 + 1, _area.y1 + 1); + /* Right */ + sp_canvas_request_redraw(canvas, + _area.x1 - 1, _area.y0 - 1, + _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + /* Bottom */ + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y1 - 1, + _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + } else { + sp_canvas_request_redraw(canvas, + _area.x0 - 1, _area.y0 - 1, + _area.x1 + _shadow_size + 1, _area.y1 + _shadow_size + 1); + } + + x1 = _area.x0 - 1; + y1 = _area.y0 - 1; + x2 = _area.x1 + _shadow_size + 1; + y2 = _area.y1 + _shadow_size + 1; } - - x1 = _area.x0 - 1; - y1 = _area.y0 - 1; - x2 = _area.x1 + _shadow_size + 1; - y2 = _area.y1 + _shadow_size + 1; + } |
