From 981ae9f89a2762fb36fe0ac3fee6826f11425de3 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Wed, 7 Oct 2015 17:30:06 +0200 Subject: Avoid clang-analyzer-deadcode.DeadStores ...in case future modifications to SdrCaptionObj::TRSetBaseGeometry /will/ make use of fRotate. Change-Id: I25480efcbf1fede4af7241c4627dbfa7981793ed --- svx/source/svdraw/svdocapt.cxx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 52d37e74b8b5..b7f6b5e5874d 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include + #include #include #include @@ -761,6 +765,23 @@ SdrObject* SdrCaptionObj::DoConvertToPolyObj(bool bBezier, bool bAddText) const return pRet; } +namespace { + +void handleNegativeScale(basegfx::B2DTuple & scale, double * rotate) { + assert(rotate != nullptr); + + // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings + // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly + if(basegfx::fTools::less(scale.getX(), 0.0) && basegfx::fTools::less(scale.getY(), 0.0)) + { + scale.setX(fabs(scale.getX())); + scale.setY(fabs(scale.getY())); + *rotate = fmod(*rotate + F_PI, F_2PI); + } +} + +} + // #i32599# // Add own implementation for TRSetBaseGeometry to handle TailPos over changes. void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& /*rPolyPolygon*/) @@ -771,14 +792,7 @@ void SdrCaptionObj::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, cons double fRotate, fShearX; rMatrix.decompose(aScale, aTranslate, fRotate, fShearX); - // #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings - // in X and Y which equal a 180 degree rotation. Recognize it and react accordingly - if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0)) - { - aScale.setX(fabs(aScale.getX())); - aScale.setY(fabs(aScale.getY())); - fRotate = fmod(fRotate + F_PI, F_2PI); - } + handleNegativeScale(aScale, &fRotate); // force metric to pool metric SfxMapUnit eMapUnit = pModel->GetItemPool().GetMetric(0); -- cgit