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.
{
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);
+ cxRed *= cxRed; //compute cxRed squared
+ cxGreen = (cSourceColor->Green - cDestColors->Green);
+ cxGreen *= cxGreen;
+ cxBlue = (cSourceColor->Blue - cDestColors->Blue);
+ cxBlue *= cxBlue;
rt = /* sqrt */ (cxRed + cxGreen + cxBlue);