Patch to properly bitBlt() masked pixmaps
Ryan Rusaw
rrusaw at sasktel.net
Wed Dec 15 08:59:22 CET 2004
Below is a patch that reverts an incorrect fix I submitted through the
bug tracker last month in regards to improper masked bitBlt()'s and then
fixes it in the correct manner. My first patch, in error, ignored the
Qt::RasterOp passed to bitBlt().
Explanation:
The original call to CreateCompatibleBitmap() was on the newly created
in-memory temporary DC (hTmpDC) and as such always returns the 1x1
monochrome bitmap that is by default selected into it.
CreateCompatibleBitmap() should be called on the original device
(dsthandle) instead.
Sorry about the previous error.
Ryan
921c921,927
< BitBlt( dsthandle, dx, dy, sw, sh, srchandle, sx, sy, SRCINVERT );
---
> HDC hTmpDC = CreateCompatibleDC( dsthandle );
> HBITMAP hTmpBmp = CreateCompatibleBitmap( dsthandle, sw, sh );
>
> HBITMAP hOldBmp1 = ( HBITMAP ) SelectObject( hTmpDC, hTmpBmp );
> BitBlt( hTmpDC, 0, 0, sw, sh, srchandle, sx, sy, ropCodes[
rop ] );
>
> BitBlt( dsthandle, dx, dy, sw, sh, hTmpDC, 0, 0, SRCINVERT );
923c929,933
< BitBlt( dsthandle, dx, dy, sw, sh, srchandle, sx, sy, SRCINVERT );
---
> BitBlt( dsthandle, dx, dy, sw, sh, hTmpDC, 0, 0, SRCINVERT );
>
> SelectObject( hTmpDC, hOldBmp1 );
> DeleteObject( hTmpBmp );
> DeleteDC( hTmpDC );
More information about the kde-cygwin
mailing list