- Timestamp:
- Jan 4, 2003, 7:18:05 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibitmap.cpp
r9604 r9614 1 /* $Id: dibitmap.cpp,v 1.3 7 2003-01-03 21:42:55 sandervl Exp $ */1 /* $Id: dibitmap.cpp,v 1.38 2003-01-04 18:18:05 sandervl Exp $ */ 2 2 3 3 /* … … 366 366 pDCData pHps; 367 367 HDC hdcMem; 368 DWORD biCompression; 368 369 369 370 dprintf(("GDI32: GetDIBits %x %x %d %d %x %x (biBitCount %d) %d", hdc, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, lpbi->bmiHeader.biBitCount, uUsage)); … … 382 383 else hdcMem = hdc; 383 384 384 if(lpbi->bmiHeader.biHeight < 0) { 385 //NOTE: workaround for WGSS bug; remove when fixed 385 if(lpvBits) { 386 biCompression = lpbi->bmiHeader.biCompression; 387 } 388 389 //If the app wants bitmap data and upside down, then flip image 390 if(lpvBits && lpbi->bmiHeader.biHeight < 0 && (lpbi->bmiHeader.biCompression == BI_RGB || 391 lpbi->bmiHeader.biCompression == BI_BITFIELDS)) 392 { 393 INT rc = -1; 394 long lLineByte; 386 395 LONG height = lpbi->bmiHeader.biHeight; 387 396 388 nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage); 389 390 //NOTE: workaround for WGSS bug; remove when fixed 397 lpbi->bmiHeader.biHeight = -lpbi->bmiHeader.biHeight; 398 399 lLineByte = DIB_GetDIBWidthBytes(lpbi->bmiHeader.biWidth, lpbi->bmiHeader.biBitCount); 400 401 dprintf(("flip bitmap (negative height)")); 402 char *pNewBits = (char *)malloc( lLineByte * cScanLines ); 403 if(pNewBits) { 404 nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, pNewBits, lpbi, uUsage); 405 406 unsigned char *pbSrc = (unsigned char *)pNewBits + lLineByte * (cScanLines - 1); 407 unsigned char *pbDst = (unsigned char *)lpvBits; 408 for(int y = 0; y < cScanLines; y++) { 409 memcpy( pbDst, pbSrc, lLineByte ); 410 pbDst += lLineByte; 411 pbSrc -= lLineByte; 412 } 413 free(pNewBits); 414 } 415 else DebugInt3(); 416 417 //restore height 391 418 lpbi->bmiHeader.biHeight = height; 392 419 } … … 395 422 } 396 423 424 if(lpvBits) { 425 //WGSS always sets it to BI_RGB 426 lpbi->bmiHeader.biCompression = biCompression; 427 } 428 397 429 if(pHps->isMemoryPS) 398 430 DeleteDC(hdcMem); 399 431 400 if(lpvBits) { 432 //Only return bitfields info if the app wants it 433 if(lpvBits && lpbi->bmiHeader.biCompression == BI_BITFIELDS) { 401 434 // set proper color masks (only if lpvBits not NULL) 402 435 switch(lpbi->bmiHeader.biBitCount) { … … 426 459 break; 427 460 } 428 if(lpbi->bmiHeader.biCompression == BI_RGB && lpbi->bmiHeader.biBitCount > 8) { 429 lpbi->bmiHeader.biCompression = BI_BITFIELDS; 430 dprintf(("BI_BITFIELDS: %x %x %x", ((DWORD*)(lpbi->bmiColors))[0], ((DWORD*)(lpbi->bmiColors))[1], ((DWORD*)(lpbi->bmiColors))[2])); 431 } 461 dprintf(("BI_BITFIELDS: %x %x %x", ((DWORD*)(lpbi->bmiColors))[0], ((DWORD*)(lpbi->bmiColors))[1], ((DWORD*)(lpbi->bmiColors))[2])); 432 462 } 433 463 if(nrlines && lpvBits && lpbi->bmiHeader.biBitCount == 16 && ((DWORD*)(lpbi->bmiColors))[1] == RGB555_GREEN_MASK)
Note:
See TracChangeset
for help on using the changeset viewer.