summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2017-05-07 02:57:26 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2017-05-07 18:59:22 +0200
commitff7f5e1bbd4a9a3e3fa3e4ddb349c97605dc8a01 (patch)
tree6d6848df2e9ce28b08a4684759e540d3862c6507
parent6483d363d1d8418a8c6bcf99f304161bee48d579 (diff)
tdf#31814 Introduce minimal value of line width to fix EMF+ import issues
Based on observation of different EMF+ files (eg. exported by ChemDraw), there is minimal value of line width. This commit is fixing all such import issues. Change-Id: I5c26a1b511363eb1e429bf770ad0f482b124ecb5 Reviewed-on: https://gerrit.libreoffice.org/37319 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
-rwxr-xr-xcppcanvas/source/mtfrenderer/emfppen.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/cppcanvas/source/mtfrenderer/emfppen.cxx b/cppcanvas/source/mtfrenderer/emfppen.cxx
index 03014b37b7a7..b3b0c97dcb8a 100755
--- a/cppcanvas/source/mtfrenderer/emfppen.cxx
+++ b/cppcanvas/source/mtfrenderer/emfppen.cxx
@@ -103,12 +103,16 @@ namespace cppcanvas
void EMFPPen::SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState)
{
-#if OSL_DEBUG_LEVEL > 1
- if (penWidth == 0.0) {
- SAL_INFO("cppcanvas.emf", "TODO: pen with zero width - using minimal which might not be correct");
- }
-#endif
+ // If a zero width is specified, a minimum value is used, which is determined by the units.
+ //TODO Add support for other units than Pixel
rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize(penWidth == 0.0 ? 0.05 : penWidth, 0)).getLength());
+
+ // tdf#31814 Based on observation of different EMF+ files (eg. exported by ChemDraw),
+ // there is minimal value of line width
+ if (rStrokeAttributes.StrokeWidth < 1.0)
+ {
+ rStrokeAttributes.StrokeWidth = 1.0;
+ }
}
/// Convert stroke caps between EMF+ and rendering API