- Timestamp:
- Nov 22, 2000, 10:04:32 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/winicon.cpp
r4665 r4677 1 /* $Id: winicon.cpp,v 1.1 6 2000-11-21 15:17:14sandervl Exp $ */1 /* $Id: winicon.cpp,v 1.17 2000-11-22 21:04:32 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Icon Code for OS/2 … … 610 610 if (hMem) { 611 611 hOld = SelectObject(hMem, hAndBits); 612 //SvL: This also doesn't work as StretchDIBits doesn't handle 1bpp bitmaps correctly 613 //--------->>> hack alert! 614 #if 1 615 HBITMAP hBmp, hOld1; 616 HDC hMem1; 617 618 hMem1 = CreateCompatibleDC(hdc); 619 620 int linewidth = BITMAP_GetWidthBytes(pInfo->bmiHeader.biWidth, 1); 621 622 char *newpix = (char *)malloc(linewidth*pInfo->bmiHeader.biHeight); 623 624 newpix += ((pInfo->bmiHeader.biHeight-1)*linewidth); 625 626 if(cbSize - size - colorsize - bwsize == bwsize) 627 {//this means an AND and XOR mask is present (interleaved; and/xor) 628 for(int i=0;i<pInfo->bmiHeader.biHeight;i++) { 629 memcpy(newpix, xbits, linewidth); 630 newpix -= linewidth; 631 xbits += linewidth*2; 632 } 633 } 634 else { 635 for(int i=0;i<pInfo->bmiHeader.biHeight;i++) { 636 memcpy(newpix, xbits, linewidth); 637 newpix -= linewidth; 638 xbits += linewidth; 639 } 640 } 641 newpix += linewidth; 642 hBmp = CreateBitmap(pInfo->bmiHeader.biWidth, pInfo->bmiHeader.biHeight, 1, 1, newpix); 643 free(newpix); 644 645 hOld1 = SelectObject(hMem1, hBmp); 646 647 res = StretchBlt(hMem, 0, 0, width, height, hMem1, 0, 0, pInfo->bmiHeader.biWidth, pInfo->bmiHeader.biHeight, SRCCOPY); 648 649 SelectObject(hMem1, hOld1); 650 DeleteObject(hBmp); 651 DeleteDC(hMem1); 652 653 654 #else 612 655 res = StretchDIBits(hMem, 0, 0, width, height, 0, 0, 613 656 pInfo->bmiHeader.biWidth, pInfo->bmiHeader.biHeight, 614 657 xbits, pInfo, DIB_RGB_COLORS, SRCCOPY); 658 #endif 615 659 SelectObject(hMem, hOld); 616 660 DeleteDC(hMem); … … 618 662 else res = FALSE; 619 663 if (!res) { 620 DeleteObject(hAndBits); hAndBits = 0; 664 DeleteObject(hAndBits); 665 hAndBits = 0; 621 666 } 622 667 }
Note:
See TracChangeset
for help on using the changeset viewer.