"Damjan Jovanovic" damjan.jov@gmail.com writes:
- switch (dstDib.dsBm.bmBitsPixel)
- {
case 1:widthBytes = (width + 7) / 8;srcOffsetBytes = (xSrc + 7) / 8;dstOffsetBytes = (xDst + 7) / 8;break;case 4:widthBytes = (width + 1) / 2;srcOffsetBytes = (xSrc + 1) / 2;dstOffsetBytes = (xDst + 1) / 2;break;
You can't simply round size up, you have to handle partial bytes properly.
case 24:widthBytes = width * 2;srcOffsetBytes = xSrc * 2;dstOffsetBytes = xDst * 2;break;
I don't think you can fix 24 bits in two bytes...
A bigger problem is that you also need to handle the clip region of the destination DC, and only copy the pixels that aren't clipped out.