aboutsummaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-02-06 23:35:42 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-02-06 23:35:42 +0000
commit6452b6942e423943fcd8b4a7acc6d1d06f2461a3 (patch)
tree21e346bc18ff24e3bf684e9f675fc7b634ca0cf4 /src/base
parent01e5e1f0a2d19c051106669cc8df5da2d1cffbe2 (diff)
downloadusdx-6452b6942e423943fcd8b4a7acc6d1d06f2461a3.tar.gz
usdx-6452b6942e423943fcd8b4a7acc6d1d06f2461a3.tar.xz
usdx-6452b6942e423943fcd8b4a7acc6d1d06f2461a3.zip
a small optimization.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2099 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/base/UFont.pas12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/base/UFont.pas b/src/base/UFont.pas
index 191e74d2..b97b2890 100644
--- a/src/base/UFont.pas
+++ b/src/base/UFont.pas
@@ -1127,7 +1127,7 @@ var
ModelMatrix, ProjMatrix: T16dArray;
WinCoords: array[0..2, 0..2] of GLdouble;
ViewPortArray: TViewPortArray;
- Dist, Dist2: double;
+ Dist, Dist2, DistSum: double;
WidthScale, HeightScale: double;
const
// width/height of square used for determining the scale
@@ -1169,9 +1169,10 @@ begin
Dist2 := (WinCoords[0][1] - WinCoords[1][1]);
WidthScale := 1;
- if (Sqrt(Dist*Dist + Dist2*Dist2) <> 0) then
+ DistSum := Dist*Dist + Dist2*Dist2
+ if DistSum > 0) then
begin
- WidthScale := cTestSize / Sqrt(Dist*Dist + Dist2*Dist2);
+ WidthScale := cTestSize / Sqrt(DistSum);
end;
// projected height ||(x1, y1) - (x1, y2)||
@@ -1179,9 +1180,10 @@ begin
Dist2 := (WinCoords[0][1] - WinCoords[2][1]);
HeightScale := 1;
- if (Sqrt(Dist*Dist + Dist2*Dist2) <> 0) then
+ DistSum := Dist*Dist + Dist2*Dist2
+ if DistSum > 0) then
begin
- HeightScale := cTestSize / Sqrt(Dist*Dist + Dist2*Dist2);
+ HeightScale := cTestSize / Sqrt(DistSum);
end;
//writeln(Format('Scale %f, %f', [WidthScale, HeightScale]));