diff options
author | Patrick Jaap <patrick.jaap@tu-dresden.de> | 2017-09-26 14:42:44 +0200 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-09-28 22:36:18 +0200 |
commit | 3b1db9b7a9afe147ed7f841c875bc3b91b03ace9 (patch) | |
tree | 4810a66cc13e65069fadddd7834bbddd965b4d99 | |
parent | 69c88654881a4aa0db05df9fb94e3d9e7dfbfa30 (diff) |
tdf#112012 EMF+ dashed lines: correct dash length
Since the first guess of the right transformation seemed to be wrong,
here is the next try. The pure float value is multiplied with the pen width.
This is way more intuitive for me and renders the EMF files from the
bugtracker exactly like in MSO.
See 588c5b0cff9bbdb2efbdfb259268154b0074e7e6 for the previous patch.
Change-Id: I74e82a0f9800d950e0d989184765a53e520b48e6
Reviewed-on: https://gerrit.libreoffice.org/42810
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r-- | drawinglayer/source/tools/emfphelperdata.cxx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index e95b243f7a0d..513b8fbce930 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -421,11 +421,13 @@ namespace emfplushelper if (pen->penDataFlags & 0x00000020 && pen->dashStyle != EmfPlusLineStyleCustom) // pen has a predefined line style { - // taken from the old cppcanvas implementation - const std::vector<double> dash = { 3, 3 }; - const std::vector<double> dot = { 1, 3 }; - const std::vector<double> dashdot = { 3, 3, 1, 3 }; - const std::vector<double> dashdotdot = { 3, 3, 1, 3, 1, 3 }; + // short writing + const double pw = transformedPenWidth; + // taken from the old cppcanvas implementation and multiplied with pen width + const std::vector<double> dash = { 3*pw, 3*pw }; + const std::vector<double> dot = { pw, 3*pw }; + const std::vector<double> dashdot = { 3*pw, 3*pw, pw, 3*pw }; + const std::vector<double> dashdotdot = { 3*pw, 3*pw, pw, 3*pw, pw, 3*pw }; drawinglayer::attribute::StrokeAttribute aStrokeAttribute; @@ -459,11 +461,8 @@ namespace emfplushelper std::vector<double> aPattern(pen->dashPattern.size()); for (size_t i=0; i<aPattern.size(); i++) { - aPattern[i] = 0.5 * MapSize(double(pen->dashPattern[i]),0).getX(); - // here, this is just a guess - // without transform it es way too small - // with 1 * MapSize(...) it es too large - // with 0.5 * MapSize is looks like in MSO + // convert from float to double and multiply with the adjusted pen width + aPattern[i] = transformedPenWidth * pen->dashPattern[i]; } drawinglayer::attribute::StrokeAttribute strokeAttribute(aPattern); mrTargetHolders.Current().append( |