summaryrefslogtreecommitdiffstats
path: root/svx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-10-07 17:30:06 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-10-07 17:51:37 +0200
commit981ae9f89a2762fb36fe0ac3fee6826f11425de3 (patch)
tree03a84380739c99d1f17af95b35ec11f2ec9094db /svx
parentAvoid clang-analyzer-deadcode.DeadStores (diff)
downloadcore-981ae9f89a2762fb36fe0ac3fee6826f11425de3.tar.gz
core-981ae9f89a2762fb36fe0ac3fee6826f11425de3.zip
Avoid clang-analyzer-deadcode.DeadStores
...in case future modifications to SdrCaptionObj::TRSetBaseGeometry /will/ make use of fRotate. Change-Id: I25480efcbf1fede4af7241c4627dbfa7981793ed
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdocapt.cxx30
1 files changed, 22 insertions, 8 deletions
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 <sal/config.h>
+
+#include <cassert>
+
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
@@ -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);