diff options
| author | Ted Gould <ted@gould.cx> | 2008-11-01 03:43:30 +0000 |
|---|---|---|
| committer | Ted Gould <ted@canonical.com> | 2008-11-01 03:43:30 +0000 |
| commit | 0800a454f230fb7a029c88b0ab14bd9bb8a72bf1 (patch) | |
| tree | 78f551f42f8331a8a4336bdc6a53fb88d6dfda92 /src/extension | |
| parent | Making it so that including simple-node.h will generate an error (diff) | |
| download | inkscape-0800a454f230fb7a029c88b0ab14bd9bb8a72bf1.tar.gz inkscape-0800a454f230fb7a029c88b0ab14bd9bb8a72bf1.zip | |
Merge from trunk
(bzr r6890)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 21 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 2 |
2 files changed, 14 insertions, 9 deletions
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<Geom::Rect> 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]; |
