Changeset 2676 for trunk/src/user32/dc.cpp
- Timestamp:
- Feb 7, 2000, 3:30:18 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dc.cpp
r2672 r2676 1 /* $Id: dc.cpp,v 1.4 3 2000-02-06 22:00:22sandervl Exp $ */1 /* $Id: dc.cpp,v 1.44 2000-02-07 14:30:18 sandervl Exp $ */ 2 2 3 3 /* … … 77 77 int WIN32API ReleaseDC(HWND hwnd, HDC hdc); 78 78 BOOL WIN32API PostMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 79 int WIN32API ExtSelectClipRgn(HDC hdc, HRGN hrgn, int fnMode); 79 80 80 81 //****************************************************************************** … … 437 438 //****************************************************************************** 438 439 //****************************************************************************** 440 #if 1 441 HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps) 442 { 443 HWND hwnd = hWnd ? hWnd : HWND_DESKTOP; 444 pDCData pHps = NULLHANDLE; 445 RECTL rect; 446 HPS hPS_ownDC = NULLHANDLE; 447 448 if ( !lpps ) 449 { 450 O32_SetLastError (ERROR_INVALID_PARAMETER); 451 return (HDC)NULLHANDLE; 452 } 453 454 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 455 456 #if 0 457 if ((hwnd != HWND_DESKTOP) && wnd->isOwnDC()) 458 { 459 hPS_ownDC = wnd->getOwnDC(); 460 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise) 461 if(hPS_ownDC) { 462 pHps = (pDCData)GpiQueryDCData(hPS_ownDC); 463 if (!pHps) 464 { 465 O32_SetLastError (ERROR_INVALID_PARAMETER); 466 return (HDC)NULLHANDLE; 467 } 468 } 469 } 470 #endif 471 472 HWND hwndClient = wnd->getOS2WindowHandle(); 473 HPS hps = WinBeginPaint(hwndClient, hPS_ownDC, &rect); 474 475 if (!pHps) 476 { 477 HDC hdc = HPSToHDC (hwndClient, hps, NULL, NULL); 478 pHps = (pDCData)GpiQueryDCData(hps); 479 } 480 481 if (hPS_ownDC == 0) 482 setMapMode (wnd, pHps, MM_TEXT_W); 483 else 484 setPageXForm (wnd, pHps); 485 486 pHps->hdcType = TYPE_3; 487 lpps->hdc = (HDC)hps; 488 489 if(!wnd->isSuppressErase()) { 490 wnd->setSuppressErase(TRUE); 491 wnd->setEraseBkgnd (FALSE, !wnd->MsgEraseBackGround(lpps->hdc)); 492 } 493 lpps->fErase = wnd->isPSErase(); 494 495 if (!hPS_ownDC) 496 { 497 long height = wnd->getClientHeight(); 498 rect.yTop = height - rect.yTop; 499 rect.yBottom = height - rect.yBottom; 500 } 501 else 502 { 503 rect.yTop--; 504 rect.yBottom--; 505 GpiConvert(pHps->hps, CVTC_DEVICE, CVTC_WORLD, 2, (PPOINTL)&rect); 506 } 507 508 WINRECT_FROM_PMRECT(lpps->rcPaint, rect); 509 dprintf(("USER32: BeginPaint %x -> hdc %x (%d,%d)(%d,%d)", hWnd, pHps->hps, lpps->rcPaint.left, lpps->rcPaint.top, lpps->rcPaint.right, lpps->rcPaint.bottom)); 510 511 O32_SetLastError(0); 512 return (HDC)pHps->hps; 513 } 514 515 BOOL WIN32API EndPaint (HWND hwnd, const PAINTSTRUCT_W *pPaint) 516 { 517 pDCData pHps; 518 519 dprintf (("USER32: EndPaint(%x)", hwnd)); 520 521 if (!pPaint || !pPaint->hdc ) 522 return TRUE; 523 524 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 525 526 if (!wnd) goto exit; 527 528 //SvL: Hack for memory.exe (doesn't get repainted properly otherwise) 529 pHps = (pDCData)GpiQueryDCData((HPS)pPaint->hdc); 530 if (pHps && (pHps->hdcType == TYPE_3)) { 531 WinEndPaint (pHps->hps); 532 } 533 wnd->setSuppressErase(FALSE); 534 535 exit: 536 O32_SetLastError(0); 537 return TRUE; 538 } 539 #else 439 540 HDC WIN32API BeginPaint (HWND hWnd, PPAINTSTRUCT_W lpps) 440 541 { … … 563 664 GpiDestroyRegion(pHps->hps, hrgnOld); 564 665 } 565 //todo restore old clip region for CS_OWNDC windows566 666 if(hwnd == HWND_DESKTOP || !wnd->isOwnDC()) { 567 667 ReleaseDC(hwnd, pPaint->hdc); … … 587 687 return TRUE; 588 688 } 689 #endif 589 690 //****************************************************************************** 590 691 //****************************************************************************** … … 710 811 // DCX_EXCLUDERGN (complex regions allowed) 711 812 // DCX_INTERSECTRGN (complex regions allowed) 813 // 814 //TODO: WM_SETREDRAW affects drawingAllowed flag!! 712 815 //****************************************************************************** 713 816 HDC WIN32API GetDCEx (HWND hwnd, HRGN hrgn, ULONG flags) … … 806 909 goto error; 807 910 808 BytesNeeded = O32_GetRegionData (hrgn, 0, NULL);809 RgnData = (PRGNDATA_W)_alloca (BytesNeeded);810 if (RgnData == NULL)811 goto error;812 O32_GetRegionData (hrgn, BytesNeeded, RgnData);813 814 i = RgnData->rdh.nCount;815 pr = (PRECT)(RgnData->Buffer);816 817 911 success = TRUE; 818 912 if (flags & DCX_EXCLUDERGN_W) … … 820 914 #if 0 //CB: todo 821 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 822 926 if (flags & DCX_WINDOW_W) 823 927 height = wnd->getWindowHeight(); … … 835 939 else //DCX_INTERSECTRGN_W 836 940 { 837 O32_SelectClipRgn(pHps->hps,hrgn); //CB: works so far 941 if(ExtSelectClipRgn(pHps->hps, hrgn, RGN_AND_W) == ERROR_W) { 942 dprintf(("ExtSelectClipRgn failed!!")); 943 } 838 944 } 839 945 if (!success) … … 846 952 pHps->psType = psType; 847 953 pHps->hdcType = TYPE_1; 954 //TODO: WM_SETREDRAW affects drawingAllowed flag!! 848 955 GpiSetDrawControl (hps, DCTL_DISPLAY, drawingAllowed ? DCTL_ON : DCTL_OFF); 849 956 … … 980 1087 if (redraw & RDW_UPDATENOW_W) redraw &= ~RDW_ERASENOW_W; 981 1088 982 if (redraw & RDW_NOERASE_W || !(redraw & (RDW_ERASE_W|RDW_ERASENOW_W))) {1089 if (redraw & RDW_NOERASE_W) { 983 1090 wnd->setSuppressErase(TRUE); 984 1091 } 985 1092 else wnd->setSuppressErase(FALSE); 986 987 // if (redraw & RDW_NOERASE_W)988 // wnd->setEraseBkgnd (FALSE);989 990 //SvL: Test991 // if (redraw & RDW_UPDATENOW_W)992 // wnd->setSuppressErase (FALSE);993 // else if (redraw & RDW_ERASENOW_W)994 // wnd->setSuppressErase (FALSE);995 1093 996 1094 if (hrgn)
Note:
See TracChangeset
for help on using the changeset viewer.