[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - canvas/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 8 15:13:51 UTC 2021
canvas/source/directx/dx_canvashelper.cxx | 33 +++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
New commits:
commit c4813202f7eddc78c5c8d49a46f5434bc23547b1
Author: Luboš Luňák <l.lunak at centrum.cz>
AuthorDate: Fri May 7 09:50:21 2021 +0000
Commit: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
CommitDate: Sat May 8 17:13:19 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.lunak at collabora.com>
(cherry picked from commit ec73a21bccf4a055ae9dc575dbad3d67c91f481e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115202
Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.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) );
More information about the Libreoffice-commits
mailing list