- Timestamp:
- May 12, 2000, 9:14:56 PM (25 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r3418 r3527 1 /* $Id: blit.cpp,v 1.1 0 2000-04-18 11:11:52sandervl Exp $ */1 /* $Id: blit.cpp,v 1.11 2000-05-12 19:14:55 sandervl Exp $ */ 2 2 3 3 /* … … 28 28 //****************************************************************************** 29 29 BOOL WIN32API StretchBlt(HDC hdcDest, int nXOriginDest, int nYOriginDest, 30 31 32 30 int nWidthDest, int nHeightDest, 31 HDC hdcSrc, int nXOriginSrc, int nYOriginSrc, 32 int nWidthSrc, int nHeightSrc, DWORD dwRop) 33 33 { 34 34 BOOL rc; … … 155 155 result = O32_SetDIBitsToDevice(hdc, xDest, yDest, cx, cy, xSrc, ySrc, startscan, lines, (PVOID) bits, (PBITMAPINFO)info, coloruse); 156 156 //SvL: Wrong Open32 return value 157 result = (result == TRUE) ? lines : 0; 157 // result = (result == TRUE) ? lines : 0; 158 result = (result == TRUE) ? cy : 0; 158 159 159 160 dprintf(("GDI32: SetDIBitsToDevice hdc:%X xDest:%d yDest:%d, cx:%d, cy:%d, xSrc:%d, ySrc:%d, startscan:%d, lines:%d \nGDI32: bits 0x%X, info 0x%X, coloruse %d returned %d", -
trunk/src/gdi32/dibsect.cpp
r3437 r3527 1 /* $Id: dibsect.cpp,v 1. 29 2000-04-23 15:34:10sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.30 2000-05-12 19:14:55 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), bmpBits RGB565(NULL)40 : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsBuffer(NULL) 41 41 { 42 42 bmpsize = pbmi->biWidth; … … 143 143 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0x03e0; 144 144 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0x001f; 145 146 //double buffer for rgb 555 dib sections (for conversion)147 if(dibinfo.dsBitfields[1] == 0x03e0) {148 DosAllocMem((PPVOID)&bmpBitsRGB565, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT);149 }150 145 break; 151 146 … … 167 162 dprintf(("BI_BITFIELDS %x %x %x", dibinfo.dsBitfields[0], dibinfo.dsBitfields[1], dibinfo.dsBitfields[2])); 168 163 } 164 //double buffer for rgb 555 dib sections (for conversion) or flipped sections 165 if(dibinfo.dsBitfields[1] == 0x03e0 || (fFlip & FLIP_VERT)) { 166 DosAllocMem((PPVOID)&bmpBitsBuffer, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT); 167 } 169 168 170 169 this->handle = handle; … … 206 205 DosFreeMem(bmpBits); 207 206 208 if(bmpBits RGB565)209 DosFreeMem(bmpBits RGB565);207 if(bmpBitsBuffer) 208 DosFreeMem(bmpBitsBuffer); 210 209 211 210 if(pOS2bmp) … … 320 319 dibinfo.dsBitfields[1] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 1) : 0x03e0; 321 320 dibinfo.dsBitfields[2] = (pbmi->biCompression == BI_BITFIELDS) ? *((DWORD *)pColors + 2) : 0x001f; 322 if(dibinfo.dsBitfields[1] == 0x03e0) {323 if(bmpBitsRGB565)324 DosFreeMem(bmpBitsRGB565);325 DosAllocMem((PPVOID)&bmpBitsRGB565, bmpsize*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT);326 }327 321 break; 328 322 … … 345 339 } 346 340 341 //double buffer for rgb 555 dib sections (for conversion) or flipped sections 342 if(dibinfo.dsBitfields[1] == 0x03e0 || (fFlip & FLIP_VERT)) { 343 if(bmpBitsBuffer) { 344 DosFreeMem(bmpBitsBuffer); 345 } 346 DosAllocMem((PPVOID)&bmpBitsBuffer, dibinfo.dsBm.bmWidthBytes*pbmi->biHeight, PAG_READ|PAG_WRITE|PAG_COMMIT); 347 } 348 347 349 dprintf(("DIBSection::SetDIBits (%d,%d), %d %d", pbmi->biWidth, pbmi->biHeight, pbmi->biBitCount, pbmi->biCompression)); 348 350 if(palsize) … … 417 419 } 418 420 421 #if 0 422 nXdest = 0; 423 nYdest = 0; 424 nXsrc = 0; 425 nXsrc = 0; 426 nDestWidth = pOS2bmp->cx; 427 nDestHeight = pOS2bmp->cy; 428 nSrcWidth = pOS2bmp->cx; 429 nSrcHeight = pOS2bmp->cy; 430 #endif 431 419 432 //win32 coordinates are of the left top, OS/2 expects left bottom 420 433 //source rectangle is non-inclusive (top, right not included) … … 443 456 444 457 oldyinversion = GpiQueryYInversion(hps); 445 if(fFlip & FLIP_VERT)446 {447 if(oldyinversion != hdcHeight-1) {448 GpiEnableYInversion(hps, hdcHeight-1);449 fRestoryYInversion = TRUE;450 }451 }452 else453 458 if(oldyinversion != 0) { 454 459 GpiEnableYInversion(hps, 0); … … 464 469 } 465 470 471 ULONG os2mode, winmode; 472 473 os2mode = BBO_OR; 474 winmode = GetStretchBltMode(hdcDest); 475 switch(winmode) { 476 case BLACKONWHITE_W: 477 os2mode = BBO_AND; 478 break; 479 case WHITEONBLACK_W: 480 case HALFTONE_W: //TODO: 481 os2mode = BBO_OR; 482 break; 483 case COLORONCOLOR_W: 484 os2mode = BBO_IGNORE; 485 break; 486 } 487 if(fFlip & FLIP_VERT) { 488 //manually reverse bitmap data 489 char *src = bmpBits + (pOS2bmp->cy-1)*dibinfo.dsBm.bmWidthBytes; 490 char *dst = bmpBitsBuffer; 491 for(int i=0;i<pOS2bmp->cy;i++) { 492 memcpy(dst, src, dibinfo.dsBm.bmWidthBytes); 493 dst += dibinfo.dsBm.bmWidthBytes; 494 src -= dibinfo.dsBm.bmWidthBytes; 495 } 496 bmpBits = bmpBitsBuffer; 497 } 498 466 499 //SvL: Optimize this.. (don't convert entire bitmap if only a part will be blitted to the dc) 467 500 if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555? 468 501 dprintf(("DIBSection::BitBlt; convert rgb 555 to 565 (old y inv. = %d)", oldyinversion)); 469 502 470 if(bmpBits RGB565== NULL)503 if(bmpBitsBuffer == NULL) 471 504 DebugInt3(); 472 505 473 506 if(CPUFeatures & CPUID_MMX) { 474 RGB555to565MMX((WORD *)bmpBits RGB565, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD));507 RGB555to565MMX((WORD *)bmpBitsBuffer, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD)); 475 508 } 476 else RGB555to565((WORD *)bmpBits RGB565, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD));477 rc = GpiDrawBits(hps, bmpBits RGB565, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR);478 } 479 else rc = GpiDrawBits(hps, bmpBits, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR);509 else RGB555to565((WORD *)bmpBitsBuffer, (WORD *)bmpBits, pOS2bmp->cbImage/sizeof(WORD)); 510 rc = GpiDrawBits(hps, bmpBitsBuffer, pOS2bmp, 4, &point[0], ROP_SRCCOPY, os2mode); 511 } 512 else rc = GpiDrawBits(hps, bmpBits, pOS2bmp, 4, &point[0], ROP_SRCCOPY, os2mode); 480 513 481 514 if(rc == GPI_OK) { -
trunk/src/gdi32/dibsect.h
r3418 r3527 1 /* $Id: dibsect.h,v 1.1 6 2000-04-18 11:11:52sandervl Exp $ */1 /* $Id: dibsect.h,v 1.17 2000-05-12 19:14:56 sandervl Exp $ */ 2 2 3 3 /* … … 102 102 HWND hwndParent; 103 103 HDC hdc; 104 char *bmpBits, *bmpBits RGB565;104 char *bmpBits, *bmpBitsBuffer; 105 105 BOOL fFlip; 106 106 int bmpsize, os2bmphdrsize;
Note:
See TracChangeset
for help on using the changeset viewer.