Changeset 1966 for trunk/src/gdi32/dibsect.cpp
- Timestamp:
- Dec 4, 1999, 2:53:14 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.cpp
r1937 r1966 1 /* $Id: dibsect.cpp,v 1.1 0 1999-12-02 13:26:04 achimhaExp $ */1 /* $Id: dibsect.cpp,v 1.11 1999-12-04 13:53:12 hugh Exp $ */ 2 2 3 3 /* … … 101 101 dprintf(("pOS2bmp->ulCompression %d\n", pOS2bmp->ulCompression)); 102 102 dprintf(("pOS2bmp->cbImage %d\n", pOS2bmp->cbImage)); 103 dprintf(("Bits at 0x%08X\n",bmpBits)); 103 104 104 105 this->handle = handle; … … 123 124 dsect->next = this; 124 125 } 126 125 127 dprintf(("Class created")); 126 128 } … … 134 136 free(pOS2bmp); 135 137 136 if(section == this) { 137 section = this->next; 138 } 139 else { 140 DIBSection *dsect = section; 141 142 while(dsect->next != this) { 143 dsect = dsect->next; 144 } 145 dsect->next = this->next; 138 if(section == this) 139 { 140 section = this->next; 141 } 142 else 143 { 144 DIBSection *dsect = section; 145 146 while(dsect->next != this) 147 { 148 dsect = dsect->next; 149 } 150 dsect->next = this->next; 146 151 } 147 152 } … … 161 166 switch(pbmi->biBitCount) 162 167 { 163 case 1: 164 bmpsize /= 8; 165 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 166 os2bmpsize += palsize; 167 break; 168 case 4: 169 bmpsize /= 2; 170 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 171 os2bmpsize += palsize; 172 break; 173 case 8: 174 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 175 os2bmpsize += palsize; 176 break; 177 case 16: 178 bmpsize *= 2; 179 break; 180 case 24: 181 bmpsize *= 3; 182 break; 183 case 32: 184 bmpsize *= 4; 185 break; 186 } 187 if(bmpsize & 3) { 188 bmpsize = (bmpsize + 3) & ~3; 168 case 1: 169 bmpsize /= 8; 170 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 171 os2bmpsize += palsize; 172 break; 173 case 4: 174 bmpsize /= 2; 175 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 176 os2bmpsize += palsize; 177 break; 178 case 8: 179 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 180 os2bmpsize += palsize; 181 break; 182 case 16: 183 bmpsize *= 2; 184 break; 185 case 24: 186 bmpsize *= 3; 187 break; 188 case 32: 189 bmpsize *= 4; 190 break; 191 } 192 193 if(bmpsize & 3) 194 { 195 bmpsize = (bmpsize + 3) & ~3; 189 196 } 190 197 … … 216 223 int i; 217 224 218 if(startIdx + cEntries > (1 << pOS2bmp->cBitCount)) { 219 dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries)); 220 return(0); 221 } 225 if(startIdx + cEntries > (1 << pOS2bmp->cBitCount)) 226 { 227 dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries)); 228 return(0); 229 } 230 222 231 memcpy(&pOS2bmp->argbColor[startIdx], rgb, cEntries*sizeof(RGB2)); 223 for(i=startIdx;i<cEntries;i++) { 224 pOS2bmp->argbColor[i].fcOptions = 0; 225 } 232 233 for(i=startIdx;i<cEntries;i++) 234 { 235 pOS2bmp->argbColor[i].fcOptions = 0; 236 dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&pOS2bmp->argbColor[i])) )); 237 } 238 226 239 return(cEntries); 227 240 } … … 306 319 this->hdc = hdc; 307 320 hwndParent = WinWindowFromDC(hdc); 321 dprintf(("SelectDIBObject(0x%08X) hwndParent = 0x%08X\n",hdc, hwndParent)); 308 322 } 309 323 //****************************************************************************** … … 313 327 DIBSection *dsect = section; 314 328 315 while(dsect) { 316 if(dsect->handle == handle) { 317 return(dsect); 318 } 319 dsect = dsect->next; 329 while(dsect) 330 { 331 if(dsect->handle == handle) 332 { 333 return(dsect); 334 } 335 dsect = dsect->next; 320 336 } 321 337 return(NULL); … … 328 344 DIBSection *dsect = section; 329 345 330 while(dsect) { 331 if(dsect->hdc == hdc) { 332 return(dsect); 333 } 334 dsect = dsect->next; 346 while(dsect) 347 { 348 if(dsect->hdc == hdc) 349 { 350 return(dsect); 351 } 352 dsect = dsect->next; 335 353 } 336 354 return(NULL); … … 343 361 344 362 if(dsect) 345 delete dsect; 346 347 } 348 //****************************************************************************** 349 //****************************************************************************** 350 int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection){ 363 delete dsect; 364 365 } 366 //****************************************************************************** 367 //****************************************************************************** 368 int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection) 369 { 351 370 if( (sizeof(DIBSECTION)==iSize) && 352 371 (pDIBSection !=NULL)) … … 388 407 //****************************************************************************** 389 408 //****************************************************************************** 409 char DIBSection::GetBitCount() 410 { 411 if(NULL==pOS2bmp) 412 return 0; 413 else 414 return pOS2bmp->cBitCount; 415 } 416 //****************************************************************************** 417 //****************************************************************************** 390 418 DIBSection *DIBSection::section = NULL; 391
Note:
See TracChangeset
for help on using the changeset viewer.