summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3188572)
raw | patch | inline | side by side (parent: 3188572)
author | Alvin Penner <penner@vaxxine.com> | |
Tue, 25 Jan 2011 00:02:40 +0000 (19:02 -0500) | ||
committer | Alvin Penner <penner@vaxxine.com> | |
Tue, 25 Jan 2011 00:02:40 +0000 (19:02 -0500) |
src/extension/internal/emf-win32-inout.cpp | patch | blob | history |
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index 34cdecdcae44a063d0a98a8ff89c1704fd7d4e77..d147a0c81c92a1f7aa40ab50dcdfdf5eb70a2e2b 100644 (file)
namespace Extension {
namespace Internal {
+static float device_scale = DEVICESCALE;
EmfWin32::EmfWin32 (void) // The null constructor
{
double ppy = _pix_y_to_point(d, py);
double x = ppx * d->dc[d->level].worldTransform.eM11 + ppy * d->dc[d->level].worldTransform.eM21 + d->dc[d->level].worldTransform.eDx;
- x *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : DEVICESCALE;
+ x *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : device_scale;
return x;
}
double ppy = _pix_y_to_point(d, py);
double y = ppx * d->dc[d->level].worldTransform.eM12 + ppy * d->dc[d->level].worldTransform.eM22 + d->dc[d->level].worldTransform.eDy;
- y *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : DEVICESCALE;
+ y *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : device_scale;
return y;
}
double ppy = 0;
double dx = ppx * d->dc[d->level].worldTransform.eM11 + ppy * d->dc[d->level].worldTransform.eM21;
- dx *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : DEVICESCALE;
+ dx *= d->dc[d->level].ScaleOutX ? d->dc[d->level].ScaleOutX : device_scale;
double dy = ppx * d->dc[d->level].worldTransform.eM12 + ppy * d->dc[d->level].worldTransform.eM22;
- dy *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : DEVICESCALE;
+ dy *= d->dc[d->level].ScaleOutY ? d->dc[d->level].ScaleOutY : device_scale;
double tmp = sqrt(dx * dx + dy * dy);
return tmp;
@@ -785,14 +786,18 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *
d->xDPI = 2540;
d->yDPI = 2540;
- d->dc[d->level].PixelsInX = pEmr->rclFrame.right - pEmr->rclFrame.left;
- d->dc[d->level].PixelsInY = pEmr->rclFrame.bottom - pEmr->rclFrame.top;
+ d->dc[d->level].PixelsInX = pEmr->rclFrame.right; // - pEmr->rclFrame.left;
+ d->dc[d->level].PixelsInY = pEmr->rclFrame.bottom; // - pEmr->rclFrame.top;
d->MMX = d->dc[d->level].PixelsInX / 100.0;
d->MMY = d->dc[d->level].PixelsInY / 100.0;
d->dc[d->level].PixelsOutX = d->MMX * PX_PER_MM;
d->dc[d->level].PixelsOutY = d->MMY * PX_PER_MM;
+
+ // calculate ratio of Inkscape dpi/device dpi
+ if (pEmr->szlMillimeters.cx && pEmr->szlDevice.cx)
+ device_scale = PX_PER_MM*pEmr->szlMillimeters.cx/pEmr->szlDevice.cx;
tmp_outsvg <<
" width=\"" << d->MMX << "mm\"\n" <<
@@ -1071,8 +1076,8 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *
d->dc[d->level].ScaleOutY = (double) d->dc[d->level].PixelsOutY / (double) d->dc[d->level].sizeView.cy;
}
else {
- d->dc[d->level].ScaleOutX = DEVICESCALE;
- d->dc[d->level].ScaleOutY = DEVICESCALE;
+ d->dc[d->level].ScaleOutX = device_scale;
+ d->dc[d->level].ScaleOutY = device_scale;
}
break;
@@ -1122,8 +1127,8 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *
d->dc[d->level].ScaleOutY = (double) d->dc[d->level].PixelsOutY / (double) d->dc[d->level].sizeView.cy;
}
else {
- d->dc[d->level].ScaleOutX = DEVICESCALE;
- d->dc[d->level].ScaleOutY = DEVICESCALE;
+ d->dc[d->level].ScaleOutX = device_scale;
+ d->dc[d->level].ScaleOutY = device_scale;
}
break;