summaryrefslogtreecommitdiffstats
path: root/canvas
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@centrum.cz>2021-05-07 09:50:21 +0000
committerAndras Timar <andras.timar@collabora.com>2021-05-16 23:47:22 +0200
commit03556252f8fd2f8112f010443c315747c6e32804 (patch)
tree670f031d53f040b100cbdc696efed3e07337fc4e /canvas
parenttdf#138518 sw: layout: fix assert on ooo43913-1.doc (diff)
downloadcore-03556252f8fd2f8112f010443c315747c6e32804.tar.gz
core-03556252f8fd2f8112f010443c315747c6e32804.zip
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.lunak@collabora.com> (cherry picked from commit ec73a21bccf4a055ae9dc575dbad3d67c91f481e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115202 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/directx/dx_canvashelper.cxx33
1 files changed, 28 insertions, 5 deletions
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) );