From 58ec679b9d1ff061aaf62f7db3fa8e7954c89a44 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 22 Oct 2013 09:24:40 +0200 Subject: Fix for Bug #1230292 (dbus service file not included in tarball when doing a make dist) by Ryan Lerch. Fixed bugs: - https://launchpad.net/bugs/1230292 (bzr r12710) --- src/extension/dbus/Makefile_insert | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/dbus/Makefile_insert b/src/extension/dbus/Makefile_insert index a5eb3fdf4..7d851715e 100644 --- a/src/extension/dbus/Makefile_insert +++ b/src/extension/dbus/Makefile_insert @@ -12,7 +12,8 @@ ink_common_sources += \ extension/dbus/application-interface.cpp \ extension/dbus/application-interface.h \ extension/dbus/document-interface.cpp \ - extension/dbus/document-interface.h + extension/dbus/document-interface.h \ + extension/dbus/org.inkscape.service.in ########################### # Build DBus wrapper files -- cgit v1.2.3 From 85d006da1275720a89d55688f74b5a152b42f701 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Tue, 22 Oct 2013 09:58:06 +0200 Subject: Fixing unit convertion in PNG import Imagemagick fallback (see Bug #165952). (bzr r12711) --- src/extension/internal/image-resolution.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index b38b0ddc7..865e86698 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -342,9 +342,16 @@ void ImageResolution::readmagick(char const *fn) { image.read(fn); } catch (...) {} Magick::Geometry geo = image.density(); + std::string type = image.magick(); + + if (type == "PNG") { // PNG only supports pixelspercentimeter + x_ = Inkscape::Util::Quantity::convert((double)geo.width(), "in", "cm"); + y_ = Inkscape::Util::Quantity::convert((double)geo.height(), "in", "cm"); + } else { + x_ = (double)geo.width(); + y_ = (double)geo.height(); + } - x_ = Inkscape::Util::Quantity::convert((double)geo.width(), "pt", "px"); - y_ = Inkscape::Util::Quantity::convert((double)geo.height(), "pt", "px"); ok_ = true; } -- cgit v1.2.3 From 651b367a2e01f918435d829394baff45537f6b91 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Thu, 24 Oct 2013 17:03:01 +0200 Subject: fix bug "some of the locale-based templates cause objects to be resized when default units are changed" #1236257 Fixed bugs: - https://launchpad.net/bugs/1236257 (bzr r12717) --- src/extension/internal/cdr-input.cpp | 2 +- src/extension/internal/emf-inout.cpp | 9 +++++---- src/extension/internal/gdkpixbuf-input.cpp | 2 +- src/extension/internal/pdf-input-cairo.cpp | 2 +- src/extension/internal/pdfinput/pdf-input.cpp | 2 +- src/extension/internal/vsd-input.cpp | 2 +- src/extension/internal/wmf-inout.cpp | 5 +++-- src/extension/internal/wpg-input.cpp | 2 +- 8 files changed, 14 insertions(+), 12 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 517d6fb9c..04087e268 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -258,7 +258,7 @@ SPDocument *CdrInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u SPDocument * doc = SPDocument::createNewDocFromMem(tmpSVGOutput[page_num-1].cstr(), strlen(tmpSVGOutput[page_num-1].cstr()), TRUE); // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } return doc; } diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index f1876c687..ab03f832f 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -3497,12 +3497,13 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // Set document unit Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr(); Inkscape::SVGOStringStream os; - os << doc->getWidth().unit->abbr; + Inkscape::Util::Unit const* doc_unit = doc->getWidth().unit; + os << doc_unit->abbr; repr->setAttribute("inkscape:document-units", os.str().c_str()); - + // Set viewBox - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); - + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc_unit), doc->getHeight().value(doc_unit))); + // Scale and translate objects double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit); ShapeEditor::blockSetItem(true); diff --git a/src/extension/internal/gdkpixbuf-input.cpp b/src/extension/internal/gdkpixbuf-input.cpp index 13267ee2b..6d159d265 100644 --- a/src/extension/internal/gdkpixbuf-input.cpp +++ b/src/extension/internal/gdkpixbuf-input.cpp @@ -105,7 +105,7 @@ GdkpixbufInput::open(Inkscape::Extension::Input *mod, char const *uri) // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } // restore undo, as now this document may be shown to the user if a bitmap was opened diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index adac0d6c9..f47fbaf87 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -626,7 +626,7 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } delete output; diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp index 213550688..3155ac098 100644 --- a/src/extension/internal/pdfinput/pdf-input.cpp +++ b/src/extension/internal/pdfinput/pdf-input.cpp @@ -750,7 +750,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } // Restore undo diff --git a/src/extension/internal/vsd-input.cpp b/src/extension/internal/vsd-input.cpp index 42a9e3d41..6fc79237b 100644 --- a/src/extension/internal/vsd-input.cpp +++ b/src/extension/internal/vsd-input.cpp @@ -258,7 +258,7 @@ SPDocument *VsdInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } return doc; diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index d69d46f20..208077cd1 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -3185,11 +3185,12 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) // Set document unit Inkscape::XML::Node *repr = sp_document_namedview(doc, 0)->getRepr(); Inkscape::SVGOStringStream os; - os << doc->getWidth().unit->abbr; + Inkscape::Util::Unit const* doc_unit = doc->getWidth().unit; + os << doc_unit->abbr; repr->setAttribute("inkscape:document-units", os.str().c_str()); // Set viewBox - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc_unit), doc->getHeight().value(doc_unit))); // Scale and translate objects double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit); diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index ac86a6171..b5eb3ce8f 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -114,7 +114,7 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u // Set viewBox if it doesn't exist if (!doc->getRoot()->viewBox_set) { - doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().quantity, doc->getHeight().quantity)); + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } delete input; -- cgit v1.2.3 From 28c2b3040acb1984f352e1672ed65fa78fe44dde Mon Sep 17 00:00:00 2001 From: David Mathog Date: Thu, 24 Oct 2013 23:32:31 +0200 Subject: Fix for Bug 1243937 (EMF import, diagram obscured by full page rectangle) Fixed bugs: - https://launchpad.net/bugs/1243937 (bzr r12720) --- src/extension/internal/emf-inout.cpp | 1 + src/extension/internal/wmf-inout.cpp | 3 +++ 2 files changed, 4 insertions(+) (limited to 'src/extension') diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index ab03f832f..f4b26d4f0 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -2859,6 +2859,7 @@ std::cout << "BEFORE DRAW" if (!pEmr->cbBmiSrc) { // should be an application of a DIBPATTERNBRUSHPT, use a solid color instead + if(pEmr->dwRop == U_NOOP)break; /* GDI applications apparently often end with this as a sort of flush(), nothing should be drawn */ int32_t dx = pEmr->Dest.x; int32_t dy = pEmr->Dest.y; int32_t dw = pEmr->cDest.x; diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index 208077cd1..f98890809 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -2284,6 +2284,7 @@ std::cout << "BEFORE DRAW" dbg_str << "\n"; nSize = U_WMRBITBLT_get(contents,&Dst,&cwh,&Src,&dwRop3,&Bm16,&px); if(!px){ + if(dwRop3 == U_NOOP)break; /* GDI applications apparently often end with this as a sort of flush(), nothing should be drawn */ int32_t dx = Dst.x; int32_t dy = Dst.y; int32_t dw = cwh.x; @@ -2321,6 +2322,7 @@ std::cout << "BEFORE DRAW" dbg_str << "\n"; nSize = U_WMRSTRETCHBLT_get(contents,&Dst,&cDst,&Src,&cSrc,&dwRop3,&Bm16,&px); if(!px){ + if(dwRop3 == U_NOOP)break; /* GDI applications apparently often end with this as a sort of flush(), nothing should be drawn */ int32_t dx = Dst.x; int32_t dy = Dst.y; int32_t dw = cDst.x; @@ -2715,6 +2717,7 @@ std::cout << "BEFORE DRAW" if (!dib) { // should be an application of a DIBPATTERNBRUSHPT, use a solid color instead + if(dwRop3 == U_NOOP)break; /* GDI applications apparently often end with this as a sort of flush(), nothing should be drawn */ int32_t dx = Dst.x; int32_t dy = Dst.y; int32_t dw = cwh.x; -- cgit v1.2.3 From db4a12935328ae0ac1ce6230aa0b5f5e5ed43ee5 Mon Sep 17 00:00:00 2001 From: David Mathog Date: Thu, 24 Oct 2013 23:35:44 +0200 Subject: Fix for Bug 1242927 (minor EMF import issues) Fixed bugs: - https://launchpad.net/bugs/1242927 (bzr r12721) --- src/extension/internal/emf-inout.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/extension') diff --git a/src/extension/internal/emf-inout.cpp b/src/extension/internal/emf-inout.cpp index f4b26d4f0..36d7ca145 100644 --- a/src/extension/internal/emf-inout.cpp +++ b/src/extension/internal/emf-inout.cpp @@ -789,8 +789,12 @@ Emf::output_style(PEMF_CALLBACK_DATA d, int iType) // Assume src color is "white" if(d->dwRop3){ switch(d->dwRop3){ - case U_PATINVERT: // treat all of these as black - case U_SRCINVERT: + case U_PATINVERT: // invert pattern + fill_rgb[0] = 1.0 - fill_rgb[0]; + fill_rgb[1] = 1.0 - fill_rgb[1]; + fill_rgb[2] = 1.0 - fill_rgb[2]; + break; + case U_SRCINVERT: // treat all of these as black case U_DSTINVERT: case U_BLACKNESS: case U_SRCERASE: @@ -799,7 +803,6 @@ Emf::output_style(PEMF_CALLBACK_DATA d, int iType) break; case U_SRCCOPY: // treat all of these as white case U_NOTSRCERASE: - case U_PATCOPY: case U_WHITENESS: fill_rgb[0]=fill_rgb[1]=fill_rgb[2]=1.0; break; @@ -808,6 +811,7 @@ Emf::output_style(PEMF_CALLBACK_DATA d, int iType) case U_MERGECOPY: case U_MERGEPAINT: case U_PATPAINT: + case U_PATCOPY: default: break; } @@ -2747,7 +2751,10 @@ std::cout << "BEFORE DRAW" { dbg_str << "\n"; // The next line should never be needed, should have been handled before main switch - *(d->path) = ""; + // qualifier added because EMF's encountered where moveto preceded beginpath followed by lineto + if(d->mask & U_DRAW_VISIBLE){ + *(d->path) = ""; + } d->mask |= emr_mask; break; } -- cgit v1.2.3 From 2f052e8e6d08abe6764fd071eb5c647b2fbbbf6f Mon Sep 17 00:00:00 2001 From: David Mathog Date: Fri, 25 Oct 2013 21:35:21 +0200 Subject: WMF import: fix scaling of files without ViewPort record (see bug 1241783, comment 4-5) Fixed bugs: - https://launchpad.net/bugs/1241783 (bzr r12725) --- src/extension/internal/wmf-inout.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/wmf-inout.cpp b/src/extension/internal/wmf-inout.cpp index f98890809..2e55dcb1e 100644 --- a/src/extension/internal/wmf-inout.cpp +++ b/src/extension/internal/wmf-inout.cpp @@ -1970,7 +1970,9 @@ std::cout << "BEFORE DRAW" } if (!d->dc[d->level].sizeView.x || !d->dc[d->level].sizeView.y) { - d->dc[d->level].sizeView = d->dc[d->level].sizeWnd; + /* Previously it used sizeWnd, but that always resulted in scale = 1 if no viewport ever appeared, and in most files, it did not */ + d->dc[d->level].sizeView.x = d->PixelsInX - 1; + d->dc[d->level].sizeView.y = d->PixelsInY - 1; } /* scales logical to WMF pixels, transfer a negative sign on Y, if any */ -- cgit v1.2.3 From 4d1c93817e978cd43c61428e6b527de24163a776 Mon Sep 17 00:00:00 2001 From: David Mathog Date: Fri, 25 Oct 2013 21:36:57 +0200 Subject: Fix for Bug 1241783 (WMF image output size) Fixed bugs: - https://launchpad.net/bugs/1241783 (bzr r12726) --- src/extension/internal/wmf-print.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/extension') diff --git a/src/extension/internal/wmf-print.cpp b/src/extension/internal/wmf-print.cpp index cf0302b38..3bb17146c 100644 --- a/src/extension/internal/wmf-print.cpp +++ b/src/extension/internal/wmf-print.cpp @@ -1120,6 +1120,9 @@ unsigned int PrintWmf::image( Geom::Point pLL(x1, y1); Geom::Point pLL2 = pLL * tf; //location of LL corner in Inkscape coordinates + Geom::Point pWH(dw, dh); + Geom::Point pWH2 = pWH * tf.withoutTranslation(); //adjust scale + char *px; uint32_t cbPx; uint32_t colortype; @@ -1133,7 +1136,7 @@ unsigned int PrintWmf::image( Bmi = bitmapinfo_set(Bmih, ct); U_POINT16 Dest = point16_set(round(pLL2[Geom::X] * PX2WORLD), round(pLL2[Geom::Y] * PX2WORLD)); - U_POINT16 cDest = point16_set(round(dw * PX2WORLD), round(dh * PX2WORLD)); + U_POINT16 cDest = point16_set(round(pWH2[Geom::X] * PX2WORLD), round(pWH2[Geom::Y] * PX2WORLD)); U_POINT16 Src = point16_set(0, 0); U_POINT16 cSrc = point16_set(w, h); rec = U_WMRSTRETCHDIB_set( -- cgit v1.2.3