From b8049283dcc638d330ff1edbc9bd35c86eb6dd9a Mon Sep 17 00:00:00 2001 From: Eugene Ingerman Date: Sat, 18 Jan 2003 20:44:34 +0000 Subject: [PATCH] Don't compute absolute values after squaring. svn path=/trunk/; revision=4033 --- reactos/subsys/win32k/eng/xlate.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/reactos/subsys/win32k/eng/xlate.c b/reactos/subsys/win32k/eng/xlate.c index 3022c56d477..72f8328bde7 100644 --- a/reactos/subsys/win32k/eng/xlate.c +++ b/reactos/subsys/win32k/eng/xlate.c @@ -32,16 +32,6 @@ ULONG BGRtoULONG(BYTE Blue, BYTE Green, BYTE Red) return ((Blue & 0xff) << 16) | ((Green & 0xff) << 8) | (Red & 0xff); } -INT abs(INT nm) -{ - if(nm<0) - { - return nm * -1; - } else - { - return nm; - } -} // FIXME: If the caller knows that the destinations are indexed and not RGB // then we should cache more than one value. Same with the source. @@ -68,9 +58,9 @@ ULONG ClosestColorMatch(ULONG SourceColor, ULONG *DestColors, { cDestColors = (PVIDEO_CLUTDATA)&DestColors[i]; - cxRed = abs(cSourceColor->Red - cDestColors->Red) ^ 2; - cxGreen = abs(cSourceColor->Green - cDestColors->Green) ^ 2; - cxBlue = abs(cSourceColor->Blue - cDestColors->Blue) ^ 2; + cxRed = (cSourceColor->Red - cDestColors->Red) ^ 2; + cxGreen = (cSourceColor->Green - cDestColors->Green) ^ 2; + cxBlue = (cSourceColor->Blue - cDestColors->Blue) ^ 2; rt = /* sqrt */ (cxRed + cxGreen + cxBlue);