[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-cygwin
Subject: Re: Patch to properly bitBlt() masked pixmaps
From: Ryan Rusaw <rrusaw () sasktel ! net>
Date: 2004-12-16 1:07:39
Message-ID: 41C0DFDB.3030300 () sasktel ! net
[Download RAW message or body]
Chris,
Attached is the patch in unified format to qpaintdevice_win.cpp
Ryan
>Do you mind sending a unified patch instead (diff -u)? They are easier to
>apply and less sensitive to other changes in the code. Also please include
>an indication of which file the patch is against (I assume qpainter_win.cpp
>in this case?)
>
>Thanks,
>Chris
>
>
>
>>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 );
>>
>>
>>_______________________________________________
>>kde-cygwin mailing list
>>kde-cygwin@kde.org
>>https://mail.kde.org/mailman/listinfo/kde-cygwin
>>
>>
>>
>
>_______________________________________________
>kde-cygwin mailing list
>kde-cygwin@kde.org
>https://mail.kde.org/mailman/listinfo/kde-cygwin
>
>
["qpaintdevice_win.cpp.patch" (text/plain)]
--- O:\Documents and Settings\Ryan\Local \
Settings\Temp\TCV62.tmp\qpaintdevice_win.1.1.2.7.2.8.cpp Sun Nov 28 \
10:42:18 2004
+++ O:\qt3\src\kernel\qpaintdevice_win.cpp Wed Dec 15 01:31:04 2004
@@ -914,17 +914,27 @@
/* GC gc;*/
if ( mask && !mono_src ) { // fast masked blt
#ifdef DEBUG_QPAINTDEVICE
qDebug( " bitBlt drawing masked Pixmap" );
#endif
- 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 );
BitBlt( dsthandle, dx, dy, sw, sh, mask->handle(), sx, sy, SRCAND );
- 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 );
/*if (!BitBlt(dsthandle, dx, dy, sw, sh, srchandle, sx, sy, ropCodes[rop] )) \
{ #ifdef DEBUG_QPAINTDEVICE
qDebug(" bitBlt failed!!!!!!!!!!!, %d", GetLastError());
#endif
}*/
_______________________________________________
kde-cygwin mailing list
kde-cygwin@kde.org
https://mail.kde.org/mailman/listinfo/kde-cygwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic