Logo Search packages:      
Sourcecode: inkscape version File versions

static void sp_canvas_group_update ( SPCanvasItem item,
Geom::Matrix const &  affine,
unsigned int  flags 
) [static]

Update handler for canvas groups

Definition at line 775 of file sp-canvas.cpp.

References SPCanvasGroup::items, sp_canvas_item_invoke_update(), SPCanvasItem::x1, SPCanvasItem::x2, SPCanvasItem::y1, and SPCanvasItem::y2.

Referenced by sp_canvas_group_class_init().

{
    SPCanvasGroup const *group = SP_CANVAS_GROUP (item);
    Geom::RectHull corners(Geom::Point(0, 0));
    bool empty=true;

    for (GList *list = group->items; list; list = list->next) {
        SPCanvasItem *i = (SPCanvasItem *)list->data;

        sp_canvas_item_invoke_update (i, affine, flags);

        if ( i->x2 > i->x1 && i->y2 > i->y1 ) {
            if (empty) {
                corners = Geom::RectHull(Geom::Point(i->x1, i->y1));
                empty = false;
            } else {
                corners.add(Geom::Point(i->x1, i->y1));
            }
            corners.add(Geom::Point(i->x2, i->y2));
        }
    }

    Geom::OptRect const bounds = corners.bounds();
    if (bounds) {
        item->x1 = bounds->min()[Geom::X];
        item->y1 = bounds->min()[Geom::Y];
        item->x2 = bounds->max()[Geom::X];
        item->y2 = bounds->max()[Geom::Y];
    } else {
        // FIXME ?
        item->x1 = item->x2 = item->y1 = item->y2 = 0;
    }
}


Generated by  Doxygen 1.6.0   Back to index