From 08506e3cbbab01ce08f7f47389540683eaa39a04 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 1 Mar 2020 17:34:21 +0800 Subject: [PATCH] remove unnecessary kernel_GetGCRgnInfo functions --- cleanup-code.sh | 4 ++-- src/include/dc.h | 1 - src/include/internals.h | 5 ----- src/kernel/desktop-comm.c | 4 ++-- src/kernel/desktop-procs.c | 4 ++-- src/kernel/desktop.c | 22 +++++++++++----------- src/newgdi/gdi.c | 2 +- 7 files changed, 18 insertions(+), 24 deletions(-) diff --git a/cleanup-code.sh b/cleanup-code.sh index 32ba9c9b..e0641f36 100755 --- a/cleanup-code.sh +++ b/cleanup-code.sh @@ -164,7 +164,7 @@ tab2space() { # sed -i 's/\/get_effective_dc/g' `grep '\' -rl include/ src/` # sed -i 's/\/release_effective_dc/g' `grep '\' -rl include/ src/` -sed -i 's/\/checkAndGetMainWindowPtrOfControl/g' `grep '\' -rl include/ src/` -sed -i 's/\/checkAndGetMainWindowPtrOfMainWin/g' `grep '\' -rl include/ src/` +# sed -i 's/\/checkAndGetMainWindowPtrOfControl/g' `grep '\' -rl include/ src/` +# sed -i 's/\/checkAndGetMainWindowPtrOfMainWin/g' `grep '\' -rl include/ src/` exit 0 diff --git a/src/include/dc.h b/src/include/dc.h index b3a1ddf7..91fd6039 100644 --- a/src/include/dc.h +++ b/src/include/dc.h @@ -110,7 +110,6 @@ PLOGFONT g_SysLogFont[1]; // TODO: bad coding #define salone_StandAloneStartup() TRUE #define salone_StandAloneCleanup() #define salone_IdleHandler4StandAlone(qmsg) NULL -#define kernel_GetGCRgnInfo(hwnd) NULL #define GetWindowFont(hwnd) NULL #define mg_InitControlClass() TRUE #define mg_InitAccel() TRUE diff --git a/src/include/internals.h b/src/include/internals.h index f4f87c0a..f6b69b08 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -578,11 +578,6 @@ PMAINWIN gui_GetMainWindowPtrUnderPoint (int x, int y); /* return the next window need to repaint. */ HWND kernel_CheckInvalidRegion (PMAINWIN pWin); -#ifndef _MGSCHEMA_COMPOSITING -/* return global clipping region of window. */ -PGCRINFO kernel_GetGCRgnInfo (HWND hWnd); -#endif - /* internal variables */ typedef struct _TRACKMENUINFO* PTRACKMENUINFO; diff --git a/src/kernel/desktop-comm.c b/src/kernel/desktop-comm.c index 57abaea6..6450eb87 100644 --- a/src/kernel/desktop-comm.c +++ b/src/kernel/desktop-comm.c @@ -563,7 +563,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) //hdc = GetClientDC ((HWND)pWin); hdc = get_effective_dc(pWin, TRUE); - pcrc = kernel_GetGCRgnInfo ((HWND)pWin)->crgn.head; + pcrc = pWin->pGCRInfo->crgn.head; while (pcrc) { RECT rcMove; @@ -625,7 +625,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) #endif } - pcrc = kernel_GetGCRgnInfo ((HWND)pWin)->crgn.head; + pcrc = pWin->pGCRInfo->crgn.head; while (pcrc) { BOOL bNeedInvalidate = FALSE; RECT rcMove; diff --git a/src/kernel/desktop-procs.c b/src/kernel/desktop-procs.c index 51eeefdd..cf1e45de 100644 --- a/src/kernel/desktop-procs.c +++ b/src/kernel/desktop-procs.c @@ -2526,7 +2526,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) //the update to client dc (dongjunjie 2010/7/28) hdc = get_effective_dc(pWin, TRUE); - pcrc = kernel_GetGCRgnInfo ((HWND)pWin)->crgn.head; + pcrc = pWin->pGCRInfo->crgn.head; while (pcrc) { RECT rcMove; @@ -2585,7 +2585,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) #endif } - pcrc = kernel_GetGCRgnInfo ((HWND)pWin)->crgn.head; + pcrc = pWin->pGCRInfo->crgn.head; while (pcrc) { BOOL bNeedInvalidate = FALSE; RECT rcMove; diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 6b1cd505..29e8b493 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -130,24 +130,24 @@ static const int _zof_types_for_level [] = { typedef BOOL (* CB_ONE_ZNODE) (void* context, const ZORDERINFO* zi, ZORDERNODE* node); +#if 0 /* deprecated code */ +PGCRINFO kernel_GetGCRgnInfo (HWND hWnd) +{ + return ((PMAINWIN)hWnd)->pGCRInfo; +} +#endif /* deprecated code */ + typedef struct _DEF_CONTEXT { PBITMAP bg; int x, y; } DEF_CONTEXT; -#ifndef _MGSCHEMA_COMPOSITING -PGCRINFO kernel_GetGCRgnInfo (HWND hWnd) -{ - return ((PMAINWIN)hWnd)->pGCRInfo; -} -#endif /* not defined _MGSCHEMA_COMPOSITING */ - #if defined(_MGRM_PROCESSES) static DEF_CONTEXT g_def_context; #endif -static ZORDERINFO* get_zorder_info (int cli) +static inline ZORDERINFO* get_zorder_info (int cli) { #if defined (_MGRM_THREADS) || defined (_MGRM_STANDALONE) return __mg_zorder_info; @@ -697,7 +697,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) hdc = get_effective_dc (pWin, TRUE); #ifndef _MGSCHEMA_COMPOSITING - pcrc = kernel_GetGCRgnInfo ((HWND)pWin)->crgn.head; + pcrc = pWin->pGCRInfo->crgn.head; #else crcOne.next = crcOne.prev = NULL; crcOne.rc.left = pWin->pMainWin->left; @@ -770,7 +770,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) #ifndef _MGSCHEMA_COMPOSITING prgn = CreateClipRgn (); lock_zi_for_read (__mg_zorder_info); - CopyRegion (prgn, &kernel_GetGCRgnInfo((HWND)pWin)->crgn); + CopyRegion (prgn, &pWin->pGCRInfo->crgn); pcrc = prgn->head; unlock_zi_for_read (__mg_zorder_info); #else @@ -882,8 +882,8 @@ void __mg_lock_recalc_gcrinfo (PDC pdc) unsigned short idx; CLIPRGN invisible_rgn; - gcrinfo = kernel_GetGCRgnInfo (pdc->hwnd); mainwin = (PMAINWIN)(pdc->hwnd); + gcrinfo = mainwin->pGCRInfo; #ifdef _MGRM_THREADS pthread_mutex_lock (&pdc->pGCRInfo->lock); diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index f9dc05c1..5df739c3 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -1875,7 +1875,7 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient) #else /* not defined _MGSCHEMA_COMPOSITING */ RECT minimal; - pdc->pGCRInfo = kernel_GetGCRgnInfo (hWnd); + pdc->pGCRInfo = ((PMAINWIN)hWnd)->pGCRInfo; LOCK_GCRINFO (pdc);