Changeset 3235 for trunk/src/gdi32/dibsect.cpp
- Timestamp:
- Mar 25, 2000, 1:19:08 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.cpp
r3227 r3235 1 /* $Id: dibsect.cpp,v 1.2 2 2000-03-24 19:24:47 sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.23 2000-03-25 12:19:07 sandervl Exp $ */ 2 2 3 3 /* … … 38 38 //****************************************************************************** 39 39 DIBSection::DIBSection(BITMAPINFOHEADER_W *pbmi, char *pColors, DWORD iUsage, DWORD hSection, DWORD dwOffset, DWORD handle, int fFlip) 40 : bmpBits(NULL), pOS2bmp(NULL), next(NULL) 40 : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsRGB565(NULL) 41 41 { 42 42 int os2bmpsize; … … 145 145 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0x03e0; 146 146 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0x001f; 147 148 //double buffer for rgb 555 dib sections (for conversion) 149 if(dibinfo.dsBitfields[1] == 0x03e0) { 150 DosAllocMem((PPVOID)&bmpBitsRGB565, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT); 151 } 147 152 break; 148 153 … … 202 207 if(bmpBits) 203 208 DosFreeMem(bmpBits); 209 210 if(bmpBitsRGB565) 211 DosFreeMem(bmpBitsRGB565); 204 212 205 213 if(pOS2bmp) … … 302 310 dibinfo.dsOffset = 0; // TODO: put the correct value here (if createdibsection with file handle) 303 311 304 if(pbmi->biCompression == BI_BITFIELDS) 305 { 312 if(coloruse == DIB_PAL_COLORS || pbmi->biBitCount <= 8) 313 { 314 dibinfo.dsBitfields[0] = dibinfo.dsBitfields[1] = dibinfo.dsBitfields[2] = 0; 315 } 316 else { 306 317 char *pColors = (char *)pbmi + 1; 307 318 308 dibinfo.dsBitfields[0] = *((DWORD *)pColors); 309 dibinfo.dsBitfields[1] = *((DWORD *)pColors+1); 310 dibinfo.dsBitfields[2] = *((DWORD *)pColors+2); 319 switch(pbmi->biBitCount) 320 { 321 case 16: 322 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS) ? *(DWORD *)pColors : 0x7c00; 323 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0x03e0; 324 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0x001f; 325 break; 326 327 case 24: 328 dibinfo.dsBitfields[0] = 0xff; 329 dibinfo.dsBitfields[1] = 0xff00; 330 dibinfo.dsBitfields[2] = 0xff0000; 331 break; 332 333 case 32: 334 dibinfo.dsBitfields[0] = (pbmi->biCompression == BI_BITFIELDS) ? *(DWORD *)pColors : 0xff; 335 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0xff00; 336 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0xff0000; 337 if(dibinfo.dsBitfields[0] != 0xff && dibinfo.dsBitfields[1] != 0xff00 && dibinfo.dsBitfields[2] != 0xff0000) { 338 dprintf(("DIBSection: unsupported bitfields for 32 bits bitmap!!")); 339 } 340 break; 341 } 311 342 dprintf(("BI_BITFIELDS %x %x %x", dibinfo.dsBitfields[0], dibinfo.dsBitfields[1], dibinfo.dsBitfields[2])); 312 343 } … … 411 442 dprintf(("DIBSection::BitBlt; convert rgb 555 to 565")); 412 443 413 bitmapBits = (WORD *)malloc(pOS2bmp->cbImage); 444 if(bmpBitsRGB565 == NULL) 445 DebugInt3(); 446 414 447 if(CPUFeatures & CPUID_MMX) { 415 RGB555to565MMX((WORD *)b itmapBits, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD));448 RGB555to565MMX((WORD *)bmpBitsRGB565, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD)); 416 449 } 417 else RGB555to565((WORD *)bitmapBits, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD)); 418 rc = GpiDrawBits(hps, bitmapBits, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR); 419 free(bitmapBits); 450 else RGB555to565((WORD *)bmpBitsRGB565, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD)); 451 rc = GpiDrawBits(hps, bmpBitsRGB565, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR); 420 452 } 421 453 else rc = GpiDrawBits(hps, bmpBits, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR);
Note:
See TracChangeset
for help on using the changeset viewer.