Changeset 2781 for trunk/src/user32/dc.cpp
- Timestamp:
- Feb 14, 2000, 6:30:11 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dc.cpp
r2705 r2781 1 /* $Id: dc.cpp,v 1.4 6 2000-02-09 15:56:16 sandervlExp $ */1 /* $Id: dc.cpp,v 1.47 2000-02-14 17:30:11 cbratschi Exp $ */ 2 2 3 3 /* … … 549 549 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 550 550 if(!lpps || !wnd) { 551 552 553 551 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 552 O32_SetLastError (ERROR_INVALID_PARAMETER); 553 return (HDC)0; 554 554 } 555 555 HWND hwndClient = wnd->getOS2WindowHandle(); … … 563 563 if (!pHps) 564 564 { 565 565 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 566 566 O32_SetLastError (ERROR_INVALID_PARAMETER); 567 567 return (HDC)NULLHANDLE; 568 568 } 569 569 hpsPaint = hPS_ownDC; 570 570 } 571 571 } 572 572 if(!hpsPaint) { 573 573 hpsPaint = GetDCEx(hwnd, 0, DCX_CACHE_W); 574 574 pHps = (pDCData)GpiQueryDCData(hpsPaint); 575 575 if (!pHps) 576 576 { 577 577 dprintf (("USER32: BeginPaint %x invalid parameter %x", hWnd, lpps)); 578 578 O32_SetLastError (ERROR_INVALID_PARAMETER); 579 579 return (HDC)NULLHANDLE; 580 580 } 581 } 581 } 582 582 583 583 #if 0 … … 601 601 lComplexity = WinQueryUpdateRegion(hwndClient, hrgnUpdate); 602 602 if(lComplexity == RGN_ERROR) { 603 603 dprintf (("USER32: BeginPaint update region error!!")); 604 604 O32_SetLastError (ERROR_INVALID_PARAMETER); 605 605 return 0; 606 606 } 607 607 WinQueryUpdateRect(hwndClient, &rectl); 608 608 609 if(lComplexity != RGN_NULL) { 610 611 612 613 614 609 if(lComplexity != RGN_NULL) { 610 WinValidateRegion(hwndClient, hrgnUpdate, FALSE); 611 612 GpiSetClipRegion(pHps->hps, hrgnUpdate, &hrgnOld); 613 //save old clip region (restored for CS_OWNDC windows in EndPaint) 614 wnd->SetClipRegion(hrgnOld); 615 615 } 616 616 … … 621 621 lpps->fErase = wnd->isPSErase(); //correct ?? 622 622 lpps->hdc = (HDC)pHps->hps; 623 623 624 624 if(lComplexity != RGN_NULL) { 625 626 627 628 629 625 long height = wnd->getClientHeight(); 626 lpps->rcPaint.top = height - rectl.yTop; 627 lpps->rcPaint.left = rectl.xLeft; 628 lpps->rcPaint.bottom = height - rectl.yBottom; 629 lpps->rcPaint.right = rectl.xRight; 630 630 } 631 631 else { 632 633 634 } 635 632 lpps->rcPaint.bottom = lpps->rcPaint.top = 0; 633 lpps->rcPaint.right = lpps->rcPaint.left = 0; 634 } 635 636 636 HideCaret(hwnd); 637 637 … … 660 660 if (pHps && (pHps->hdcType == TYPE_3)) 661 661 { 662 663 664 665 666 667 668 669 else 670 671 672 673 674 675 676 677 //// 662 GpiSetClipRegion(pHps->hps, NULLHANDLE, &hrgnOld); 663 if(hrgnOld) { 664 GpiDestroyRegion(pHps->hps, hrgnOld); 665 } 666 if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) { 667 ReleaseDC(hwnd, pPaint->hdc); 668 } 669 else 670 if(wnd->GetClipRegion()) { 671 //TODO: What else do we need to restore here??? 672 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld); 673 wnd->SetClipRegion(0); 674 pHps->hdcType = TYPE_1; 675 } 676 677 //// WinEndPaint (pHps->hps); 678 678 } 679 679 else { 680 680 dprintf(("EndPaint: wrong hdc %x!!", pPaint->hdc)); 681 681 } 682 682 wnd->setSuppressErase(FALSE); … … 714 714 if (updateRegionExists) 715 715 { 716 717 718 719 720 721 722 716 //CB: for PM empty rect is valid 717 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) { 718 if(pRect) { 719 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 720 } 721 return FALSE; 722 } 723 723 #if 0 724 724 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise) 725 725 // if (wnd->isOwnDC() && wnd->getOwnDC()) 726 727 728 729 730 731 732 733 734 735 736 737 738 726 if (wnd->isOwnDC()) 727 { 728 pDCData pHps = NULL; 729 pHps = (pDCData)GpiQueryDCData(wnd->getOwnDC()); 730 if (!pHps) 731 { 732 O32_SetLastError (ERROR_INVALID_HANDLE); 733 return FALSE; 734 } 735 GpiConvert (pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rectl); 736 } 737 else 738 { 739 739 #endif 740 741 742 743 ////////// 744 745 746 747 748 749 740 long height = wnd->getClientHeight(); 741 rectl.yTop = height - rectl.yTop; 742 rectl.yBottom = height - rectl.yBottom; 743 ////////// } 744 745 if (pRect) 746 WINRECT_FROM_PMRECT (*pRect, rectl); 747 748 if (erase) 749 sendEraseBkgnd (wnd); 750 750 } 751 751 else 752 752 { 753 754 755 753 if(pRect) { 754 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 755 } 756 756 } 757 757 … … 780 780 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE; 781 781 mapOS2ToWin32Rect(hwnd,(PRECTLOS2)&rectl,pRect); 782 } 782 } 783 783 else 784 784 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; … … 827 827 828 828 if(hwnd == 0) { 829 830 831 829 dprintf(("error: GetDCEx window %x not found", hwnd)); 830 O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE); 831 return 0; 832 832 } 833 833 … … 867 867 868 868 pHps->hdcType = TYPE_1; 869 869 dprintf (("User32: GetDCEx hwnd %x (%x %x) -> wnd %x hdc %x", hwnd, hrgn, flags, wnd, hps)); 870 870 return (HDC)hps; 871 871 } … … 913 913 { 914 914 #if 0 //CB: todo 915 916 917 918 919 920 921 922 923 924 915 long height; 916 917 BytesNeeded = GetRegionData (hrgn, 0, NULL); 918 RgnData = (PRGNDATA_W)_alloca (BytesNeeded); 919 if (RgnData == NULL) 920 goto error; 921 GetRegionData (hrgn, BytesNeeded, RgnData); 922 923 i = RgnData->rdh.nCount; 924 pr = (PRECT)(RgnData->Buffer); 925 925 926 926 if (flags & DCX_WINDOW_W) 927 928 927 height = wnd->getWindowHeight(); 928 else height = wnd->getClientHeight(); 929 929 930 930 for (; (i > 0) && success; i--, pr++) { … … 936 936 } 937 937 #endif 938 } 938 } 939 939 else //DCX_INTERSECTRGN_W 940 940 { 941 941 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 942 943 942 dprintf(("ExtSelectClipRgn failed!!")); 943 } 944 944 } 945 945 if (!success) … … 1036 1036 1037 1037 if(pRect) { 1038 1038 dprintf(("RedrawWindow %x (%d,%d)(%d,%d) %x %x", hwnd, pRect->left, pRect->top, pRect->right, pRect->bottom, hrgn, redraw)); 1039 1039 } 1040 1040 else dprintf(("RedrawWindow %x %x %x %x", hwnd, pRect, hrgn, redraw)); … … 1090 1090 // deciding to skip erase? 1091 1091 if(redraw & RDW_NOERASE_W || ((redraw & (RDW_INVALIDATE_W|RDW_ERASE_W|RDW_ERASENOW_W)) == RDW_INVALIDATE_W)) { 1092 1093 } 1094 else 1092 wnd->setSuppressErase(TRUE); 1093 } 1094 else wnd->setSuppressErase(FALSE); 1095 1095 1096 1096 if (hrgn) … … 1160 1160 if(WinQueryUpdateRect(hwnd, NULL)) 1161 1161 { 1162 1163 1164 1165 else1166 1167 1162 if(redraw & RDW_UPDATENOW_W) { 1163 wnd->MsgPaint (0, FALSE); 1164 } 1165 else 1166 if((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W)) 1167 wnd->setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd)); 1168 1168 } 1169 1169 else if((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W)) 1170 1170 { 1171 1172 1173 elsePostMessageA(hwnd, WINWM_PAINT, 0, 0);1171 if(redraw & RDW_UPDATENOW_W) 1172 wnd->MsgPaint (0, FALSE); 1173 else PostMessageA(hwnd, WINWM_PAINT, 0, 0); 1174 1174 } 1175 1175 … … 1200 1200 1201 1201 if(!wnd) { 1202 1203 1202 O32_SetLastError(ERROR_INVALID_WINDOW_HANDLE); 1203 return FALSE; 1204 1204 } 1205 1205
Note:
See TracChangeset
for help on using the changeset viewer.