Original Post
Currently I'm trying to optimize some bitmap drawing. Here is the "meat" of the drawing code. My profiler tells me that this stuff right here is taking about 50% of the total drawing time.
// Dest DC.
CDCHandle dstDC((HDC)IDisplay::Get()->GetDC());
HBITMAP oldDst = dstDC.SelectBitmap((HBITMAP)_itsBitmapHandle);
// Source DC.
CDC srcDC;
srcDC.CreateCompatibleDC();
HBITMAP oldSrc = 0;
// Move the bits.
oldSrc = srcDC.SelectBitmap((HBITMAP)pSrc->_itsBitmapHandle);
dstDC.BitBlt(xDst, yDst, dx, dy, srcDC, xSrc, ySrc, dwRop);
// Put everything back.
dstDC.SelectBitmap(oldDst);
if (oldSrc != 0)
srcDC.SelectBitmap(oldSrc);
Do any red flags go off in your head when you are reading this code? I didn't write it and I don't know much about using GDI, so I have been struggling to find optimizations. Any help is appreciated. [Edited by - scottrick49 on May 12, 2009 1:32:09 PM]