1
1
Fork 0
mirror of https://github.com/pbatard/rufus.git synced 2024-08-14 23:57:05 +00:00

[perf] Pass struct argument by pointer

Do not waste performance on unneeded copy.
This commit is contained in:
Tsarevich Dmitry 2020-02-23 19:06:19 +03:00
parent c499da9364
commit 1abde9ba88
No known key found for this signature in database
GPG key ID: E3C61298FF5B1274
3 changed files with 8 additions and 6 deletions

View file

@ -2307,7 +2307,7 @@ static INT_PTR CALLBACK MainCallback(HWND hDlg, UINT message, WPARAM wParam, LPA
SendMessage(hMultiToolbar, TB_GETRECT, (WPARAM)IDC_ABOUT, (LPARAM)&rc);
MapWindowPoints(hDlg, NULL, (POINT*)&rc, 2);
rc.left += cbw / 2;
ShowLanguageMenu(rc);
ShowLanguageMenu(&rc);
break;
case IDC_SETTINGS:
MyDialogBox(hMainInstance, IDD_UPDATE_POLICY, hDlg, UpdateCallback);

View file

@ -1489,7 +1489,7 @@ void UpdateProgressWithInfo(int op, int msg, uint64_t processed, uint64_t total)
}
}
void ShowLanguageMenu(RECT rcExclude)
void ShowLanguageMenu(const RECT *rcExclude)
{
TPMPARAMS tpm;
HMENU menu;
@ -1500,6 +1500,8 @@ void ShowLanguageMenu(RECT rcExclude)
char *search = "()";
char *l, *r, *str;
assert(rcExclude);
UM_LANGUAGE_MENU_MAX = UM_LANGUAGE_MENU;
menu = CreatePopupMenu();
list_for_each_entry(lcmd, &locale_list, loc_cmd, list) {
@ -1526,11 +1528,11 @@ void ShowLanguageMenu(RECT rcExclude)
// Open the menu such that it doesn't overlap the specified rect
tpm.cbSize = sizeof(TPMPARAMS);
tpm.rcExclude = rcExclude;
tpm.rcExclude = *rcExclude;
TrackPopupMenuEx(menu, 0,
// In RTL languages, the menu should be placed at the bottom-right of the rect
right_to_left_mode ? rcExclude.right : rcExclude.left,
rcExclude.bottom + adjust, hMainDialog, &tpm);
right_to_left_mode ? rcExclude->right : rcExclude->left,
rcExclude->bottom + adjust, hMainDialog, &tpm);
DestroyMenu(menu);
}

View file

@ -100,7 +100,7 @@ extern void ToggleImageOptions(void);
extern void CreateSmallButtons(HWND hDlg);
extern void CreateAdditionalControls(HWND hDlg);
extern void InitProgress(BOOL bOnlyFormat);
extern void ShowLanguageMenu(RECT rcExclude);
extern void ShowLanguageMenu(const RECT *rcExclude);
extern void SetPassesTooltip(void);
extern void SetBootTypeDropdownWidth(void);
extern void OnPaint(HDC hdc);