Click here to Skip to main content
15,849,768 members

Comments by basementman (Top 2 by date)

basementman 14-Apr-11 11:05am View    
Deleted
You can unroll the nested loops and just treat them as a contiguous memory block using something like the following (untested):

COLORREF *rgbpSrc = pSrcBits+((ySrc * nDestWidth) + xSrc);
COLORREF *rgbpBits = pBits+((yDesc * nDestWidth) + xDest);
DWORD dwCount = (nDestWidth * nDestHeight) - ((yDesc * nDestWidth) + xDest);


while (dwCount > -1)
{
clrPixelDest = rgbpBits;
// The bitmap is in reverse order (bottom to top)
// so the RGBs are in reverse order
b1 = GetRValue(clrPixelDest);
g1 = GetGValue(clrPixelDest);
r1 = GetBValue(clrPixelDest);
clrPixelSrc = rgbpSrc;
// The bitmap is in reverse order (bottom to top)
// so the RGBs are in reverse order
b2 = GetRValue(clrPixelSrc);
g2 = GetGValue(clrPixelSrc);
r2 = GetBValue(clrPixelSrc);
rDest = (r1*rem + r2*av) / 255;
gDest = (g1*rem + g2*av) / 255;
bDest = (b1*rem + b2*av) / 255;
// The bitmap is in reverse order (bottom to top)
//so the RGBs will be in reverse order
*rgbpBits = RGB(bDest, gDest, rDest);

rgbpSrc++;
rgbpBits++;
dwCount--;
}
basementman 19-Jan-11 12:32pm View    
Perhaps this is referring to the overhead of calling virtual member functions through an indirection (aka vtable)?