canvas/source/directx/dx_canvashelper.cxx | 33 +++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-)
New commits: commit ec73a21bccf4a055ae9dc575dbad3d67c91f481e Author: Luboš Luňák <l.lu...@centrum.cz> AuthorDate: Fri May 7 09:50:21 2021 +0000 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Fri May 7 14:30:25 2021 +0200 set also dashing cap style for directx canvas (tdf#136957) Change-Id: I7022ffba519faad5a333d7ef6eabf1ba5f0ae3bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115232 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/canvas/source/directx/dx_canvashelper.cxx b/canvas/source/directx/dx_canvashelper.cxx index de4969c6dd48..2ca2e09e2d35 100644 --- a/canvas/source/directx/dx_canvashelper.cxx +++ b/canvas/source/directx/dx_canvashelper.cxx @@ -51,7 +51,7 @@ namespace dxcanvas { namespace { - Gdiplus::LineCap gdiCapFromCap( sal_Int8 nCapType ) + Gdiplus::LineCap gdiLineCapFromCap( sal_Int8 nCapType ) { switch( nCapType ) { @@ -66,12 +66,35 @@ namespace dxcanvas default: ENSURE_OR_THROW( false, - "gdiCapFromCap(): Unexpected cap type" ); + "gdiLineCapFromCap(): Unexpected cap type" ); } return Gdiplus::LineCapFlat; } + Gdiplus::DashCap gdiDashCapFromCap( sal_Int8 nCapType ) + { + switch( nCapType ) + { + case rendering::PathCapType::BUTT: + return Gdiplus::DashCapFlat; + + case rendering::PathCapType::ROUND: + return Gdiplus::DashCapRound; + + // Gdiplus does not know square, using flat would make short + // dashes disappear, so use triangle as the closest one. + case rendering::PathCapType::SQUARE: + return Gdiplus::DashCapTriangle; + + default: + ENSURE_OR_THROW( false, + "gdiDashCapFromCap(): Unexpected cap type" ); + } + + return Gdiplus::DashCapFlat; + } + Gdiplus::LineJoin gdiJoinFromJoin( sal_Int8 nJoinType ) { switch( nJoinType ) @@ -368,9 +391,9 @@ namespace dxcanvas aPen.SetDashPattern( rDashArray.data(), rDashArray.size() ); } - aPen.SetLineCap( gdiCapFromCap(strokeAttributes.StartCapType), - gdiCapFromCap(strokeAttributes.EndCapType), - Gdiplus::DashCapFlat ); + aPen.SetLineCap( gdiLineCapFromCap(strokeAttributes.StartCapType), + gdiLineCapFromCap(strokeAttributes.EndCapType), + gdiDashCapFromCap(strokeAttributes.StartCapType)); if(!bIsNone) aPen.SetLineJoin( gdiJoinFromJoin(strokeAttributes.JoinType) ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits