summaryrefslogtreecommitdiff
path: root/vcl/aqua/source/gdi/salmathutils.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/aqua/source/gdi/salmathutils.cxx')
-rw-r--r--vcl/aqua/source/gdi/salmathutils.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/vcl/aqua/source/gdi/salmathutils.cxx b/vcl/aqua/source/gdi/salmathutils.cxx
index 26516902c5c1..8a5612788429 100644
--- a/vcl/aqua/source/gdi/salmathutils.cxx
+++ b/vcl/aqua/source/gdi/salmathutils.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -102,7 +102,7 @@ void ULSwap ( unsigned long &rX, unsigned long &rY )
// -----------------------------------------------------------------------
//
// This way of measuring distance is also called the "Manhattan distance."
-// Manhattan distance takes advantage of the fact that the sum of the
+// Manhattan distance takes advantage of the fact that the sum of the
// lengths of the three components of a 3D vector is a rough approxima-
// tion of the vector's length.
//
@@ -111,7 +111,7 @@ void ULSwap ( unsigned long &rX, unsigned long &rY )
unsigned long Euclidian2Norm ( const LRectCoorVector pVec )
{
unsigned long ndist = 0;
-
+
if ( pVec )
{
long nDX = 0;
@@ -120,29 +120,29 @@ unsigned long Euclidian2Norm ( const LRectCoorVector pVec )
unsigned long nMax = 0;
unsigned long nMed = 0;
unsigned long nMin = 0;
-
+
// Find |x'-x|, |y'-y|, and |z'-z| from (x,y,z) and (x',y',z')
-
+
nDX = pVec[1].x - pVec[0].x;
nDY = pVec[1].y - pVec[0].y;
nDZ = pVec[1].z - pVec[0].z;
-
+
nMax = (unsigned long)abs( nDX );
nMed = (unsigned long)abs( nDY );
nMin = (unsigned long)abs( nDZ );
-
+
// Sort them (3 compares, 0-3 swaps)
-
+
if ( nMax < nMed )
{
Swap( nMax, nMed );
} // if
-
+
if ( nMax < nMin )
{
Swap( nMax, nMin );
} // if
-
+
// Approximate Euclidian distance:
//
// d = max + (11/32)*med + (1/4)*min
@@ -150,11 +150,11 @@ unsigned long Euclidian2Norm ( const LRectCoorVector pVec )
// with +/- 8% error, where the exact formulae for d is
//
// || (x',y',z') - (x,y,z) || = { |x'-x|^2 + |y'-y|^2 + |z'-z|^2 }^(1/2)
-
- ndist = nMax + ( nMin >> 2UL )
+
+ ndist = nMax + ( nMin >> 2UL )
+ ( ( ( nMed << 3UL ) + ( nMed << 1UL ) + nMed ) >> 5UL );
} // if
-
+
return ndist;
} // RGBDistance