Changeset 816 for trunk/src/kernel32/cvticon.cpp
- Timestamp:
- Sep 4, 1999, 2:42:10 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/cvticon.cpp
r589 r816 1 /* $Id: cvticon.cpp,v 1. 2 1999-08-19 19:50:40sandervl Exp $ */1 /* $Id: cvticon.cpp,v 1.3 1999-09-04 12:41:46 sandervl Exp $ */ 2 2 3 3 /* … … 27 27 28 28 //****************************************************************************** 29 //****************************************************************************** 30 ULONG QueryConvertedIconSize(WINBITMAPINFOHEADER *bmpHdr, int size) 31 { 32 int bwsize, colorsize, rgbsize, iconsize; 33 34 bwsize = (bmpHdr->biWidth*(bmpHdr->biHeight/2))/8; 35 colorsize = bmpHdr->biWidth*(bmpHdr->biHeight/2); 36 //SvL: 28-09-'98: only for <= 8 37 if(bmpHdr->biBitCount <= 8) 38 rgbsize = (1<<bmpHdr->biBitCount)*sizeof(RGB2); 39 else rgbsize = 0; 40 41 switch(bmpHdr->biBitCount) { 42 case 1: 43 colorsize /= 8; 44 break; 45 case 4: 46 colorsize /= 2; 47 break; 48 case 8: 49 break; 50 case 16: 51 colorsize *= 2; 52 break; 53 case 24: 54 colorsize *= 3; 55 break; 56 case 32: 57 colorsize *= 4; 58 break; 59 } 60 if(bmpHdr->biSizeImage == 0 && bmpHdr->biCompression == 0) { 61 bmpHdr->biSizeImage = bwsize + colorsize; 62 } 63 64 //SvL: 28-09-'98: cllngenu.dll has an incorrect size in the header 65 if(bmpHdr->biSizeImage < colorsize) { 66 bmpHdr->biSizeImage = colorsize; 67 } 68 //bitmapfileheader for AndXor mask + 2 RGB structs + bitmapfileheader 69 //for color bitmap + RGB structs for all the colors 70 //SvL, 3-3-98: 2*bwsize 71 iconsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 72 rgbsize + 2*bwsize + bmpHdr->biSizeImage; 73 74 return iconsize; 75 } 76 //****************************************************************************** 29 77 //NOTE: offsetBits is the value added to the offBits bitmap structure members 30 78 // (handy for converting icon groups) 31 79 //****************************************************************************** 32 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int offsetBits)80 void *ConvertIcon(WINBITMAPINFOHEADER *bmpHdr, int size, int *os2size, int offsetBits) 33 81 { 34 82 RGBQUAD *rgb; … … 83 131 iconsize = 2*sizeof(BITMAPFILEHEADER2) + 2*sizeof(RGB2) + 84 132 rgbsize + 2*bwsize + bmpHdr->biSizeImage; 133 #if 0 134 //SvL: Not necessary anymore 85 135 //There are icons without an XOR mask, so check for it 86 136 if(bmpHdr->biSizeImage == colorsize) { 87 137 iconsize += bwsize; 88 138 } 139 #endif 89 140 iconhdr = (BITMAPFILEHEADER2 *)malloc(iconsize); 90 141 memset(iconhdr, 0, iconsize); … … 104 155 os2rgb = (RGB2 *)(iconhdr+1); 105 156 memset(os2rgb, 0, sizeof(RGB2)); 106 memset(os2rgb+1, 0xff, sizeof(RGB 2)); //not reserved byte157 memset(os2rgb+1, 0xff, sizeof(RGB)); //not reserved byte! 107 158 iconhdr2 = (BITMAPFILEHEADER2 *)(os2rgb+2); 108 159 iconhdr2->usType = BFT_COLORICON; … … 143 194 memcpy((char *)os2rgb+2*bwsize, (char *)rgb, colorsize); 144 195 } 196 *os2size = iconsize; 145 197 return (void *)iconhdr; 146 198 }
Note:
See TracChangeset
for help on using the changeset viewer.