Changeset 10316 for trunk/src/user32/dc.cpp
- Timestamp:
- Nov 12, 2003, 3:13:26 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/src/user32/dc.cpp (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dc.cpp
r10093 r10316 1 /* $Id: dc.cpp,v 1.12 1 2003-05-15 13:12:52sandervl Exp $ */1 /* $Id: dc.cpp,v 1.122 2003-11-12 14:10:18 sandervl Exp $ */ 2 2 3 3 /* … … 594 594 HDC hdc; 595 595 HPS hps; 596 HRGN hrgnUpdate , hrgnOld, hrgnClip, hrgnCombined;596 HRGN hrgnUpdate; 597 597 RECTL rectl = { 1, 1, 2, 2 }; 598 pDCData pHps = NULLHANDLE; 598 599 599 600 hwnd = wnd->getOS2WindowHandle(); … … 602 603 hrgnUpdate = GpiCreateRegion (hps, 1, &rectl); 603 604 WinQueryUpdateRegion (hwnd, hrgnUpdate); 604 hrgnClip = GpiQueryClipRegion (hps);605 606 if (hrgnClip == NULLHANDLE)607 {608 GpiSetClipRegion (hps, hrgnUpdate, &hrgnOld);609 }610 else611 {612 hrgnCombined = GpiCreateRegion (hps, 1, &rectl);613 GpiCombineRegion (hps, hrgnCombined, hrgnClip, hrgnUpdate, CRGN_AND);614 GpiSetClipRegion (hps, hrgnCombined, &hrgnOld);615 GpiDestroyRegion (hps, hrgnUpdate);616 GpiDestroyRegion (hps, hrgnClip);617 }618 if (hrgnOld != NULLHANDLE)619 GpiDestroyRegion (hps, hrgnOld);620 605 621 606 hdc = HPSToHDC (hwnd, hps, NULL, NULL); 607 608 pHps = (pDCData)GpiQueryDCData(hps); 609 GdiSetVisRgn(pHps, hrgnUpdate); 622 610 623 611 erased = wnd->MsgEraseBackGround (hdc); … … 676 664 return (HDC)0; 677 665 } 678 // bIcon = (IsIconic(hwnd) && GetClassLongA(hWnd, GCL_HICON_W));679 666 bIcon = IsIconic(hwnd); 680 667 … … 725 712 } 726 713 727 HRGN hrgnClip = GpiCreateRegion(pHps->hps, 1, &rectl); 728 GpiSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip); 714 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint) 715 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip)); 716 wnd->SaveClipRegion(pHps->hrgnWin32Clip); 717 wnd->SaveVisRegion(pHps->hrgnWinVis); 718 719 //clear visible and clip regions 720 pHps->hrgnWin32Clip = NULLHANDLE; 721 pHps->hrgnWinVis = NULLHANDLE; 722 723 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectl); 724 GdiSetVisRgn(pHps, hrgnVis); 729 725 730 726 selectClientArea(wnd, pHps); 731 727 732 //save old clip region (restored for CS_OWNDC windows in EndPaint)733 wnd->SetClipRegion(hrgnOldClip);734 728 if(bIcon) { 735 729 lComplexity = RGN_RECT; … … 742 736 743 737 //Query update region 744 HRGN hrgn Clip= GpiCreateRegion(pHps->hps, 1, &rectlClip);745 WinQueryUpdateRegion(hwndClient, hrgn Clip);746 WinValidateRegion(hwndClient, hrgn Clip, FALSE);747 748 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgn Clip);738 HRGN hrgnVis = GpiCreateRegion(pHps->hps, 1, &rectlClip); 739 WinQueryUpdateRegion(hwndClient, hrgnVis); 740 WinValidateRegion(hwndClient, hrgnVis, FALSE); 741 742 dprintfRegion(pHps->hps, wnd->getWindowHandle(), hrgnVis); 749 743 750 744 #ifdef DEBUG … … 754 748 #endif 755 749 750 //save old clip and visible regions (restored for CS_OWNDC windows in EndPaint) 751 dprintf(("Old visible region %x; old clip region %x", pHps->hrgnWinVis, pHps->hrgnWin32Clip)); 752 wnd->SaveClipRegion(pHps->hrgnWin32Clip); 753 wnd->SaveVisRegion(pHps->hrgnWinVis); 754 755 //clear visible and clip regions 756 pHps->hrgnWin32Clip = NULLHANDLE; 757 pHps->hrgnWinVis = NULLHANDLE; 758 756 759 //set clip region 757 lComplexity = G piSetClipRegion(pHps->hps, hrgnClip, &hrgnOldClip);758 759 if(lComplexity == RGN_NULL) {760 lComplexity = GdiSetVisRgn(pHps, hrgnVis); 761 762 if(lComplexity == NULLREGION_W) { 760 763 dprintf (("BeginPaint %x: EMPTY update rectangle (vis=%d/%d show=%d/%d", hWnd, WinIsWindowVisible(wnd->getOS2FrameWindowHandle()), WinIsWindowVisible(wnd->getOS2WindowHandle()), WinIsWindowShowing(wnd->getOS2FrameWindowHandle()), WinIsWindowShowing(wnd->getOS2WindowHandle()))); 761 764 } … … 769 772 dprintf(("ClipBox (%d): (%d,%d)(%d,%d)", lComplexity, rectlClip.xLeft, rectlClip.yBottom, rectlClip.xRight, rectlClip.yTop)); 770 773 #endif 771 //save old clip region (restored for CS_OWNDC windows in EndPaint)772 wnd->SetClipRegion(hrgnOldClip);773 774 } 774 775 … … 783 784 WinShowTrackRect(wnd->getOS2WindowHandle(), FALSE); 784 785 785 if((wnd->needsEraseBkgnd() || wnd-> IsVisibleRegionChanged()) && lComplexity != RGN_NULL) {786 wnd->setEraseBkgnd(FALSE);787 wnd->SetVisibleRegionChanged(FALSE);788 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0);786 if((wnd->needsEraseBkgnd() || wnd->hasPMUpdateRegionChanged()) && lComplexity != RGN_NULL) { 787 wnd->setEraseBkgnd(FALSE); 788 wnd->SetPMUpdateRegionChanged(FALSE); 789 lpps->fErase = (wnd->MsgEraseBackGround(pHps->hps) == 0); 789 790 } 790 791 else lpps->fErase = TRUE; … … 817 818 { 818 819 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP; 819 HRGN hrgnOld;820 820 pDCData pHps; 821 821 … … 832 832 if (pHps && (pHps->hdcType == TYPE_3)) 833 833 { 834 GpiSetClipRegion(pHps->hps, wnd->GetClipRegion(), &hrgnOld); 835 wnd->SetClipRegion(0); 836 if(hrgnOld) { 837 GpiDestroyRegion(pHps->hps, hrgnOld); 838 } 834 //restore previous visible and clip regions 835 pHps->hrgnWin32Clip = NULLHANDLE; 836 pHps->hrgnWinVis = NULLHANDLE; 837 838 GdiSetVisRgn(pHps, wnd->GetVisRegion()); 839 GdiCombineVisRgnClipRgn(pHps, wnd->GetClipRegion(), RGN_AND_W); 840 841 wnd->SaveClipRegion(0); 842 wnd->SaveVisRegion(0); 843 839 844 pHps->hdcType = TYPE_1; //otherwise Open32's ReleaseDC fails 840 845 ReleaseDC(hwnd, pPaint->hdc); … … 879 884 if(pHps && pHps->psType == MICRO_CACHED) { 880 885 removeClientArea(wnd, pHps); 881 if(pHps->hrgnVis) { 882 GreDestroyRegion(pHps->hps, pHps->hrgnVis); 883 pHps->hrgnVis = 0; 886 if(pHps->hrgnWinVis) { 887 GreDestroyRegion(pHps->hps, pHps->hrgnWinVis); 888 pHps->hrgnWinVis = 0; 889 } 890 if(pHps->hrgnWin32Clip) { 891 GreDestroyRegion(pHps->hps, pHps->hrgnWin32Clip); 892 pHps->hrgnWin32Clip = 0; 884 893 } 885 894 } … … 912 921 } 913 922 //****************************************************************************** 914 // This implementation of GetDCEx supports 923 // This implementation of GetDCEx supports: 924 // 915 925 // DCX_WINDOW 916 926 // DCX_CACHE … … 922 932 // DCX_PARENTCLIP 923 933 // 934 // Not supported: 935 // 936 // DCX_NORESETATTRS_W 937 // DCX_INTERSECTUPDATE_W 938 // DCX_LOCKWINDOWUPDATE_W 939 // DCX_VALIDATE_W 940 // DCX_EXCLUDEUPDATE_W 941 // 924 942 //TODO: WM_SETREDRAW affects drawingAllowed flag!! 925 943 //****************************************************************************** … … 935 953 BOOL creatingOwnDC = FALSE; 936 954 PS_Type psType; 955 956 if(flags & (DCX_NORESETATTRS_W | DCX_INTERSECTUPDATE_W | DCX_LOCKWINDOWUPDATE_W | DCX_VALIDATE_W | DCX_EXCLUDEUPDATE_W)) { 957 dprintf(("ERROR: GetDCEx: unsupported flags %x!!", flags)); 958 DebugInt3(); 959 } 937 960 938 961 if(hwnd == 0) { … … 1066 1089 success = TRUE; 1067 1090 if (flags & DCX_EXCLUDERGN_W) 1068 { 1069 #if 0 //CB: todo 1070 long height; 1071 1072 BytesNeeded = GetRegionData (hrgn, 0, NULL); 1073 RgnData = (PRGNDATA_W)_alloca (BytesNeeded); 1074 if (RgnData == NULL) 1075 goto error; 1076 GetRegionData (hrgn, BytesNeeded, RgnData); 1077 1078 i = RgnData->rdh.nCount; 1079 pr = (PRECT)(RgnData->Buffer); 1080 1081 if (flags & DCX_WINDOW_W) 1082 height = wnd->getWindowHeight(); 1083 else height = wnd->getClientHeight(); 1084 1085 for (; (i > 0) && success; i--, pr++) { 1086 LONG y = pr->yBottom; 1087 1088 pr->yBottom = height - pr->yTop; 1089 pr->yTop = height - y; 1090 success &= GpiExcludeClipRectangle (pHps->hps, pr); 1091 } 1092 #endif 1091 {//exclude specified region from visible region 1092 success = (GdiCombineVisRgn(pHps, hrgn, RGN_DIFF_W) != ERROR_W); 1093 1093 } 1094 1094 else //DCX_INTERSECTRGN_W 1095 { 1096 //SvL: I'm getting paint problems when clipping a dc created in GetDCEx 1097 // with a region that covers the entire window (RealPlayer 7 Update 1) 1098 // Using SelectClipRgn here doesn't make any difference. 1099 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 1100 dprintf(("ExtSelectClipRgn failed!!")); 1101 } 1095 {//intersect visible region with specified region 1096 success = (GdiCombineVisRgn(pHps, hrgn, RGN_AND_W) != ERROR_W); 1102 1097 } 1103 1098 if (!success) … … 1292 1287 //already (partly) invalidated 1293 1288 if (!WinQueryUpdateRect (hwnd, NULL)) { 1289 dprintf(("RDW_INVALIDATE: no update rectangle, disable %x WM_ERASEBKGND", wnd->getWindowHandle())); 1294 1290 wnd->setEraseBkgnd(FALSE); 1295 1291 } … … 1332 1328 else if (redraw & RDW_VALIDATE_W) 1333 1329 { 1334 if (redraw & RDW_NOERASE_W) 1330 if (redraw & RDW_NOERASE_W) { 1331 dprintf(("RDW_NOERASE: disable %x WM_ERASEBKGND", wnd->getWindowHandle())); 1335 1332 wnd->setEraseBkgnd(FALSE); 1336 1333 } 1337 1334 if (WinQueryUpdateRect (hwnd, NULL)) 1338 1335 {
Note:
See TracChangeset
for help on using the changeset viewer.
