[Libreoffice-commits] core.git: include/svx svx/source
Michael Stahl
mstahl at redhat.com
Wed Jul 29 05:04:47 PDT 2015
include/svx/svdtrans.hxx | 6 ------
svx/source/svdraw/svddrgmt.cxx | 2 +-
svx/source/svdraw/svdoole2.cxx | 4 ++--
svx/source/svdraw/svdtrans.cxx | 33 ---------------------------------
4 files changed, 3 insertions(+), 42 deletions(-)
New commits:
commit 00269d39f655bb0ecb38c043a9516b4faefe6708
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Jul 29 13:51:49 2015 +0200
svx: remove duplicate "Kuerzen" function
Change-Id: I319ba12684398bcdfcd8d8ede1648e1d213e75a7
diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx
index f70bfed..e54c745 100644
--- a/include/svx/svdtrans.hxx
+++ b/include/svx/svdtrans.hxx
@@ -249,12 +249,6 @@ SVX_DLLPUBLIC void OrthoDistance4(const Point& rPt0, Point& rPt, bool bBigOrtho)
// Calculation and intermediate values are in BigInt
SVX_DLLPUBLIC long BigMulDiv(long nVal, long nMul, long nDiv);
-// Lossy cancellation of a fraction
-// nDigits specifies, how many significant digits the numerator
-// and denominator should at least be retained
-void Kuerzen(Fraction& rF, unsigned nDigits);
-
-
class FrPair {
Fraction aX;
Fraction aY;
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 52cce9c..aa445de 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -2422,7 +2422,7 @@ void SdrDragShear::MoveSdrDrag(const Point& rPnt)
bResize=true;
double nCos=cos(nTmpAngle*nPi180);
aNeuFact=nCos;
- Kuerzen(aFact,10); // three decimals should be enough
+ aFact.ReduceInaccurate(10); // three decimals should be enough
}
if (nNewAngle>8900)
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 3dff9dd..b0988d8 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -2225,8 +2225,8 @@ bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHei
aScaleHeight = Fraction(aSize.Height(), aObjAreaSize.Height() );
// reduce to 10 binary digits
- Kuerzen(aScaleHeight, 10);
- Kuerzen(aScaleWidth, 10);
+ aScaleHeight.ReduceInaccurate(10);
+ aScaleWidth.ReduceInaccurate(10);
return true;
}
diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx
index 476b4be..424cb91 100644
--- a/svx/source/svdraw/svdtrans.cxx
+++ b/svx/source/svdraw/svdtrans.cxx
@@ -584,39 +584,6 @@ long BigMulDiv(long nVal, long nMul, long nDiv)
return 0x7fffffff;
}
-void Kuerzen(Fraction& rF, unsigned nDigits)
-{
- sal_Int32 nMul=rF.GetNumerator();
- sal_Int32 nDiv=rF.GetDenominator();
- bool bNeg = false;
- if (nMul<0) { nMul=-nMul; bNeg=!bNeg; }
- if (nDiv<0) { nDiv=-nDiv; bNeg=!bNeg; }
- if (nMul==0 || nDiv==0) return;
- sal_uInt32 a;
- a=sal_uInt32(nMul); unsigned nMulZ=0; // count leading zeros
- while (a<0x00800000) { nMulZ+=8; a<<=8; }
- while (a<0x80000000) { nMulZ++; a<<=1; }
- a=sal_uInt32(nDiv); unsigned nDivZ=0; // count leading zeros
- while (a<0x00800000) { nDivZ+=8; a<<=8; }
- while (a<0x80000000) { nDivZ++; a<<=1; }
- // count the number of digits
- int nMulDigits=32-nMulZ;
- int nDivDigits=32-nDivZ;
- // count how many decimal places can be removed
- int nMulWeg=nMulDigits-nDigits; if (nMulWeg<0) nMulWeg=0;
- int nDivWeg=nDivDigits-nDigits; if (nDivWeg<0) nDivWeg=0;
- int nWeg=std::min(nMulWeg,nDivWeg);
- nMul>>=nWeg;
- nDiv>>=nWeg;
- if (nMul==0 || nDiv==0) {
- DBG_WARNING("Math error after canceling decimal places.");
- return;
- }
- if (bNeg) nMul=-nMul;
- rF=Fraction(nMul,nDiv);
-}
-
-
// How many eU units fit into a mm, respectively an inch?
// Or: How many mm, respectively inches, are there in an eU (and then give me the inverse)
More information about the Libreoffice-commits
mailing list