diff options
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 11 | ||||
| -rw-r--r-- | src/helper/pixbuf-ops.cpp | 14 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 83cb58e43..c521d2791 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -451,7 +451,7 @@ 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 desktop coordinates. - Geom::OptRect bbox = item->desktopVisualBounds(); + Geom::OptRect bbox = item->documentVisualBounds(); // no bbox, e.g. empty group if (!bbox) { @@ -478,23 +478,22 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) // Location of bounding box in document coordinates. double shift_x = bbox->min()[Geom::X]; - double shift_y = bbox->max()[Geom::Y]; + double shift_y = bbox->top(); // For default 96 dpi, snap bitmap to pixel grid if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { shift_x = round (shift_x); - shift_y = -round (-shift_y); // Correct rounding despite coordinate inversion. - // Remove the negations when the inversion is gone. + shift_y = round (shift_y); } // Calculate the matrix that will be applied to the image so that it exactly overlaps the source objects // Matix to put bitmap in correct place on document - Geom::Affine t_on_document = (Geom::Affine)(Geom::Scale (scale_x, -scale_y)) * + Geom::Affine t_on_document = (Geom::Affine)(Geom::Scale (scale_x, scale_y)) * (Geom::Affine)(Geom::Translate (shift_x, shift_y)); // ctx matrix already includes item transformation. We must substract. - Geom::Affine t_item = item->i2dt_affine (); + Geom::Affine t_item = item->i2doc_affine(); Geom::Affine t = t_on_document * t_item.inverse(); // Do the export diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 93ea8bc98..daada34c3 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -83,12 +83,12 @@ bool sp_export_jpg_file(SPDocument *doc, gchar const *filename, /** generates a bitmap from given items the bitmap is stored in RAM and not written to file - @param x0 - @param y0 - @param x1 - @param y1 - @param width - @param height + @param x0 area left in document coordinates + @param y0 area top in document coordinates + @param x1 area right in document coordinates + @param y1 area bottom in document coordinates + @param width bitmap width in pixels + @param height bitmap height in pixels @param xdpi @param ydpi @return the created GdkPixbuf structure or NULL if no memory is allocable @@ -112,7 +112,7 @@ Inkscape::Pixbuf *sp_generate_internal_bitmap(SPDocument *doc, gchar const */*fi Geom::Rect screen=Geom::Rect(Geom::Point(x0,y0), Geom::Point(x1, y1)); - Geom::Point origin = screen.min() * SP_ACTIVE_DESKTOP->doc2dt(); + Geom::Point origin = screen.min(); Geom::Scale scale(Inkscape::Util::Quantity::convert(xdpi, "px", "in"), Inkscape::Util::Quantity::convert(ydpi, "px", "in")); Geom::Affine affine = scale * Geom::Translate(-origin * scale); |
