Only call SyncUpdateDC in EndPaint

This commit is contained in:
Vincent Wei
2020-02-27 00:25:50 +08:00
parent 18ca90eb37
commit e50c8424e0
3 changed files with 23 additions and 13 deletions
+6
View File
@@ -5748,6 +5748,7 @@ HDC GUIAPI BeginPaint (HWND hWnd)
void GUIAPI EndPaint (HWND hWnd, HDC hdc)
{
BOOL synced = FALSE;
PMAINWIN pWin;
MG_CHECK (MG_IS_NORMAL_WINDOW(hWnd));
@@ -5761,6 +5762,8 @@ void GUIAPI EndPaint (HWND hWnd, HDC hdc)
__mg_update_secondary_dc (pWin, hdc, real_dc,
&pWin->pMainWin->update_rc, HT_CLIENT);
ReleaseDC (real_dc);
SyncUpdateDC (real_dc);
synced = TRUE;
}
}
@@ -5790,6 +5793,9 @@ void GUIAPI EndPaint (HWND hWnd, HDC hdc)
ShowCaretEx (hWnd, FALSE);
}
#endif
if (!synced)
SyncUpdateDC (hdc);
}
BOOL RegisterWindowClass (PWNDCLASS pWndClass)
+5 -6
View File
@@ -157,10 +157,11 @@ typedef BOOL (* CB_BITMAP_SCALER_FUNC )(
/* Device Context */
struct tagDC
{
short DataType; /* the data type, always be TYPE_HDC */
short DCType; /* the dc type */
unsigned char DataType; /* the data type, always be TYPE_HDC */
unsigned char DCType; /* the dc type */
unsigned char inuse;
unsigned char bIsClient;
BOOL inuse;
HWND hwnd;
/* surface of this DC */
@@ -258,7 +259,6 @@ struct tagDC
CLIPRGN ecrgn;
/* device rect */
BOOL bIsClient;
RECT DevRC;
#ifndef _MGSCHEMA_COMPOSITING
@@ -697,9 +697,8 @@ static inline void release_valid_dc (PMAINWIN pWin, HDC hdc)
ReleaseSecondarySubDC (hdc);
}
else {
if (pWin->privCDC != hdc) {
if (pWin->privCDC != hdc)
ReleaseDC (hdc);
}
}
}
+12 -7
View File
@@ -2289,14 +2289,13 @@ void GUIAPI ReleaseDC (HDC hDC)
pdc = dc_HDC2PDC(hDC);
if (pdc->alpha_pixel_format) {
GAL_FreeFormat (pdc->alpha_pixel_format);
pdc->alpha_pixel_format = NULL;
/* Call SyncUpdateDC at the end of EndPaint to elimiate flickers.
if (pdc->bIsClient) {
LOCK (&__mg_gdilock);
GAL_SyncUpdate (pdc->surface);
UNLOCK (&__mg_gdilock);
}
LOCK (&__mg_gdilock);
GAL_SyncUpdate (pdc->surface);
UNLOCK (&__mg_gdilock);
*/
pWin = (PMAINWIN)(pdc->hwnd);
if (pWin && pWin->privCDC == hDC) {
@@ -2375,6 +2374,12 @@ void GUIAPI ReleaseDC (HDC hDC)
#endif /* not defined _MGSCHEMA_COMPOSITING */
}
else {
/* since 5.0.0, only free pixel format for dc from slots */
if (pdc->alpha_pixel_format) {
GAL_FreeFormat (pdc->alpha_pixel_format);
pdc->alpha_pixel_format = NULL;
}
EmptyClipRgn (&pdc->lcrgn);
MAKE_REGION_INFINITE(&pdc->lcrgn);
EmptyClipRgn (&pdc->ecrgn);