On October 13, 2002 12:57 pm, Carlos wrote:
Changelog:
- Changed SRCPAINT to SRCCOPY, the first time what it paints in hImageDC.
} else if (himl->hbmMask) { BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCAND );
BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT );
if (!bIsTransparent && himl->hbmMask) {
BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT );
} else {
BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCCOPY );
}
This can not be right. It is equivalent to:
PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY); SelectObject(hImageDC, hOldBrush); } - } else if (himl->hbmMask) { + } else if (himl->hbmMask && !(fStyle & ILD_TRANSPARENT) && clrBk != CLR_NONE) { BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCAND ); BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT ); } else { /* the image is opaque, just copy it */ TRACE(" - Image is opaque\n"); BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCCOPY); }
That is, if we have ILD_TRANSPARENT set, or clrBk == CLR_NONE, we go the SRCCOPY route, ignoring the mask, which is just the opposite of what we need to do!
Alexandre, please do not apply it.
El lun, 14 de oct de 2002, a las 10:40, Dimitrie O. Paun escribio:
On October 13, 2002 12:57 pm, Carlos wrote:
Changelog:
- Changed SRCPAINT to SRCCOPY, the first time what it paints in hImageDC.
} else if (himl->hbmMask) { BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCAND );
BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT );
if (!bIsTransparent && himl->hbmMask) {
BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT );
} else {
BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCCOPY );
}
This can not be right. It is equivalent to:
PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY); SelectObject(hImageDC, hOldBrush); }
- } else if (himl->hbmMask) {
- } else if (himl->hbmMask && !(fStyle & ILD_TRANSPARENT) && clrBk != CLR_NONE) { BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCAND ); BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT ); } else { /* the image is opaque, just copy it */ TRACE(" - Image is opaque\n"); BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCCOPY); }
The code is equivalent (i agree that i was not too clear :/) to:
if the code passed by: /* If we have an opaque image, draw the background */ if (!bIsTransparent && himl->hbmMask) {
Then it has initted the bitmap, and with a SRCPAINT the result is correct, but if it hasn't passed by this point, when it uses SRCPAINT it mixes with the garbage in the buffer, because it wasn't cleared, then in this case SRCCOPY looks like correct. Maybe that it should be CLEAR+SRCAND+SRCPAINT?
Regards, Carlos.
On October 14, 2002 11:16 am, Carlos wrote:
Then it has initted the bitmap, and with a SRCPAINT the result is correct, but if it hasn't passed by this point, when it uses SRCPAINT it mixes with the garbage in the buffer, because it wasn't cleared, then in this case SRCCOPY looks like correct. Maybe that it should be CLEAR+SRCAND+SRCPAINT?
You are correct, my mistake, I'm sorry. In fact, I just realized it a little while after sending the message, and I just finished an alternative patch (attached to this message). You are right, we should just SRCCOPY the image if we don't have a solid background. My patch just does a small code cleanup (and updates comments) to make clear what we're doing. Can you please let me know if it works as advertised?
Dimitrie O. Paun wrote:
On October 14, 2002 11:16 am, Carlos wrote:
Then it has initted the bitmap, and with a SRCPAINT the result is correct, but if it hasn't passed by this point, when it uses SRCPAINT it mixes with the garbage in the buffer, because it wasn't cleared, then in this case SRCCOPY looks like correct. Maybe that it should be CLEAR+SRCAND+SRCPAINT?
You are correct, my mistake, I'm sorry. In fact, I just realized it a little while after sending the message, and I just finished an alternative patch (attached to this message). You are right, we should just SRCCOPY the image if we don't have a solid background. My patch just does a small code cleanup (and updates comments) to make clear what we're doing. Can you please let me know if it works as advertised?
Works for me.