Changeset 962 for trunk/src/user32/dc.cpp
- Timestamp:
- Sep 16, 1999, 8:00:44 PM (26 years ago)
- File:
-
- 1 edited
-
trunk/src/user32/dc.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/dc.cpp
r949 r962 1 /* $Id: dc.cpp,v 1. 1 1999-09-15 23:18:49 sandervlExp $ */1 /* $Id: dc.cpp,v 1.2 1999-09-16 18:00:43 dengert Exp $ */ 2 2 3 3 /* … … 46 46 RECT rcPaint; 47 47 BOOL fRestore; 48 BOOL fIncUpdate;48 BOOL IncUpdate; 49 49 BYTE rgbReserved[32]; 50 50 } PAINTSTRUCT_W, *PPAINTSTRUCT_W, *LPPAINTSTRUCT_W; … … 116 116 #define DCX_LOCKWINDOWUPDATE_W 0x00000400L 117 117 #define DCX_VALIDATE_W 0x00200000L 118 119 #define RDW_INVALIDATE_W 0x0001 120 #define RDW_INTERNALPAINT_W 0x0002 121 #define RDW_ERASE_W 0x0004 122 #define RDW_VALIDATE_W 0x0008 123 #define RDW_NOINTERNALPAINT_W 0x0010 124 #define RDW_NOERASE_W 0x0020 125 #define RDW_NOCHILDREN_W 0x0040 126 #define RDW_ALLCHILDREN_W 0x0080 127 #define RDW_UPDATENOW_W 0x0100 128 #define RDW_ERASENOW_W 0x0200 129 #define RDW_FRAME_W 0x0400 130 #define RDW_NOFRAME_W 0x0800 118 131 119 132 typedef struct _RGNDATAHEADER_W { … … 1038 1051 return (rc); 1039 1052 } 1053 1054 BOOL WIN32API UpdateWindow (HWND hwnd) 1055 { 1056 if (!hwnd) 1057 return FALSE; 1058 1059 USHORT sel = RestoreOS2FS(); 1060 Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1061 1062 dprintf (("User32: UpdateWindow hwnd %x -> wnd %x", hwnd, wnd)); 1063 1064 if (WinQueryUpdateRect (wnd->getOS2WindowHandle(), NULL)) 1065 sendEraseBkgnd (wnd); 1066 1067 wnd->MsgPaint(0); 1068 1069 SetFS(sel); 1070 return (TRUE); 1071 } 1072 1073 // This implementation of RedrawWindow supports 1074 // RDW_ERASE 1075 // RDW_NOERASE 1076 // RDW_INTERNALPAINT 1077 // RDW_NOINTERNALPAINT 1078 // RDW_INVALIDATE 1079 // RDW_VALIDATE 1080 // RDW_ERASENOW 1081 // RDW_UPDATENOW 1082 1083 BOOL WIN32API RedrawWindow (HWND hwnd, const RECT *pRect, HRGN hrgn, DWORD redraw) 1084 { 1085 Win32BaseWindow *wnd; 1086 1087 if (redraw & (RDW_FRAME_W | RDW_NOFRAME_W)) 1088 { 1089 // SET_ERROR_WIN( ERROR_NOT_SUPPORTED_W ); 1090 return FALSE; 1091 } 1092 1093 USHORT sel = RestoreOS2FS(); 1094 dprintf(("USER32: RedrawWindow %X, %X %X %X", hwnd, pRect, hrgn, redraw)); 1095 1096 if (hwnd == NULLHANDLE) { 1097 hwnd = HWND_DESKTOP; 1098 wnd = NULL; 1099 } 1100 else 1101 { 1102 wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1103 1104 if (!wnd) 1105 { 1106 // SET_ERROR_LAST(); 1107 SetFS(sel); 1108 return FALSE; 1109 } 1110 hwnd = wnd->getOS2WindowHandle(); 1111 } 1112 1113 BOOL IncludeChildren = redraw & RDW_ALLCHILDREN_W ? TRUE : FALSE; 1114 BOOL success = TRUE; 1115 HPS hpsTemp = NULLHANDLE; 1116 HRGN hrgnTemp = NULLHANDLE; 1117 RECTL rectl; 1118 1119 if (redraw & RDW_UPDATENOW_W) redraw &= ~RDW_ERASENOW_W; 1120 1121 #if 0 1122 if (redraw & RDW_NOERASE_W) 1123 setEraseBkgnd (FALSE); 1124 1125 if (redraw & RDW_UPDATENOW_W) 1126 setSupressErase (TRUE, FALSE); 1127 else if (redraw & RDW_ERASENOW_W) 1128 setSupressErase (FALSE, FALSE); 1129 else 1130 { 1131 QMSG qmsg; 1132 BOOL bErase; 1133 1134 bErase = (WinPeekMsg (HABX, &qmsg, hwnd, WM_PAINT, WM_PAINT, PM_REMOVE) 1135 && (redraw & RDW_NOERASE_W) == 0); 1136 1137 setSupressErase (FALSE, !bErase); 1138 } 1139 1140 if (redraw & (RDW_NOINTERNALPAINT_W | RDW_INTERNALPAINT_W)) 1141 { 1142 QMSG qmsg; 1143 1144 WinPeekMsg( (HAB)0, &qmsg, hwnd, WM_VIRTUAL_INTERNALPAINT, 1145 WM_VIRTUAL_INTERNALPAINT, PM_REMOVE ); 1146 } 1147 #endif 1148 1149 if (hrgn) 1150 { 1151 ULONG BytesNeeded; 1152 PRGNDATA_W RgnData; 1153 PRECTL pr; 1154 int i; 1155 LONG height = wnd ? wnd->getWindowHeight() : OSLibQueryScreenHeight(); 1156 1157 if (!hrgn) 1158 goto error; 1159 1160 BytesNeeded = _O32_GetRegionData (hrgn, 0, NULL); 1161 RgnData = (PRGNDATA_W)_alloca (BytesNeeded); 1162 if (RgnData == NULL) 1163 goto error; 1164 _O32_GetRegionData (hrgn, BytesNeeded, RgnData); 1165 1166 pr = (PRECTL)(RgnData->Buffer); 1167 for (i = RgnData->rdh.nCount; i > 0; i--, pr++) { 1168 LONG temp = pr->yTop; 1169 pr->yTop = height - pr->yBottom; 1170 pr->yBottom = height - temp; 1171 } 1172 1173 hpsTemp = WinGetScreenPS (HWND_DESKTOP); 1174 hrgnTemp = GpiCreateRegion (hpsTemp, RgnData->rdh.nCount, (PRECTL)(RgnData->Buffer)); 1175 if (!hrgnTemp) goto error; 1176 } 1177 else if (pRect) 1178 { 1179 LONG height = wnd ? wnd->getWindowHeight() : OSLibQueryScreenHeight(); 1180 1181 PMRECT_FROM_WINRECT (rectl, *pRect); 1182 rectl.yTop = height - rectl.yTop; 1183 rectl.yBottom = height - rectl.yBottom; 1184 } 1185 1186 if (redraw & RDW_INVALIDATE_W) 1187 { 1188 // if (redraw & RDW_ERASE_W) 1189 // setEraseBkgnd (TRUE, TRUE); 1190 1191 if (!pRect && !hrgn) 1192 success = WinInvalidateRect (hwnd, NULL, IncludeChildren); 1193 else if (hrgn) 1194 success = WinInvalidateRegion (hwnd, hrgnTemp, IncludeChildren); 1195 else 1196 success = WinInvalidateRect (hwnd, &rectl, IncludeChildren); 1197 if (!success) goto error; 1198 } 1199 else if (redraw & RDW_VALIDATE_W) 1200 { 1201 if (WinQueryUpdateRect (hwnd, NULL)) 1202 { 1203 if (!pRect && !hrgn) 1204 success = WinValidateRect (hwnd, NULL, IncludeChildren); 1205 else if (hrgn) 1206 success = WinValidateRegion (hwnd, hrgnTemp, IncludeChildren); 1207 else 1208 success = WinValidateRect (hwnd, &rectl, IncludeChildren); 1209 if (!success) goto error; 1210 } 1211 } 1212 1213 if (WinQueryUpdateRect (hwnd, NULL)) 1214 { 1215 if (redraw & RDW_UPDATENOW_W) 1216 wnd->MsgPaint (0, FALSE); 1217 1218 // else if ((redraw & RDW_ERASE_W) && (redraw & RDW_ERASENOW_W)) 1219 // setEraseBkgnd (FALSE, !sendEraseBkgnd (wnd)); 1220 } 1221 else if ((redraw & RDW_INTERNALPAINT_W) && !(redraw & RDW_INVALIDATE_W)) 1222 { 1223 if (redraw & RDW_UPDATENOW_W) 1224 wnd->MsgPaint (0, FALSE); 1225 // else 1226 // WinPostMsg( hwnd, WM_VIRTUAL_INTERNALPAINT, MPVOID, MPVOID ); 1227 } 1228 1229 error: 1230 /* clean up */ 1231 if (hrgnTemp) 1232 GpiDestroyRegion (hpsTemp, hrgnTemp); 1233 1234 if (hpsTemp) 1235 WinReleasePS (hpsTemp); 1236 1237 // if ((redraw & RDW_INVALIDATE_W) == 0) 1238 // setSupressErase (FALSE, FALSE); 1239 // else if ((redraw & RDW_ERASENOW_W) == RDW_ERASENOW_W) 1240 // setSupressErase (FALSE, TRUE); 1241 1242 // if (!success) 1243 // SET_ERROR_LAST(); 1244 1245 SetFS(sel); 1246 return (success); 1247 } 1248 1249 BOOL WIN32API InvalidateRect (HWND hwnd, const RECT *pRect, BOOL erase) 1250 { 1251 USHORT sel = RestoreOS2FS(); 1252 // Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1253 BOOL result; 1254 1255 // todo !! 1256 // if ( isFrame without client ) 1257 // erase = TRUE; 1258 1259 result = RedrawWindow (hwnd, pRect, NULLHANDLE, 1260 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1261 (erase ? RDW_ERASE_W : 0) | 1262 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1263 SetFS(sel); 1264 return (result); 1265 } 1266 1267 BOOL WIN32API InvalidateRgn (HWND hwnd, HRGN hrgn, BOOL erase) 1268 { 1269 USHORT sel = RestoreOS2FS(); 1270 // Win32BaseWindow *wnd = Win32BaseWindow::GetWindowFromHandle (hwnd); 1271 BOOL result; 1272 1273 // todo !! 1274 // if ( isFrame without client ) 1275 // erase = TRUE; 1276 1277 result = RedrawWindow (hwnd, NULL, hrgn, 1278 RDW_ALLCHILDREN_W | RDW_INVALIDATE_W | 1279 (erase ? RDW_ERASE_W : 0) | 1280 (hwnd == NULLHANDLE ? RDW_UPDATENOW_W : 0)); 1281 SetFS(sel); 1282 return (result); 1283 } 1284 1040 1285 //****************************************************************************** 1041 1286 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.
