- Timestamp:
- Apr 2, 2000, 2:24:40 PM (25 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r3298 r3302 1 /* $Id: blit.cpp,v 1. 7 2000-04-02 10:12:53sandervl Exp $ */1 /* $Id: blit.cpp,v 1.8 2000-04-02 12:24:39 sandervl Exp $ */ 2 2 3 3 /* … … 38 38 dprintf(("GDI32: StretchBlt Src : %x (%d, %d) size (%d, %d)\n", 39 39 hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc)); 40 SetLastError(0); 40 41 if(DIBSection::getSection() != NULL) 41 42 { … … 59 60 BOOL rc; 60 61 62 SetLastError(0); 61 63 if(DIBSection::getSection() != NULL) { 62 64 DIBSection *dsect = DIBSection::findHDC(hdcSrc); 63 65 if(dsect) { 64 rc = dsect->BitBlt(hdcDest, arg2, arg3, arg4, arg5, arg7, arg8, arg4, arg5, arg9); 65 if(rc) { 66 BITMAPINFO bmpinfo = {0}; 67 DIBSection *dest = DIBSection::findHDC(hdcDest); 68 if(dest) { 69 dprintf(("Sync dest DIB section")); 70 bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); 71 GetDIBits(hdcDest, dest->GetBitmapHandle(), 0, 0, 0, &bmpinfo, dest->GetRGBUsage()); 72 dprintf(("height %d", bmpinfo.bmiHeader.biHeight)); 73 dprintf(("width %d", bmpinfo.bmiHeader.biWidth)); 74 dprintf(("biBitCount %d", bmpinfo.bmiHeader.biBitCount)); 75 GetDIBits(hdcDest, dest->GetBitmapHandle(), 0, bmpinfo.bmiHeader.biHeight, dest->GetDIBObject(), &bmpinfo, dest->GetRGBUsage()); 76 } 77 } 78 return rc; 66 return dsect->BitBlt(hdcDest, arg2, arg3, arg4, arg5, arg7, arg8, arg4, arg5, arg9); 79 67 } 80 68 } -
trunk/src/gdi32/dibsect.cpp
r3292 r3302 1 /* $Id: dibsect.cpp,v 1.2 4 2000-04-01 15:05:30 sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.25 2000-04-02 12:24:40 sandervl Exp $ */ 2 2 3 3 /* … … 40 40 : bmpBits(NULL), pOS2bmp(NULL), next(NULL), bmpBitsRGB565(NULL) 41 41 { 42 int os2bmpsize;43 44 42 bmpsize = pbmi->biWidth; 45 43 /* @@@PH 98/06/07 -- high-color bitmaps don't have palette */ 46 44 47 45 this->fFlip = fFlip; 48 os2bmp size = sizeof(BITMAPINFO2);46 os2bmphdrsize = sizeof(BITMAPINFO2); 49 47 50 48 switch(pbmi->biBitCount) … … 52 50 case 1: 53 51 bmpsize = ((bmpsize + 31) & ~31) / 8; 54 os2bmp size += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2);52 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2); 55 53 break; 56 54 case 4: 57 55 bmpsize = ((bmpsize + 7) & ~7) / 2; 58 os2bmp size += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2);56 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2); 59 57 break; 60 58 case 8: 61 os2bmp size += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2);59 os2bmphdrsize += ((1 << pbmi->biBitCount)-1)*sizeof(RGB2); 62 60 bmpsize = (bmpsize + 3) & ~3; 63 61 break; … … 92 90 memset(bmpBits, 0, bmpsize*pbmi->biHeight); 93 91 94 pOS2bmp = (BITMAPINFO2 *)malloc(os2bmp size);92 pOS2bmp = (BITMAPINFO2 *)malloc(os2bmphdrsize); 95 93 96 94 memset(pOS2bmp, /* set header + palette entries to zero */ 97 95 0, 98 os2bmp size);96 os2bmphdrsize); 99 97 100 98 pOS2bmp->cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2); … … 238 236 { 239 237 lines = (int)lines >= 0 ? (int)lines : (int)-lines; 240 int os2bmpsize;241 238 int palsize=0; 242 239 243 240 bmpsize = pbmi->biWidth; 244 os2bmp size = sizeof(BITMAPINFO2);241 os2bmphdrsize = sizeof(BITMAPINFO2); 245 242 246 243 switch(pbmi->biBitCount) … … 249 246 bmpsize = ((bmpsize + 31) & ~31) / 8; 250 247 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 251 os2bmp size += palsize;248 os2bmphdrsize += palsize; 252 249 break; 253 250 case 4: 254 251 bmpsize = ((bmpsize + 7) & ~7) / 2; 255 252 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 256 os2bmp size += palsize;253 os2bmphdrsize += palsize; 257 254 break; 258 255 case 8: 259 256 palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2); 260 os2bmp size += palsize;257 os2bmphdrsize += palsize; 261 258 bmpsize = (bmpsize + 3) & ~3; 262 259 break; … … 285 282 DosFreeMem(oldbits); 286 283 } 287 pOS2bmp = (BITMAPINFO2 *)realloc(pOS2bmp, os2bmp size);284 pOS2bmp = (BITMAPINFO2 *)realloc(pOS2bmp, os2bmphdrsize); 288 285 pOS2bmp->cbFix = sizeof(BITMAPINFO2) - sizeof(RGB2); 289 286 pOS2bmp->cx = pbmi->biWidth; … … 386 383 LONG rc; 387 384 PVOID bitmapBits = NULL; 385 int oldyinversion = 0; 388 386 389 387 HWND hwndDest = WindowFromDC(hdcDest); … … 412 410 if(nXsrc + nSrcWidth > pOS2bmp->cx) 413 411 { 414 point[3].x = pOS2bmp->cx;415 } 416 else417 point[3].x = nXsrc + nSrcWidth;412 point[3].x = pOS2bmp->cx; 413 nSrcWidth = pOS2bmp->cx - nXsrc; 414 } 415 else point[3].x = nXsrc + nSrcWidth; 418 416 419 417 if(nYsrc + nSrcHeight > pOS2bmp->cy) 420 418 { 421 point[3].y = pOS2bmp->cy; 422 } 423 else 424 point[3].y = pOS2bmp->cy - nYsrc; 425 426 427 #if 1 419 point[3].y = pOS2bmp->cy; 420 nSrcHeight = pOS2bmp->cy - nYsrc; 421 } 422 else point[3].y = pOS2bmp->cy - nYsrc; 423 424 oldyinversion = GpiQueryYInversion(hps); 428 425 if(fFlip & FLIP_VERT) 429 426 { 430 GpiEnableYInversion(hps, nDestHeight); 431 } 427 GpiEnableYInversion(hps, nDestHeight-1); 428 } 429 else GpiEnableYInversion(hps, 0); 432 430 433 431 if(fFlip & FLIP_HOR) 434 432 { 435 ULONG x; 436 x = point[0].x; 437 point[0].x = point[1].x; 438 point[1].x = x; 439 } 440 #endif 433 ULONG x; 434 x = point[0].x; 435 point[0].x = point[1].x; 436 point[1].x = x; 437 } 441 438 442 439 //SvL: Optimize this.. (don't convert entire bitmap if only a part will be blitted to the dc) … … 455 452 else rc = GpiDrawBits(hps, bmpBits, pOS2bmp, 4, &point[0], ROP_SRCCOPY, BBO_OR); 456 453 454 if(rc == GPI_OK) { 455 DIBSection *destdib = DIBSection::findHDC(hdcDest); 456 if(destdib) { 457 dprintf(("Sync destination dibsection %x (%x) (%d)", destdib->handle, hdcDest, oldyinversion)); 458 459 //todo: rgb 565 to 555 conversion if bpp == 16 460 BITMAPINFO2 *tmphdr = (BITMAPINFO2 *)malloc(destdib->os2bmphdrsize); 461 memcpy(tmphdr, destdib->pOS2bmp, destdib->os2bmphdrsize); 462 rc = GpiQueryBitmapBits(hps, nYdest, nDestHeight, destdib->GetDIBObject(), 463 tmphdr); 464 free(tmphdr); 465 if(rc != nDestHeight) { 466 DebugInt3(); 467 } 468 } 469 //restore old y inversion height 470 GpiEnableYInversion(hps, oldyinversion); 471 if(hwndDest != 0) 472 { 473 WinReleasePS(hps); 474 } 475 return(TRUE); 476 } 477 GpiEnableYInversion(hps, oldyinversion); 457 478 if(hwndDest != 0) 458 479 { 459 WinReleasePS(hps); 460 } 461 if(rc == GPI_OK) { 462 return(TRUE); 480 WinReleasePS(hps); 463 481 } 464 482 dprintf(("DIBSection::BitBlt %X (%d,%d) (%d,%d) to (%d,%d) (%d,%d) returned %d\n", hps, point[0].x, point[0].y, point[1].x, point[1].y, point[2].x, point[2].y, point[3].x, point[3].y, rc)); -
trunk/src/gdi32/dibsect.h
r3235 r3302 1 /* $Id: dibsect.h,v 1.1 4 2000-03-25 12:19:08sandervl Exp $ */1 /* $Id: dibsect.h,v 1.15 2000-04-02 12:24:40 sandervl Exp $ */ 2 2 3 3 /* … … 85 85 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb); 86 86 87 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT87 int SetDIBits(HDC hdc, HBITMAP hbitmap, UINT startscan, UINT 88 88 lines, const VOID *bits, BITMAPINFOHEADER_W *pbmi, 89 89 UINT coloruse); … … 104 104 char *bmpBits, *bmpBitsRGB565; 105 105 BOOL fFlip; 106 int bmpsize ;106 int bmpsize, os2bmphdrsize; 107 107 DIBSECTION dibinfo; 108 108
Note:
See TracChangeset
for help on using the changeset viewer.