void CtrlRect::update(Geom::Matrix const &affine, unsigned int flags)
{
    if (((SPCanvasItemClass *) parent_class)->update) {
        ((SPCanvasItemClass *) parent_class)->update(this, affine, flags);
    }

    sp_canvas_item_reset_bounds(this);

    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);
        }
    }

    Geom::Rect bbox(_rect.min() * affine, _rect.max() * affine);

    _area.x0 = (int) floor(bbox.min()[Geom::X] + 0.5);
    _area.y0 = (int) floor(bbox.min()[Geom::Y] + 0.5);
    _area.x1 = (int) floor(bbox.max()[Geom::X] + 0.5);
    _area.y1 = (int) floor(bbox.max()[Geom::Y] + 0.5);

    _shadow_size = _shadow;

    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;
    }
}
Пример #2
0
static void
sp_canvas_arena_request_render (NRArena *arena, NRRectL *area, void *data)
{
	sp_canvas_request_redraw (SP_CANVAS_ITEM (data)->canvas, area->x0, area->y0, area->x1, area->y1);
}