Changeset 5685 for trunk/src/user32/dcrgn.cpp
- Timestamp:
- May 11, 2001, 10:39:46 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dcrgn.cpp
r3725 r5685 1 /* $Id: dcrgn.cpp,v 1. 3 2000-06-17 11:56:14sandervl Exp $ */1 /* $Id: dcrgn.cpp,v 1.4 2001-05-11 08:39:42 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 BOOL WIN32API GetUpdateRect(HWND hwnd, LPRECT pRect, BOOL erase) 47 47 { 48 if (!hwnd)49 {50 51 52 53 }54 55 RECTL rectl, rectlClient;56 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);57 58 if (!wnd)59 {60 61 62 63 }64 65 dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase));66 67 BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL);68 if (!pRect) {69 return (updateRegionExists);70 }71 72 if(updateRegionExists)73 {48 if (!hwnd) 49 { 50 dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase)); 51 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 52 return FALSE; 53 } 54 55 RECTL rectl, rectlClient; 56 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 57 58 if (!wnd) 59 { 60 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 61 dprintf(("GetUpdateRect %x %x %d -> invalid handle!!", hwnd, pRect, erase)); 62 return FALSE; 63 } 64 65 dprintf(("GetUpdateRect %x %x %d", hwnd, pRect, erase)); 66 67 BOOL updateRegionExists = WinQueryUpdateRect(wnd->getOS2WindowHandle(), pRect ? &rectl : NULL); 68 if (!pRect) { 69 return (updateRegionExists); 70 } 71 72 if(updateRegionExists) 73 { 74 74 //CB: for PM empty rect is valid 75 75 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) { 76 if(pRect) { 77 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 78 } 79 return FALSE; 80 } 81 mapWin32ToOS2Rect(wnd->getWindowHeight(), wnd->getClientRectPtr(), (PRECTLOS2)&rectlClient); 82 WinIntersectRect(NULL, &rectl, &rectl, &rectlClient); 83 mapOS2ToWin32RectFrameToClient(wnd, (PRECTLOS2)&rectl, pRect); 76 if(pRect) { 77 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 78 } 79 return FALSE; 80 } 81 mapOS2ToWin32Rect(wnd->getClientHeight(), (PRECTLOS2)&rectl, pRect); 84 82 85 83 if(wnd->isOwnDC() && GetMapMode(wnd->getOwnDC()) != MM_TEXT_W) 86 84 { 87 85 DPtoLP(wnd->getOwnDC(), (LPPOINT)pRect, 2); 88 86 } 89 87 if (erase) 90 88 sendEraseBkgnd (wnd); 91 89 } 92 90 else 93 91 { 94 92 if(pRect) { 95 93 pRect->left = pRect->top = pRect->right = pRect->bottom = 0; 96 94 } 97 95 } … … 100 98 } 101 99 //****************************************************************************** 102 //******************************************************************************103 BOOL GetOS2UpdateRect(Win32BaseWindow *window, LPRECT pRect)104 {105 RECTL rectl;106 BOOL updateRegionExists = WinQueryUpdateRect(window->getOS2WindowHandle(),pRect ? &rectl:NULL);107 108 if (!pRect)109 return (updateRegionExists);110 111 if (updateRegionExists)112 {113 //CB: for PM empty rect is valid114 if ((rectl.xLeft == rectl.xRight) || (rectl.yTop == rectl.yBottom)) return FALSE;115 mapOS2ToWin32Rect(window->getWindowHeight(), (PRECTLOS2)&rectl,pRect);116 }117 else118 pRect->left = pRect->top = pRect->right = pRect->bottom = 0;119 120 return updateRegionExists;121 }122 //******************************************************************************123 100 //TODO: Seems to return region in window coordinates instead of client coordinates 124 101 //****************************************************************************** 125 102 int WIN32API GetUpdateRgn(HWND hwnd, HRGN hrgn, BOOL erase) 126 103 { 127 LONG lComplexity; 128 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 129 130 hrgn = ObjWinToOS2Region(hrgn); 131 if(!wnd || !hrgn) 132 { 133 dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase)); 134 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 135 return ERROR_W; 136 } 137 lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn); 138 if(lComplexity == RGN_ERROR) { 139 dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase)); 140 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 141 return ERROR_W; 142 } 143 144 if(lComplexity != RGN_NULL) 145 { 146 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle())) 147 { 148 dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase)); 149 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 150 return ERROR_W; 151 } 152 104 LONG lComplexity; 105 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 106 107 hrgn = ObjWinToOS2Region(hrgn); 108 if(!wnd || !hrgn) 109 { 110 dprintf(("WARNING: GetUpdateRgn %x %x %d; invalid handle", hwnd, hrgn, erase)); 111 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 112 return ERROR_W; 113 } 114 lComplexity = WinQueryUpdateRegion(wnd->getOS2WindowHandle(), hrgn); 115 if(lComplexity == RGN_ERROR) { 116 dprintf(("WARNING: GetUpdateRgn %x %x %d; RGN_ERROR", hwnd, hrgn, erase)); 117 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 118 return ERROR_W; 119 } 120 121 if(lComplexity != RGN_NULL) 122 { 123 if(!setWinDeviceRegionFromPMDeviceRegion(hrgn, hrgn, NULL, wnd->getOS2WindowHandle())) 124 { 125 dprintf(("WARNING: GetUpdateRgn %x %x %d; setWinDeviceRegionFromPMDeviceRegion failed!", hwnd, hrgn, erase)); 126 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 127 return ERROR_W; 128 } 153 129 if(erase) sendEraseBkgnd(wnd); 154 } 155 156 return lComplexity; 130 } 131 return lComplexity; 157 132 } 158 133 //****************************************************************************** … … 161 136 INT WIN32API ExcludeUpdateRgn(HDC hdc, HWND hwnd) 162 137 { 163 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd);164 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc);165 LONG lComplexity;166 167 if(!wnd || !pHps)168 {169 170 171 172 }173 dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd));174 175 lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle());176 if(lComplexity == RGN_ERROR) {177 178 }179 else SetLastError(ERROR_SUCCESS_W);180 return lComplexity; // windows and PM values are identical138 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle(hwnd); 139 pDCData pHps = (pDCData)GpiQueryDCData((HPS)hdc); 140 LONG lComplexity; 141 142 if(!wnd || !pHps) 143 { 144 dprintf(("WARNING: ExcludeUpdateRgn %x %x; invalid handle", hdc, hwnd)); 145 SetLastError(ERROR_INVALID_WINDOW_HANDLE_W); 146 return ERROR_W; 147 } 148 dprintf(("USER32: ExcludeUpdateRgn %x %x", hdc, hwnd)); 149 150 lComplexity = WinExcludeUpdateRegion(pHps->hps, wnd->getOS2WindowHandle()); 151 if(lComplexity == RGN_ERROR) { 152 SetLastError(ERROR_INVALID_HANDLE_W); //todo: correct error 153 } 154 else SetLastError(ERROR_SUCCESS_W); 155 return lComplexity; // windows and PM values are identical 181 156 } 182 157 /***************************************************************************** … … 195 170 int WIN32API GetWindowRgn(HWND hwnd, HRGN hRgn) 196 171 { 197 Win32BaseWindow *window;198 HRGN hWindowRegion;172 Win32BaseWindow *window; 173 HRGN hWindowRegion; 199 174 200 175 window = Win32BaseWindow::GetWindowFromHandle(hwnd); … … 234 209 BOOL bRedraw) 235 210 { 236 Win32BaseWindow *window;237 HRGN hWindowRegion;211 Win32BaseWindow *window; 212 HRGN hWindowRegion; 238 213 239 214 window = Win32BaseWindow::GetWindowFromHandle(hwnd);
Note:
See TracChangeset
for help on using the changeset viewer.