index 67f9354d8cac97085e57fc87b6f18d90cbc29df8..bc3c6c4848b6c9fbd795e4e8cb9c2a5baae0af89 100644 (file)
Geom::OptRect bbox =
item->getBounds(item->i2d_affine(), SPItem::RENDERING_BBOX);
Geom::OptRect bbox =
item->getBounds(item->i2d_affine(), SPItem::RENDERING_BBOX);
- if (!bbox) // no bbox, e.g. empty group
+ // no bbox, e.g. empty group
+ if (!bbox) {
return;
return;
+ }
+
+ Geom::Rect docrect(Geom::Rect(Geom::Point(0, 0), SP_OBJECT(item)->document->getDimensions()));
+ Geom::Rect bboxrect(Geom::Rect(Geom::Point(bbox->min()[Geom::X], bbox->min()[Geom::Y]), Geom::Point(bbox->max()[Geom::X], bbox->max()[Geom::Y])));
+
+ Geom::OptRect _bbox = Geom::intersect(docrect, bboxrect);
+
+ // assign the object dimension clipped on the document, no need to draw on area not on canvas
+ bbox = _bbox;
+
+ // no bbox, e.g. empty group
+ if (!bbox) {
+ return;
+ }
// The width and height of the bitmap in pixels
unsigned width = (unsigned) floor ((bbox->max()[Geom::X] - bbox->min()[Geom::X]) * (res / PX_PER_IN));
// The width and height of the bitmap in pixels
unsigned width = (unsigned) floor ((bbox->max()[Geom::X] - bbox->min()[Geom::X]) * (res / PX_PER_IN));