diff options
| author | Sebastian Wüst <sebi@timewaster.de> | 2013-10-28 17:23:42 +0000 |
|---|---|---|
| committer | Sebastian Wüst <sebi@timewaster.de> | 2013-10-28 17:23:42 +0000 |
| commit | c6ad2a34d38795059888d3c900dbf1047bfd5fdd (patch) | |
| tree | 88de58a63003bd2ea6edda9c895d3c0466a38e6b /src/extension | |
| parent | text change (diff) | |
| parent | Fix for bug #1156394 (OCAL dialog: Close button in German localization contai... (diff) | |
| download | inkscape-c6ad2a34d38795059888d3c900dbf1047bfd5fdd.tar.gz inkscape-c6ad2a34d38795059888d3c900dbf1047bfd5fdd.zip | |
mrege from trunk
(bzr r12417.1.31)
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/dbus/Makefile_insert | 3 | ||||
| -rw-r--r-- | src/extension/internal/cdr-input.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/emf-inout.cpp | 36 | ||||
| -rw-r--r-- | src/extension/internal/gdkpixbuf-input.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/image-resolution.cpp | 11 | ||||
| -rw-r--r-- | src/extension/internal/pdf-input-cairo.cpp | 4 | ||||
| -rw-r--r-- | src/extension/internal/pdfinput/pdf-input.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/vsd-input.cpp | 2 | ||||
| -rw-r--r-- | src/extension/internal/wmf-inout.cpp | 25 | ||||
| -rw-r--r-- | src/extension/internal/wmf-print.cpp | 5 | ||||
| -rw-r--r-- | src/extension/internal/wpg-input.cpp | 4 |
11 files changed, 62 insertions, 37 deletions
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 diff --git a/src/extension/internal/cdr-input.cpp b/src/extension/internal/cdr-input.cpp index 517d6fb9c..0111ed626 100644 --- a/src/extension/internal/cdr-input.cpp +++ b/src/extension/internal/cdr-input.cpp @@ -256,9 +256,10 @@ 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)); + if (doc && !doc->getRoot()->viewBox_set) { + 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..c8c708051 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 << "<!-- U_EMR_BEGINPATH -->\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; } @@ -2859,6 +2866,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; @@ -3488,7 +3496,7 @@ Emf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.tri = trinfo_release_except_FC(d.tri); // Set viewBox if it doesn't exist - if (!doc->getRoot()->viewBox_set) { + if (doc && !doc->getRoot()->viewBox_set) { bool saved = Inkscape::DocumentUndo::getUndoSensitive(doc); Inkscape::DocumentUndo::setUndoSensitive(doc, false); @@ -3497,20 +3505,20 @@ 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))); + doc->ensureUpToDate(); + // Scale and translate objects - double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit); + double scale = Inkscape::Util::Quantity::convert(1, "px", doc_unit); ShapeEditor::blockSetItem(true); - doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, SP_ACTIVE_DOCUMENT->getHeight().value("px"))); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); ShapeEditor::blockSetItem(false); - - doc->ensureUpToDate(); - + Inkscape::DocumentUndo::setUndoSensitive(doc, saved); } 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/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; } diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp index adac0d6c9..c45367c08 100644 --- a/src/extension/internal/pdf-input-cairo.cpp +++ b/src/extension/internal/pdf-input-cairo.cpp @@ -625,8 +625,8 @@ PdfInputCairo::open(Inkscape::Extension::Input * /*mod*/, const gchar * uri) { SPDocument * doc = SPDocument::createNewDocFromMem(output->c_str(), output->length(), 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)); + if (doc && !doc->getRoot()->viewBox_set) { + 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..3f37e4402 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 */ @@ -2284,6 +2286,7 @@ std::cout << "BEFORE DRAW" dbg_str << "<!-- U_WMR_BITBLT -->\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 +2324,7 @@ std::cout << "BEFORE DRAW" dbg_str << "<!-- U_WMR_STRETCHBLT -->\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 +2719,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; @@ -3176,7 +3181,7 @@ Wmf::open( Inkscape::Extension::Input * /*mod*/, const gchar *uri ) d.tri = trinfo_release_except_FC(d.tri); // Set viewBox if it doesn't exist - if (!doc->getRoot()->viewBox_set) { + if (doc && !doc->getRoot()->viewBox_set) { bool saved = Inkscape::DocumentUndo::getUndoSensitive(doc); Inkscape::DocumentUndo::setUndoSensitive(doc, false); @@ -3185,20 +3190,20 @@ 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))); + doc->ensureUpToDate(); + // Scale and translate objects - double scale = Inkscape::Util::Quantity::convert(1, "px", doc->getWidth().unit); + double scale = Inkscape::Util::Quantity::convert(1, "px", doc_unit); ShapeEditor::blockSetItem(true); - doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, SP_ACTIVE_DOCUMENT->getHeight().value("px"))); + doc->getRoot()->scaleChildItemsRec(Geom::Scale(scale), Geom::Point(0, doc->getHeight().value("px"))); ShapeEditor::blockSetItem(false); - - doc->ensureUpToDate(); - + Inkscape::DocumentUndo::setUndoSensitive(doc, saved); } 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( diff --git a/src/extension/internal/wpg-input.cpp b/src/extension/internal/wpg-input.cpp index ac86a6171..14ff3ec77 100644 --- a/src/extension/internal/wpg-input.cpp +++ b/src/extension/internal/wpg-input.cpp @@ -113,8 +113,8 @@ SPDocument *WpgInput::open(Inkscape::Extension::Input * /*mod*/, const gchar * u SPDocument * doc = SPDocument::createNewDocFromMem(output.cstr(), strlen(output.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)); + if (doc && !doc->getRoot()->viewBox_set) { + doc->setViewBox(Geom::Rect::from_xywh(0, 0, doc->getWidth().value(doc->getDefaultUnit()), doc->getHeight().value(doc->getDefaultUnit()))); } delete input; |
