Code

crop an item's bbox by its clippath bbox, if any
authorbuliabyak <buliabyak@users.sourceforge.net>
Mon, 6 Feb 2006 19:59:35 +0000 (19:59 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Mon, 6 Feb 2006 19:59:35 +0000 (19:59 +0000)
src/sp-item.cpp

index 6caa46f3016b9b1959c1bd7d92ec4f65e088f50c..ab241a0cde9f32b7c0f4fe997992fadd74918548 100644 (file)
@@ -503,6 +503,7 @@ clip_ref_changed(SPObject *old_clip, SPObject *clip, SPItem *item)
             nr_arena_item_set_clip(v->arenaitem, ai);
             nr_arena_item_unref(ai);
             sp_clippath_set_bbox(SP_CLIPPATH(clip), NR_ARENA_ITEM_GET_KEY(v->arenaitem), &bbox);
+            SP_OBJECT(clip)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
         }
     }
 }
@@ -678,6 +679,13 @@ sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, NR::Matrix const &tra
     if (((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox) {
         ((SPItemClass *) G_OBJECT_GET_CLASS(item))->bbox(item, bbox, transform, flags);
     }
+
+    // crop the bbox by clip path, if any
+    if (item->clip_ref->getObject()) {
+        NRRect b;
+        sp_clippath_get_bbox(SP_CLIPPATH(item->clip_ref->getObject()), &b, transform, flags);
+        nr_rect_d_intersect (bbox, bbox, &b);
+    }
 }
 
 unsigned sp_item_pos_in_parent(SPItem *item)