- Timestamp:
- Apr 18, 2000, 1:11:52 PM (25 years ago)
- Location:
- trunk/src/gdi32
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/blit.cpp
r3343 r3418 1 /* $Id: blit.cpp,v 1. 9 2000-04-07 17:07:16sandervl Exp $ */1 /* $Id: blit.cpp,v 1.10 2000-04-18 11:11:52 sandervl Exp $ */ 2 2 3 3 /* … … 44 44 if(dsect) 45 45 { 46 dprintf((" Do stretched DIB Blt\n"));47 46 rc = dsect->BitBlt( hdcDest, 48 47 nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, … … 192 191 } 193 192 rc = O32_PatBlt(hdc,nXLeft,nYLeft,nWidth,nHeight,dwRop); 194 dprintf(("GDI32: PatBlt (%d,%d) (%d,%d) returned %d\n",nXLeft,nYLeft,nWidth,nHeight,rc)); 193 if(rc) { 194 DIBSection *destdib = DIBSection::findHDC(hdc); 195 if(destdib) { 196 destdib->sync(hdc, nYLeft, nHeight); 197 } 198 } 199 200 dprintf(("GDI32: PatBlt hdc %x (%d,%d) (%d,%d) returned %d\n",hdc, nXLeft,nYLeft,nWidth,nHeight,rc)); 195 201 return(rc); 196 202 } -
trunk/src/gdi32/dibsect.cpp
r3371 r3418 1 /* $Id: dibsect.cpp,v 1.2 7 2000-04-13 18:47:16sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.28 2000-04-18 11:11:52 sandervl Exp $ */ 2 2 3 3 /* … … 381 381 HPS hps = (HPS)hdcDest; 382 382 POINTL point[4]; 383 LONG rc ;383 LONG rc, hdcHeight, hdcWidth; 384 384 PVOID bitmapBits = NULL; 385 385 int oldyinversion = 0; 386 BOOL fRestoryYInversion = FALSE; 387 388 #if 1 389 HWND hwndDest = WindowFromDC(hdcDest); 390 hwndDest = Win32ToOS2Handle(hwndDest); 391 if(hwndDest != 0) 392 { 393 hps = WinGetPS(hwndDest); 394 } 395 if(hps == 0) 396 { 397 dprintf(("ERROR: DIBSection::BitBlt, hps == 0 hwndDest = %X", hwndDest)); 398 return(FALSE); 399 } 400 #endif 401 402 if(nDestWidth == 160 && nDestHeight == 120) { 403 nSrcWidth = 160; 404 } 386 BOOL fRestoryYInversion = FALSE, fFrameWindowDC = FALSE; 387 HWND hwndDest; 388 389 hwndDest = WindowFromDC(hdcDest); 390 //TODO: Test whether dc is for the client or frame window 391 // if(hwndDest && IsOS2FrameWindowHandle(hwndDest)) { 392 // fFrameWindowDC = TRUE; 393 // } 405 394 406 395 dprintf(("DIBSection::BitBlt %x %X (hps %x) %x to(%d,%d)(%d,%d) from (%d,%d)(%d,%d) rop %x flip %x", 407 396 handle, hdcDest, hps, hwndDest, nXdest, nYdest, nDestWidth, nDestHeight, 408 // handle, hdcDest, hps, 0, nXdest, nYdest, nDestWidth, nDestHeight,409 397 nXsrc, nYsrc, nSrcWidth, nSrcHeight, Rop, fFlip)); 410 398 399 if(hwndDest) { 400 RECT rect; 401 402 if(fFrameWindowDC) { 403 GetWindowRect(hwndDest, &rect); 404 } 405 else GetClientRect(hwndDest, &rect); 406 hdcHeight = rect.bottom - rect.top; 407 hdcWidth = rect.right - rect.left; 408 } 409 else { 410 hdcHeight = pOS2bmp->cy; 411 hdcWidth = pOS2bmp->cx; 412 } 413 411 414 //win32 coordinates are of the left top, OS/2 expects left bottom 415 //source rectangle is non-inclusive (top, right not included) 416 if(nXdest + nDestWidth > hdcWidth) { 417 nDestWidth = hdcWidth - nXdest; 418 } 419 if(nYdest + nDestHeight > hdcHeight) { 420 nDestHeight = hdcHeight - nYdest; 421 } 412 422 point[0].x = nXdest; 413 point[0].y = pOS2bmp->cy - nYdest - nDestHeight; 414 point[1].x = nXdest + nDestWidth - 1; 415 point[1].y = pOS2bmp->cy - nYdest - 1; 423 point[0].y = hdcHeight - nYdest - nDestHeight; 424 point[1].x = nXdest + nDestWidth; 425 point[1].y = hdcHeight - nYdest; 426 427 //target rectangle is inclusive-inclusive 428 if(nXsrc + nSrcWidth > pOS2bmp->cx) { 429 nSrcWidth = pOS2bmp->cx - nXsrc; 430 } 431 if(nYsrc + nSrcHeight > pOS2bmp->cy) { 432 nSrcHeight = pOS2bmp->cy - nYsrc; 433 } 416 434 point[2].x = nXsrc; 417 435 point[2].y = pOS2bmp->cy - nYsrc - nSrcHeight; 418 if(nXsrc + nSrcWidth > pOS2bmp->cx) 419 { 420 point[3].x = pOS2bmp->cx; 421 nSrcWidth = pOS2bmp->cx - nXsrc; 422 } 423 else point[3].x = nXsrc + nSrcWidth; 424 425 if(nYsrc + nSrcHeight > pOS2bmp->cy) 426 { 427 point[3].y = pOS2bmp->cy; 428 nSrcHeight = pOS2bmp->cy - nYsrc; 429 } 430 else point[3].y = pOS2bmp->cy - nYsrc; 436 point[3].x = nXsrc + nSrcWidth - 1; 437 point[3].y = pOS2bmp->cy - nYsrc - 1; 431 438 432 439 oldyinversion = GpiQueryYInversion(hps); 433 440 if(fFlip & FLIP_VERT) 434 441 { 435 if(oldyinversion != pOS2bmp->cy-1) {436 GpiEnableYInversion(hps, pOS2bmp->cy-1);442 if(oldyinversion != hdcHeight-1) { 443 GpiEnableYInversion(hps, hdcHeight-1); 437 444 fRestoryYInversion = TRUE; 438 445 } … … 454 461 //SvL: Optimize this.. (don't convert entire bitmap if only a part will be blitted to the dc) 455 462 if(dibinfo.dsBitfields[1] == 0x3E0) {//RGB 555? 456 dprintf(("DIBSection::BitBlt; convert rgb 555 to 565 (old y inv. = %d ", oldyinversion));463 dprintf(("DIBSection::BitBlt; convert rgb 555 to 565 (old y inv. = %d)", oldyinversion)); 457 464 458 465 if(bmpBitsRGB565 == NULL) … … 470 477 DIBSection *destdib = DIBSection::findHDC(hdcDest); 471 478 if(destdib) { 472 dprintf(("Sync destination dibsection %x (%x) (%d)", destdib->handle, hdcDest, oldyinversion)); 473 474 //todo: rgb 565 to 555 conversion if bpp == 16 475 BITMAPINFO2 *tmphdr = (BITMAPINFO2 *)malloc(destdib->os2bmphdrsize); 476 memcpy(tmphdr, destdib->pOS2bmp, destdib->os2bmphdrsize); 477 rc = GpiQueryBitmapBits(hps, nYdest, nDestHeight, destdib->GetDIBObject(), 478 tmphdr); 479 free(tmphdr); 480 if(rc != nDestHeight) { 481 DebugInt3(); 482 } 479 destdib->sync(hps, nYdest, nDestHeight); 483 480 } 484 481 //restore old y inversion height 485 482 if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion); 486 #if 1487 if(hwndDest != 0)488 {489 WinReleasePS(hps);490 }491 #endif492 483 return(TRUE); 493 484 } 494 485 if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion); 495 #if 1 496 if(hwndDest != 0) 497 { 498 WinReleasePS(hps); 499 } 500 #endif 486 501 487 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)); 502 #if 1503 488 dprintf(("WinGetLastError returned %X\n", WinGetLastError(WinQueryAnchorBlock(hwndDest)) & 0xFFFF)); 504 #endif505 489 return(FALSE); 506 490 } 507 491 //****************************************************************************** 508 492 //****************************************************************************** 493 void DIBSection::sync(HDC hdc, DWORD nYdest, DWORD nDestHeight) 494 { 495 APIRET rc; 496 char *destBuf; 497 498 dprintf(("Sync destination dibsection %x (%x)", handle, hdc)); 499 500 //todo: rgb 565 to 555 conversion if bpp == 16 501 if(GetBitCount() == 16) { 502 dprintf(("WARNING: need to convert RGB 565 to RGB 555!!")); 503 } 504 505 BITMAPINFO2 *tmphdr = (BITMAPINFO2 *)malloc(os2bmphdrsize); 506 memcpy(tmphdr, pOS2bmp, os2bmphdrsize); 507 destBuf = GetDIBObject() + nYdest*dibinfo.dsBm.bmWidthBytes; 508 rc = GpiQueryBitmapBits(hdc, nYdest, nDestHeight, destBuf, 509 tmphdr); 510 free(tmphdr); 511 if(rc != nDestHeight) { 512 DebugInt3(); 513 } 514 } 515 //****************************************************************************** 516 //****************************************************************************** 509 517 void DIBSection::SelectDIBObject(HDC hdc) 510 518 { 511 519 this->hdc = hdc; 512 hwndParent = Win WindowFromDC(hdc);520 hwndParent = WindowFromDC(hdc); 513 521 dprintf(("SelectDIBObject %x into %x hwndParent = %x", handle, hdc, hwndParent)); 514 522 } -
trunk/src/gdi32/dibsect.h
r3302 r3418 1 /* $Id: dibsect.h,v 1.1 5 2000-04-02 12:24:40sandervl Exp $ */1 /* $Id: dibsect.h,v 1.16 2000-04-18 11:11:52 sandervl Exp $ */ 2 2 3 3 /* … … 82 82 int nSrcWidth, int nSrcHeight, 83 83 DWORD Rop); 84 84 void sync(HDC hdc, DWORD nYdest, DWORD nDestHeight); 85 85 int SetDIBColorTable(int startIdx, int cEntries, RGBQUAD *rgb); 86 86
Note:
See TracChangeset
for help on using the changeset viewer.