diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-03-22 12:14:52 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-03-22 15:17:08 +0100 |
commit | ff8b9f6fca5784f62427302026642de0cdb1ef11 (patch) | |
tree | 67ba16fc1cb93f054580f25e3a390469d097fabd /vcl/source/gdi/lineinfo.cxx | |
parent | 7bc16436e28153dfdd01e8d49cd193f62098476c (diff) |
use dashing info from struct LineInfo in EPS writer (tdf#146804)
It had a random(?) hardcoded '2' as the dashing info. While at it,
I've also made few other places use the common implementation
of creating the dotdash array instead of doing it manually.
Change-Id: Id349ca138c98d08eef47dc0bfe6d162e03fc4a9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131932
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'vcl/source/gdi/lineinfo.cxx')
-rw-r--r-- | vcl/source/gdi/lineinfo.cxx | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/vcl/source/gdi/lineinfo.cxx b/vcl/source/gdi/lineinfo.cxx index 94ab3b83df65..85e7c041943e 100644 --- a/vcl/source/gdi/lineinfo.cxx +++ b/vcl/source/gdi/lineinfo.cxx @@ -204,6 +204,30 @@ SvStream& WriteLineInfo( SvStream& rOStm, const LineInfo& rLineInfo ) return rOStm; } +std::vector< double > LineInfo::GetDotDashArray() const +{ + ::std::vector< double > fDotDashArray; + if ( GetStyle() != LineStyle::Dash ) + return fDotDashArray; + + const double fDashLen(GetDashLen()); + const double fDotLen(GetDotLen()); + const double fDistance(GetDistance()); + + for(sal_uInt16 a(0); a < GetDashCount(); a++) + { + fDotDashArray.push_back(fDashLen); + fDotDashArray.push_back(fDistance); + } + + for(sal_uInt16 b(0); b < GetDotCount(); b++) + { + fDotDashArray.push_back(fDotLen); + fDotDashArray.push_back(fDistance); + } + return fDotDashArray; +} + void LineInfo::applyToB2DPolyPolygon( basegfx::B2DPolyPolygon& io_rLinePolyPolygon, basegfx::B2DPolyPolygon& o_rFillPolyPolygon) const @@ -215,23 +239,7 @@ void LineInfo::applyToB2DPolyPolygon( if(LineStyle::Dash == GetStyle()) { - ::std::vector< double > fDotDashArray; - const double fDashLen(GetDashLen()); - const double fDotLen(GetDotLen()); - const double fDistance(GetDistance()); - - for(sal_uInt16 a(0); a < GetDashCount(); a++) - { - fDotDashArray.push_back(fDashLen); - fDotDashArray.push_back(fDistance); - } - - for(sal_uInt16 b(0); b < GetDotCount(); b++) - { - fDotDashArray.push_back(fDotLen); - fDotDashArray.push_back(fDistance); - } - + ::std::vector< double > fDotDashArray = GetDotDashArray(); const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0)); if(fAccumulated > 0.0) |