Changeset 7717 for trunk/src/gdi32/dibsect.cpp
- Timestamp:
- Dec 31, 2001, 1:08:23 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gdi32/dibsect.cpp
r7662 r7717 1 /* $Id: dibsect.cpp,v 1.6 1 2001-12-20 19:57:01sandervl Exp $ */1 /* $Id: dibsect.cpp,v 1.62 2001-12-31 12:08:20 sandervl Exp $ */ 2 2 3 3 /* … … 20 20 #include <win32type.h> 21 21 #include <misc.h> 22 #define OS2_ONLY23 #include "dibsect.h"24 #include <vmutex.h>25 22 #include <win32api.h> 26 23 #include <winconst.h> … … 28 25 #include <cpuhlp.h> 29 26 #include <dcdata.h> 27 #include "dibsect.h" 30 28 #include "oslibgpi.h" 31 29 #include "rgbcvt.h" … … 33 31 #define DBG_LOCALLOG DBG_dibsect 34 32 #include "dbglocal.h" 35 36 static VMutex dibMutex;37 33 38 34 //****************************************************************************** … … 176 172 this->iUsage = iUsage; 177 173 178 dibMutex.enter();174 lock(); 179 175 if(section == NULL) 180 176 { … … 195 191 dsect->next = this; 196 192 } 197 dibMutex.leave();193 unlock(); 198 194 } 199 195 //****************************************************************************** … … 216 212 free(pOS2bmp); 217 213 218 dibMutex.enter();214 lock(); 219 215 if(section == this) 220 216 { … … 231 227 dsect->next = this->next; 232 228 } 233 dibMutex.leave();229 unlock(); 234 230 } 235 231 //****************************************************************************** … … 489 485 hdcHeight = rect.bottom - rect.top; 490 486 hdcWidth = rect.right - rect.left; 487 dprintf(("DIBSection::BitBlt hdc size (%d,%d) (WINDOW)", hdcWidth, hdcHeight)); 491 488 } 492 489 else { 493 490 hdcHeight = pHps->bitmapHeight; 494 491 hdcWidth = pHps->bitmapWidth; 492 dprintf(("DIBSection::BitBlt hdc size (%d,%d) (BMP)", hdcWidth, hdcHeight)); 495 493 } 496 494 … … 498 496 //This messes up the two bitmaps in the opening window of Opera 6 499 497 //(choice between MDI & SDI interface) 500 #if 0501 if(nXdest + nDestWidth > hdcWidth) {502 nDestWidth = hdcWidth - nXdest;503 }504 505 if(nYdest + nDestHeight > hdcHeight) {506 nDestHeight = hdcHeight - nYdest;507 }508 #endif509 498 510 499 //win32 coordinates are relative to left top, OS/2 expects left bottom … … 513 502 514 503 point[0].x = nXdest; 504 point[1].x = nXdest + nDestWidth - 1; 505 #ifdef INVERT 515 506 point[0].y = hdcHeight - nYdest - nDestHeight; 516 point[1].x = nXdest + nDestWidth - 1;517 507 point[1].y = hdcHeight - nYdest - 1; 518 519 #if 0 520 //Don't check size here either. Let GpiDrawBits do that for us 521 if(nXsrc + nSrcWidth > pOS2bmp->cx) { 522 nSrcWidth = pOS2bmp->cx - nXsrc; 523 } 524 if(nYsrc + nSrcHeight > pOS2bmp->cy) { 525 nSrcHeight = pOS2bmp->cy - nYsrc; 526 } 508 #else 509 point[0].y = nYdest; 510 point[1].y = nYdest + nDestHeight - 1; 527 511 #endif 528 512 529 513 //target rectangle is inclusive-inclusive 530 514 point[2].x = nXsrc; 515 point[3].x = nXsrc + nSrcWidth; 516 #ifdef INVERT 531 517 point[2].y = pOS2bmp->cy - nYsrc - nSrcHeight; 532 point[3].x = nXsrc + nSrcWidth;533 518 point[3].y = pOS2bmp->cy - nYsrc; 519 #else 520 point[2].y = nYsrc; 521 point[3].y = nYsrc + nSrcHeight - 1; 522 #endif 534 523 535 524 dprintf(("DIBSection::BitBlt (%d,%d)(%d,%d) from (%d,%d)(%d,%d) dim (%d,%d)(%d,%d)", point[0].x, point[0].y, … … 540 529 oldyinversion = GpiQueryYInversion(hps); 541 530 if(oldyinversion != 0) { 531 #ifdef DEBUG 532 POINT point; 533 GetViewportOrgEx(hps, &point); 534 dprintf(("Viewport origin (%d,%d)", point.x, point.y)); 535 #endif 542 536 GpiEnableYInversion(hps, 0); 543 537 fRestoryYInversion = TRUE; … … 631 625 if(fRestoryYInversion) GpiEnableYInversion(hps, oldyinversion); 632 626 #endif 633 627 SetLastError(ERROR_SUCCESS_W); 634 628 635 629 return(TRUE); … … 661 655 dprintf(("Sync destination dibsection: hdc y inversion = %d", oldyinversion)); 662 656 if(oldyinversion != 0) { 657 #ifdef DEBUG 658 POINT point; 659 GetViewportOrgEx(hdc, &point); 660 dprintf(("Viewport origin (%d,%d)", point.x, point.y)); 661 #endif 663 662 GpiEnableYInversion(hdc, 0); 664 663 } … … 774 773 775 774 DIBSection *dsect = section; 776 dibMutex.enter();775 lock(); 777 776 778 777 do … … 780 779 if(dsect->handle == handle) 781 780 { 782 dibMutex.leave();781 unlock(); 783 782 return(dsect); 784 783 } … … 787 786 while(dsect); 788 787 789 dibMutex.leave();788 unlock(); 790 789 return(NULL); 791 790 } … … 801 800 DIBSection *dsect = section; 802 801 802 lock(); 803 803 do 804 804 { 805 805 if(dsect->hdc == hdc) 806 806 { 807 unlock(); 807 808 return(dsect); 808 809 } … … 810 811 } 811 812 while(dsect); 812 813 814 unlock(); 813 815 return(NULL); 814 816 } … … 873 875 //****************************************************************************** 874 876 //****************************************************************************** 875 DIBSection *DIBSection::section = NULL; 877 void DIBSection::initDIBSection() 878 { 879 InitializeCriticalSection(&dibcritsect); 880 } 881 //****************************************************************************** 882 //****************************************************************************** 883 DIBSection *DIBSection::section = NULL; 884 CRITICAL_SECTION DIBSection::dibcritsect;
Note:
See TracChangeset
for help on using the changeset viewer.