[Libreoffice-commits] core.git: oox/source
Stephan Bergmann
sbergman at redhat.com
Thu Sep 7 15:01:16 UTC 2017
oox/source/drawingml/lineproperties.cxx | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
New commits:
commit 2f902237f59d13a7f0db1d6734e6083acc7fb009
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Thu Sep 7 17:00:41 2017 +0200
Replace macro with lambda
Change-Id: I47810e067d9dab0e40b5b1583193c01ad8c91759
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index c30f4537302b..534bc2a0cb9a 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -242,11 +242,11 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap,
TODO: this can be optimized by using a map. */
if( !rPropMap.hasNamedLineMarkerInTable( aMarkerName ) )
{
-// pass X and Y as percentage to OOX_ARROW_POINT
-#define OOX_ARROW_POINT( x, y ) awt::Point( static_cast< sal_Int32 >( fArrowWidth * ( x ) ), static_cast< sal_Int32 >( fArrowLength * ( y ) ) )
+ // pass X and Y as percentage to OOX_ARROW_POINT
+ auto OOX_ARROW_POINT = [fArrowLength, fArrowWidth]( double x, double y ) { return awt::Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) ); };
// tdf#100491 Arrow line marker, unlike other markers, depends on line width.
// So calculate width of half line (more convenient during drawing) taking into account
- // further conversions/scaling done in OOX_ARROW_POINT macro and scaling to nMarkerWidth.
+ // further conversions/scaling done in OOX_ARROW_POINT and scaling to nMarkerWidth.
const double fArrowLineHalfWidth = ::std::max< double >( 100.0 * 0.5 * nLineWidth / nMarkerWidth, 1 );
::std::vector< awt::Point > aPoints;
@@ -301,7 +301,6 @@ void lclPushMarkerProperties( ShapePropertyMap& rPropMap,
aPoints.push_back( OOX_ARROW_POINT( 50, 0 ) );
break;
}
-#undef OOX_ARROW_POINT
OSL_ENSURE( !aPoints.empty(), "lclPushMarkerProperties - missing arrow coordinates" );
if( !aPoints.empty() )
More information about the Libreoffice-commits
mailing list