Changeset 10579 for trunk/src/gdi32/dibitmap.cpp
- Timestamp:
- Apr 13, 2004, 4:17:17 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibitmap.cpp
r10558 r10579 1 /* $Id: dibitmap.cpp,v 1.4 3 2004-03-24 16:55:35sandervl Exp $ */1 /* $Id: dibitmap.cpp,v 1.44 2004-04-13 14:17:17 sandervl Exp $ */ 2 2 3 3 /* … … 48 48 ((BITMAPINFOHEADER *)lpbmih)->biHeight = -lpbmih->biHeight; 49 49 50 if(lpbInit && fdwInit == CBM_INIT) 50 if(lpbInit && fdwInit == CBM_INIT) 51 51 { 52 52 // upside down … … 54 54 long lLineByte = DIB_GetDIBWidthBytes(lpbmih->biWidth, lpbmih->biBitCount); 55 55 long lHeight = lpbmih->biHeight; 56 56 57 57 newbits = (WORD *)malloc( lLineByte * lHeight ); 58 58 if(newbits) { … … 95 95 memcpy(infoLoc, lpbmi, sizeof(BITMAPINFO)); 96 96 97 if(GetDIBColorTable(hdc, 0, biClrUsed, pColors) == 0) 97 if(GetDIBColorTable(hdc, 0, biClrUsed, pColors) == 0) 98 98 { 99 99 dprintf(("ERROR: StretchDIBits: GetDIBColorTable failed!!")); … … 107 107 rc = CreateDIBitmap(hdc, lpbmih, fdwInit, lpbInit, (PBITMAPINFO)infoLoc, 108 108 DIB_RGB_COLORS); 109 109 110 110 return rc; 111 111 } … … 165 165 ((BITMAPINFOHEADER *)lpbmih)->biBitCount = biBitCount; 166 166 167 if(rc) { 167 if(rc) { 168 168 STATS_CreateDIBitmap(rc, hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage); 169 169 if(bitfields[1] == RGB565_GREEN_MASK) { … … 181 181 { 182 182 HBITMAP hBitmap; 183 pDCData pHps; 183 pDCData pHps; 184 184 185 185 pHps = (pDCData)OSLibGpiQueryDCData((HPS)hdc); … … 240 240 int iHeight, iWidth; 241 241 BOOL fCreateDC = FALSE; 242 242 243 243 dprintf(("GDI32: CreateDIBSection %x %x %x %x %x %d", hdc, pbmi, iUsage, ppvBits, hSection, dwOffset)); 244 244 … … 406 406 { 407 407 int nrlines; 408 pDCData pHps; 408 pDCData pHps; 409 409 HDC hdcMem; 410 410 DWORD biCompression; … … 436 436 //If the app wants bitmap data and upside down, then flip image 437 437 if(lpvBits && lpbi->bmiHeader.biHeight < 0 && (lpbi->bmiHeader.biCompression == BI_RGB || 438 lpbi->bmiHeader.biCompression == BI_BITFIELDS)) 438 lpbi->bmiHeader.biCompression == BI_BITFIELDS)) 439 439 { 440 440 INT rc = -1; … … 461 461 } 462 462 else DebugInt3(); 463 463 464 464 //restore height 465 465 lpbi->bmiHeader.biHeight = height; 466 466 } 467 else { 468 LONG height = lpbi->bmiHeader.biHeight; 469 470 if(lpbi->bmiHeader.biHeight < 0) { 471 lpbi->bmiHeader.biHeight = -lpbi->bmiHeader.biHeight; 472 } 467 else if (lpbi->bmiHeader.biHeight < 0) 468 { 469 LONG cySaved = lpbi->bmiHeader.biHeight; 470 lpbi->bmiHeader.biHeight = -cySaved; 473 471 nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage); 474 475 //restore height476 lpbi->bmiHeader.biHeight = height;477 }472 lpbi->bmiHeader.biHeight = cySaved; 473 } 474 else 475 nrlines = O32_GetDIBits(hdcMem, hBitmap, uStartScan, cScanLines, lpvBits, lpbi, uUsage); 478 476 479 477 if(lpvBits) { … … 528 526 //WGSS/Open32 returns 1 when querying the bitmap info; must return nr of scanlines 529 527 //(0 signals failure) 530 if(lpvBits == NULL) { 531 if(nrlines != 0) 532 nrlines = cScanLines; 533 else dprintf(("GetDIBits failed!!")); 534 } 528 #if 0//XP returns 1 just like Open32 does for the query bitmap info header mode. 529 if (lpvBits == NULL) 530 { 531 if (nrlines != 0) 532 nrlines = cScanLines; 533 else 534 dprintf(("GetDIBits failed!!")); 535 } 536 #else 537 if (!nrlines) 538 dprintf(("GetDIBits failed!!")); 539 #endif 535 540 return nrlines; 536 541 } … … 621 626 //If upside down, reverse scanlines and call SetDIBits again 622 627 if(pBitmapInfo->bmiHeader.biHeight < 0 && (pBitmapInfo->bmiHeader.biCompression == BI_RGB || 623 pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS)) 628 pBitmapInfo->bmiHeader.biCompression == BI_BITFIELDS)) 624 629 { 625 630 // upside down
Note:
See TracChangeset
for help on using the changeset viewer.