diff options
author | James Ross-Gowan <rossy@jrg.systems> | 2019-05-10 20:47:05 +1000 |
---|---|---|
committer | James Ross-Gowan <rossy@jrg.systems> | 2019-05-10 20:47:05 +1000 |
commit | c754c31d6fe32b6806ea4c88a0969ae7f7796d1b (patch) | |
tree | 843060d8f660d1e4320d0f036a9e24e2ebac5b83 /video | |
parent | 91c1691b35d4bfa01cd56f181ff88358a8b23ace (diff) | |
download | mpv-c754c31d6fe32b6806ea4c88a0969ae7f7796d1b.tar.bz2 mpv-c754c31d6fe32b6806ea4c88a0969ae7f7796d1b.tar.xz |
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.)
Diffstat (limited to 'video')
-rw-r--r-- | video/out/w32_common.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c index 92b6650c09..4436bf030e 100644 --- a/video/out/w32_common.c +++ b/video/out/w32_common.c @@ -842,19 +842,16 @@ static bool update_fullscreen_state(struct vo_w32_state *w32) w32->current_fs = new_fs; if (toggle_fs) { - RECT rc; - char msg[50]; if (w32->current_fs) { // Save window rect when switching to fullscreen. - rc = w32->prev_windowrc = w32->windowrc; - sprintf(msg, "save window bounds"); + w32->prev_windowrc = w32->windowrc; + 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 { // Restore window rect when switching from fullscreen. - rc = w32->windowrc = w32->prev_windowrc; - sprintf(msg, "restore window bounds"); + w32->windowrc = w32->prev_windowrc; } - 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) |