From 0800a454f230fb7a029c88b0ab14bd9bb8a72bf1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 31 Oct 2008 22:43:30 -0500 Subject: Merge from trunk (bzr r6890) --- src/extension/internal/cairo-renderer.cpp | 21 +++++++++++++-------- src/extension/internal/odf.cpp | 2 +- src/sp-shape.cpp | 10 ++++++++-- 3 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index af9c3cd6e..5d6315894 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -446,19 +446,23 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) TRACE(("sp_asbitmap_render: resolution: %f\n", res )); // Get the bounding box of the selection in document coordinates. - NRRect bbox(item->getBounds(sp_item_i2d_affine(item), SPItem::RENDERING_BBOX )); + boost::optional bbox = + item->getBounds(sp_item_i2d_affine(item), SPItem::RENDERING_BBOX); + + if (!bbox) // no bbox, e.g. empty group + return; // The width and height of the bitmap in pixels - unsigned width = (unsigned) floor ((bbox.x1 - bbox.x0) * (res / PX_PER_IN)); - unsigned height =(unsigned) floor ((bbox.y1 - bbox.y0) * (res / PX_PER_IN)); + unsigned width = (unsigned) floor ((bbox->max()[Geom::X] - bbox->min()[Geom::X]) * (res / PX_PER_IN)); + unsigned height =(unsigned) floor ((bbox->max()[Geom::Y] - bbox->min()[Geom::Y]) * (res / PX_PER_IN)); // Scale to exactly fit integer bitmap inside bounding box - double scale_x = (bbox.x1 - bbox.x0) / width; - double scale_y = (bbox.y1 - bbox.y0) / height; + double scale_x = (bbox->max()[Geom::X] - bbox->min()[Geom::X]) / width; + double scale_y = (bbox->max()[Geom::Y] - bbox->min()[Geom::Y]) / height; // Location of bounding box in document coordinates. - double shift_x = bbox.x0; - double shift_y = bbox.y1; + double shift_x = bbox->min()[Geom::X]; + double shift_y = bbox->max()[Geom::Y]; // For default 90 dpi, snap bitmap to pixel grid if (res == PX_PER_IN) { @@ -483,7 +487,8 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) items = g_slist_append(items, item); GdkPixbuf *pb = sp_generate_internal_bitmap(document, NULL, - bbox.x0, bbox.y0, bbox.x1, bbox.y1, width, height, res, res, (guint32) 0xffffff00, items ); + bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], + width, height, res, res, (guint32) 0xffffff00, items ); if (pb) { TEST(gdk_pixbuf_save( pb, "bitmap.png", "png", NULL, NULL )); diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index a74e17a10..2e0082832 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -1496,7 +1496,7 @@ writePath(Writer &outs, Geom::PathVector const &pathv, // convert the path to only lineto's and cubic curveto's: Geom::PathVector pv = pathv_to_linear_and_cubic_beziers(pathv * tf * Geom::Translate(xoff, yoff) * Geom::Scale(1000.)); - for (Geom::PathVector::const_iterator pit = pathv.begin(); pit != pathv.end(); ++pit) { + for (Geom::PathVector::const_iterator pit = pv.begin(); pit != pv.end(); ++pit) { double destx = pit->initialPoint()[X]; double desty = pit->initialPoint()[Y]; diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index bf8fd2003..2a23b1115 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -171,6 +171,10 @@ sp_shape_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *rep if (((SPObjectClass *) (parent_class))->build) { (*((SPObjectClass *) (parent_class))->build) (object, document, repr); } + + for (int i = 0 ; i < SP_MARKER_LOC_QTY ; i++) { + sp_shape_set_marker (object, i, object->style->marker[i].value); + } } /** @@ -196,10 +200,11 @@ sp_shape_release (SPObject *object) for (i=SP_MARKER_LOC_START; imarker[i]) { - sp_signal_disconnect_by_data (shape->marker[i], object); for (v = item->display; v != NULL; v = v->next) { sp_marker_hide ((SPMarker *) shape->marker[i], NR_ARENA_ITEM_GET_KEY (v->arenaitem) + i); } + shape->release_connect[i].disconnect(); + shape->modified_connect[i].disconnect(); shape->marker[i] = sp_object_hunref (shape->marker[i], object); } } @@ -894,7 +899,8 @@ sp_shape_marker_release (SPObject *marker, SPShape *shape) /* nr_arena_item_set_mask (v->arenaitem, NULL); */ } /* Detach marker */ - sp_signal_disconnect_by_data (shape->marker[i], item); + shape->release_connect[i].disconnect(); + shape->modified_connect[i].disconnect(); shape->marker[i] = sp_object_hunref (shape->marker[i], item); } } -- cgit v1.2.3