Changeset 5825 for trunk/src/gdi32/dibsect.cpp
- Timestamp:
- May 29, 2001, 11:45:21 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.cpp
r5799 r5825 1 /* $Id: dibsect.cpp,v 1.5 1 2001-05-25 10:05:29sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.52 2001-05-29 09:45:21 sandervl Exp $ */ 2 2 3 3 /* … … 387 387 int DIBSection::SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb) 388 388 { 389 int i ;389 int i, end; 390 390 391 391 dprintf(("SetDIBColorTable %d %d %x", startIdx, cEntries, rgb)); 392 if(startIdx + cEntries > (1 << pOS2bmp->cBitCount)) 393 { 394 dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries)); 395 return(0); 392 393 if(pOS2bmp->cBitCount > 8) { 394 dprintf(("DIBSection::SetDIBColorTable: bpp > 8; ignore")); 395 return 0; 396 } 397 398 end = startIdx + cEntries; 399 if(end > (1 << pOS2bmp->cBitCount)) { 400 end = (1 << pOS2bmp->cBitCount); 396 401 } 397 402 398 403 memcpy(&pOS2bmp->argbColor[startIdx], rgb, cEntries*sizeof(RGB2)); 399 404 400 for(i=startIdx;i< cEntries;i++)405 for(i=startIdx;i<end;i++) 401 406 { 402 407 pOS2bmp->argbColor[i].fcOptions = 0; … … 412 417 int DIBSection::SetDIBColorTable(int startIdx, int cEntries, PALETTEENTRY *palentry) 413 418 { 414 int i; 415 416 if(startIdx + cEntries > (1 << pOS2bmp->cBitCount)) 417 { 418 dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries)); 419 return(0); 420 } 421 422 for(i=startIdx;i<cEntries;i++) 419 int i, end; 420 421 if(pOS2bmp->cBitCount > 8) { 422 dprintf(("DIBSection::SetDIBColorTable: bpp > 8; ignore")); 423 return 0; 424 } 425 426 end = startIdx + cEntries; 427 if(end > (1 << pOS2bmp->cBitCount)) { 428 end = (1 << pOS2bmp->cBitCount); 429 } 430 for(i=startIdx;i<end;i++) 423 431 { 424 432 pOS2bmp->argbColor[i].fcOptions = 0; … … 428 436 } 429 437 430 return(cEntries); 438 return end - startIdx; 439 } 440 //****************************************************************************** 441 //****************************************************************************** 442 int DIBSection::GetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb) 443 { 444 int i, end = startIdx + cEntries; 445 446 if(pOS2bmp->cBitCount > 8) { 447 dprintf(("DIBSection::GetDIBColorTable: bpp > 8 -> return 0")); 448 return 0; 449 } 450 if(end > (1 << pOS2bmp->cBitCount)) { 451 end = (1 << pOS2bmp->cBitCount); 452 dprintf(("DIBSection::GetDIBColorTable: %d->%d", startIdx, end)); 453 } 454 memcpy(rgb, &pOS2bmp->argbColor[startIdx], cEntries*sizeof(RGBQUAD)); 455 456 for(i=0;i<cEntries;i++) { 457 rgb[i].rgbReserved = 0; 458 } 459 460 return end - startIdx; 431 461 } 432 462 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.