fix bug in alpha blit and bugs in blit caching

svn: r1429
This commit is contained in:
Matthew Flatt 2005-11-28 17:14:08 +00:00
parent 3ca2e32bb1
commit 37d51461bf
2 changed files with 31 additions and 22 deletions

View File

@ -2500,8 +2500,12 @@ Bool wxDC::Blit(double xdest, double ydest, double width, double height,
invented_memdc = source->mask_cache; invented_memdc = source->mask_cache;
invented_dc = invented_memdc->ThisDC(); invented_dc = invented_memdc->ThisDC();
if (mask->GetDepth() > 1) { if (mask->GetDepth() > 1) {
if (wxAlphaBlend) if (wxAlphaBlend) {
invented = invented_memdc->selected_bitmap;
if (invented->IsDIB())
use_alpha = 1; use_alpha = 1;
invented = NULL;
}
} }
} else { } else {
wxBitmap *orig_mask = mask; wxBitmap *orig_mask = mask;
@ -2567,25 +2571,7 @@ Bool wxDC::Blit(double xdest, double ydest, double width, double height,
} }
} }
} else { } else {
/* Want white where mask was white, /* Continues below */
src otherwise: */
BitBlt(invented_dc, 0, 0,
iw, ih,
mdc, xsrc1, ysrc1,
SRCPAINT /* DSo */);
/* Ignore the mask and... */
mask = NULL;
if (mono_src) {
/* Mono source: Now use invented_dc instead of src_dc,
and it all works out. */
xsrc1 = 0;
xsrc1 = 0;
} else {
/* Paint on dest using mask, then "and" invented image
with dest. */
invented_col = 1;
}
} }
} else { } else {
/* Failed (Rest of failure handling below since !invented_memdc) */ /* Failed (Rest of failure handling below since !invented_memdc) */
@ -2629,6 +2615,28 @@ Bool wxDC::Blit(double xdest, double ydest, double width, double height,
} }
} }
if (invented_dc && !use_alpha) {
/* Want white where mask was white,
src otherwise: */
BitBlt(invented_dc, 0, 0,
iw, ih,
mdc, xsrc1, ysrc1,
SRCPAINT /* DSo */);
/* Ignore the mask and... */
mask = NULL;
if (source->GetDepth() == 1) {
/* Mono source: Now use invented_dc instead of src_dc,
and it all works out. */
xsrc1 = 0;
xsrc1 = 0;
} else {
/* Paint on dest using mask, then "and" invented image
with dest. */
invented_col = 1;
}
}
if (use_alpha) { if (use_alpha) {
BLENDFUNCTION bf; BLENDFUNCTION bf;

View File

@ -1746,6 +1746,7 @@ void *wxBitmap::ChangeToDIBSection(Bool copy_old)
HBITMAP bm; HBITMAP bm;
void *pBits; void *pBits;
memset(&bmp, 0, sizeof(bmp));
bmp.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmp.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmp.bmiHeader.biWidth = width; bmp.bmiHeader.biWidth = width;
bmp.bmiHeader.biHeight = height; bmp.bmiHeader.biHeight = height;