w32_common: avoid unnecessary sprintfs

These were unnecessary for a couple of reasons, but it seems like the
old code went through a lot of effort to avoid duplicating the code to
print a RECT, even though the windowrc gets printed anyway at the end of
the function.

Avoid printing the same windowrc twice by only printing it when it gets
changed (in the w32->current_fs branch.)
This commit is contained in:
James Ross-Gowan 2019-05-10 20:47:05 +10:00
parent 91c1691b35
commit c754c31d6f
1 changed files with 5 additions and 8 deletions

View File

@ -842,19 +842,16 @@ static bool update_fullscreen_state(struct vo_w32_state *w32)
w32->current_fs = new_fs; w32->current_fs = new_fs;
if (toggle_fs) { if (toggle_fs) {
RECT rc;
char msg[50];
if (w32->current_fs) { if (w32->current_fs) {
// Save window rect when switching to fullscreen. // Save window rect when switching to fullscreen.
rc = w32->prev_windowrc = w32->windowrc; w32->prev_windowrc = w32->windowrc;
sprintf(msg, "save window bounds"); MP_VERBOSE(w32, "save window bounds: %d:%d:%d:%d\n",
(int)w32->windowrc.left, (int)w32->windowrc.top,
(int)rect_w(w32->windowrc), (int)rect_h(w32->windowrc));
} else { } else {
// Restore window rect when switching from fullscreen. // Restore window rect when switching from fullscreen.
rc = w32->windowrc = w32->prev_windowrc; w32->windowrc = w32->prev_windowrc;
sprintf(msg, "restore window bounds");
} }
MP_VERBOSE(w32, "%s: %d:%d:%d:%d\n", msg,
(int)rc.left, (int)rc.top, (int)rect_w(rc), (int)rect_h(rc));
} }
if (w32->current_fs) if (w32->current_fs)