summaryrefslogtreecommitdiff
path: root/svx/source/xoutdev/_xpoly.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-21 15:49:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-22 12:15:38 +0100
commit3fbbd74b7bc6aef4af5f0c4b23a73a6726b9afbf (patch)
treeb3a0df75c42a93645f5342863a7291c871e520eb /svx/source/xoutdev/_xpoly.cxx
parent4b7490fe49bb93f895e974602a2616fa80b74019 (diff)
loplugin:flatten in svx
Change-Id: Idc4d0186ecc6f0722c2b1358486a2430f037ae29 Reviewed-on: https://gerrit.libreoffice.org/45036 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/xoutdev/_xpoly.cxx')
-rw-r--r--svx/source/xoutdev/_xpoly.cxx96
1 files changed, 48 insertions, 48 deletions
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index e8ea3ee0392a..2fdc6f028ab5 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -666,26 +666,26 @@ void XPolygon::CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNex
{
double fAbsLen = CalcDistance(nNext, nPrev);
- if ( fAbsLen )
- {
- const Point& rCenter = pImpXPolygon->pPointAry[nCenter];
- Point& rNext = pImpXPolygon->pPointAry[nNext];
- Point& rPrev = pImpXPolygon->pPointAry[nPrev];
- Point aDiff = rNext - rPrev;
- double fNextLen = CalcDistance(nCenter, nNext) / fAbsLen;
- double fPrevLen = CalcDistance(nCenter, nPrev) / fAbsLen;
+ if ( !fAbsLen )
+ return;
- // same length for both sides if SYMMTR
- if ( GetFlags(nCenter) == PolyFlags::Symmetric )
- {
- fPrevLen = (fNextLen + fPrevLen) / 2;
- fNextLen = fPrevLen;
- }
- rNext.X() = rCenter.X() + (long) (fNextLen * aDiff.X());
- rNext.Y() = rCenter.Y() + (long) (fNextLen * aDiff.Y());
- rPrev.X() = rCenter.X() - (long) (fPrevLen * aDiff.X());
- rPrev.Y() = rCenter.Y() - (long) (fPrevLen * aDiff.Y());
+ const Point& rCenter = pImpXPolygon->pPointAry[nCenter];
+ Point& rNext = pImpXPolygon->pPointAry[nNext];
+ Point& rPrev = pImpXPolygon->pPointAry[nPrev];
+ Point aDiff = rNext - rPrev;
+ double fNextLen = CalcDistance(nCenter, nNext) / fAbsLen;
+ double fPrevLen = CalcDistance(nCenter, nPrev) / fAbsLen;
+
+ // same length for both sides if SYMMTR
+ if ( GetFlags(nCenter) == PolyFlags::Symmetric )
+ {
+ fPrevLen = (fNextLen + fPrevLen) / 2;
+ fNextLen = fPrevLen;
}
+ rNext.X() = rCenter.X() + (long) (fNextLen * aDiff.X());
+ rNext.Y() = rCenter.Y() + (long) (fNextLen * aDiff.Y());
+ rPrev.X() = rCenter.X() - (long) (fPrevLen * aDiff.X());
+ rPrev.Y() = rCenter.Y() - (long) (fPrevLen * aDiff.Y());
}
/// convert four polygon points into a Bézier curve
@@ -793,39 +793,39 @@ void XPolygon::Distort(const tools::Rectangle& rRefRect,
Wr = rRefRect.GetWidth();
Hr = rRefRect.GetHeight();
- if ( Wr && Hr )
- {
- long X1, X2, X3, X4;
- long Y1, Y2, Y3, Y4;
- DBG_ASSERT(rDistortedRect.pImpXPolygon->nPoints >= 4,
- "Distort: rectangle to small");
+ if ( !Wr || !Hr )
+ return;
- X1 = rDistortedRect[0].X();
- Y1 = rDistortedRect[0].Y();
- X2 = rDistortedRect[1].X();
- Y2 = rDistortedRect[1].Y();
- X3 = rDistortedRect[3].X();
- Y3 = rDistortedRect[3].Y();
- X4 = rDistortedRect[2].X();
- Y4 = rDistortedRect[2].Y();
+ long X1, X2, X3, X4;
+ long Y1, Y2, Y3, Y4;
+ DBG_ASSERT(rDistortedRect.pImpXPolygon->nPoints >= 4,
+ "Distort: rectangle to small");
- sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+ X1 = rDistortedRect[0].X();
+ Y1 = rDistortedRect[0].Y();
+ X2 = rDistortedRect[1].X();
+ Y2 = rDistortedRect[1].Y();
+ X3 = rDistortedRect[3].X();
+ Y3 = rDistortedRect[3].Y();
+ X4 = rDistortedRect[2].X();
+ Y4 = rDistortedRect[2].Y();
- for (sal_uInt16 i = 0; i < nPntCnt; i++)
- {
- double fTx, fTy, fUx, fUy;
- Point& rPnt = pImpXPolygon->pPointAry[i];
-
- fTx = (double)(rPnt.X() - Xr) / Wr;
- fTy = (double)(rPnt.Y() - Yr) / Hr;
- fUx = 1.0 - fTx;
- fUy = 1.0 - fTy;
-
- rPnt.X() = (long) ( fUy * (fUx * X1 + fTx * X2) +
- fTy * (fUx * X3 + fTx * X4) );
- rPnt.Y() = (long) ( fUx * (fUy * Y1 + fTy * Y3) +
- fTx * (fUy * Y2 + fTy * Y4) );
- }
+ sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
+
+ for (sal_uInt16 i = 0; i < nPntCnt; i++)
+ {
+ double fTx, fTy, fUx, fUy;
+ Point& rPnt = pImpXPolygon->pPointAry[i];
+
+ fTx = (double)(rPnt.X() - Xr) / Wr;
+ fTy = (double)(rPnt.Y() - Yr) / Hr;
+ fUx = 1.0 - fTx;
+ fUy = 1.0 - fTy;
+
+ rPnt.X() = (long) ( fUy * (fUx * X1 + fTx * X2) +
+ fTy * (fUx * X3 + fTx * X4) );
+ rPnt.Y() = (long) ( fUx * (fUy * Y1 + fTy * Y3) +
+ fTx * (fUy * Y2 + fTy * Y4) );
}
}