summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-04-02 11:16:30 +0500
committerMike Kaganski <mike.kaganski@collabora.com>2024-04-03 16:41:59 +0200
commita3daf52dd21ae03a8b04e1f9132a6713c9cc414f (patch)
tree3da8eac339f92e9a22feb1449db9115e6bf02413 /svx
parent387a9c445793e8377f85e508d935dc070fd8ab74 (diff)
Base scale on 1.0, not on 100.0
Simplifies things by avoiding many repeated multiplications / divisions by 100 during calculations. Change-Id: Ib063d343549139c8d83e5b06570dc61f39ea0df6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165666 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdotext.cxx22
-rw-r--r--svx/source/svdraw/svdotextdecomposition.cxx2
-rw-r--r--svx/source/unodraw/unoshape.cxx8
3 files changed, 16 insertions, 16 deletions
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 526b4d8b0b8e..e66e8ad01459 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -929,8 +929,8 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS
tools::Long nXTolMi=nWantWdt/25; // tolerance: -4%
tools::Long nXCorr =nWantWdt/20; // correction scale: 5%
- double nX = (nWantWdt * 100.0) / double(nIsWdt); // calculate X stretching
- double nY = (nWantHgt * 100.0) / double(nIsHgt); // calculate Y stretching
+ double nX = nWantWdt / double(nIsWdt); // calculate X stretching
+ double nY = nWantHgt / double(nIsHgt); // calculate Y stretching
bool bChkX = true;
if (bNoStretching)
{ // might only be possible proportionally
@@ -949,14 +949,14 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS
{
if (nX < 0.0)
nX = -nX;
- if (nX < 1.0)
+ if (nX < 0.01)
{
- nX = 1.0;
+ nX = 0.01;
bNoMoreLoop = true;
}
- if (nX > 65535.0)
+ if (nX > 655.35)
{
- nX = 65535.0;
+ nX = 655.35;
bNoMoreLoop = true;
}
@@ -964,14 +964,14 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS
{
nY = -nY;
}
- if (nY < 1.0)
+ if (nY < 0.01)
{
- nY = 1.0;
+ nY = 0.01;
bNoMoreLoop = true;
}
- if (nY > 65535.0)
+ if (nY > 655.35)
{
- nY = 65535.0;
+ nY = 655.35;
bNoMoreLoop = true;
}
@@ -1276,7 +1276,7 @@ void SdrTextObj::setupAutoFitText(SdrOutliner& rOutliner, const Size& rTextBoxSi
if (fFontScale > 0.0 && fSpacingScale > 0.0 && !mbInEditMode)
{
- rOutliner.setScalingParameters({ fFontScale, fFontScale, 100.0, fSpacingScale });
+ rOutliner.setScalingParameters({ fFontScale, fFontScale, 1.0, fSpacingScale });
}
else
{
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index 7b94bfbc1093..a2582da5e885 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -1375,7 +1375,7 @@ void SdrTextObj::impDecomposeStretchTextPrimitive(
// to layout without mirroring
const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX());
const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY());
- ScalingParameters aScalingParameters{fScaleX * 100.0, fScaleY * 100.0};
+ ScalingParameters aScalingParameters{fScaleX, fScaleY};
rOutliner.setScalingParameters(aScalingParameters);
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 95d6ba37304c..de1590536d19 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -2336,7 +2336,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
if (rValue >>= fScale)
{
SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
- aItem.setFontScale(fScale);
+ aItem.setFontScale(fScale / 100.0);
pSdrObject->SetMergedItem(aItem);
return true;
}
@@ -2349,7 +2349,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
if (rValue >>= fScale)
{
SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
- aItem.setSpacingScale(fScale);
+ aItem.setSpacingScale(fScale / 100.0);
pSdrObject->SetMergedItem(aItem);
return true;
}
@@ -2875,7 +2875,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
if (pTextObject)
{
- rValue <<= pTextObject->GetFontScale();
+ rValue <<= pTextObject->GetFontScale() * 100.0;
}
break;
}
@@ -2885,7 +2885,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
if (pTextObject)
{
- rValue <<= pTextObject->GetSpacingScale();
+ rValue <<= pTextObject->GetSpacingScale() * 100.0;
}
break;
}