diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-12 16:02:57 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2018-09-12 16:02:57 +0000 |
| commit | 197d4156fb11ec3e608d04e656a7b9e841c341d8 (patch) | |
| tree | 148f0e5a97cac35451983625eb028f94fc4556d0 /src/helper | |
| parent | More caching in prefs (diff) | |
| parent | Allow adding new properties (diff) | |
| download | inkscape-197d4156fb11ec3e608d04e656a7b9e841c341d8.tar.gz inkscape-197d4156fb11ec3e608d04e656a7b9e841c341d8.zip | |
Merge branch 'master' of gitlab.com:inkscape/inkscape
Diffstat (limited to 'src/helper')
| -rw-r--r-- | src/helper/pixbuf-ops.cpp | 9 | ||||
| -rw-r--r-- | src/helper/png-write.cpp | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index a79efdbdd..93ea8bc98 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -27,6 +27,7 @@ #include "object/sp-defs.h" #include "object/sp-use.h" #include "util/units.h" +#include "inkscape.h" #include "helper/pixbuf-ops.h" @@ -111,13 +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)); - double padding = 1.0; - - Geom::Point origin(screen.min()[Geom::X], - doc->getHeight().value("px") - screen[Geom::Y].extent() - screen.min()[Geom::Y]); - - origin[Geom::X] = origin[Geom::X] + (screen[Geom::X].extent() * ((1 - padding) / 2)); - origin[Geom::Y] = origin[Geom::Y] + (screen[Geom::Y].extent() * ((1 - padding) / 2)); + Geom::Point origin = screen.min() * SP_ACTIVE_DESKTOP->doc2dt(); 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); diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index 92fdc3648..fe5412c4e 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -31,6 +31,8 @@ #include "rdf.h" #include "util/units.h" +#include "inkscape.h" + #include "object/sp-item.h" #include "object/sp-root.h" #include "object/sp-defs.h" @@ -425,8 +427,13 @@ ExportResult sp_export_png_file(SPDocument *doc, gchar const *filename, doc->ensureUpToDate(); + Geom::Affine dt2doc; + if (SP_ACTIVE_DESKTOP) { + dt2doc = SP_ACTIVE_DESKTOP->dt2doc(); + } + /* Calculate translation by transforming to document coordinates (flipping Y)*/ - Geom::Point translation = Geom::Point(-area[Geom::X][0], area[Geom::Y][1] - doc->getHeight().value("px")); + Geom::Point translation = -(area * dt2doc).min(); /* This calculation is only valid when assumed that (x0,y0)= area.corner(0) and (x1,y1) = area.corner(2) * 1) a[0] * x0 + a[2] * y1 + a[4] = 0.0 |
