Skip to content

Commit

Permalink
w32_common: fix size calculations for window resize
Browse files Browse the repository at this point in the history
Substraction of 1 is not necessary due to .right and .bottom values of RECT
struct describing a point one pixel outside of the rectangle.

Fixes mpv-player#2935. (2.b)
  • Loading branch information
maniak1349 committed Apr 26, 2016
1 parent 8ffd2f1 commit bab7ead
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions video/out/w32_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,13 @@ static void reinit_window_state(struct vo_w32_state *w32)
add_window_borders(w32->window, &r);

if (!w32->current_fs &&
((r.right - r.left) >= screen_w || (r.bottom - r.top) >= screen_h))
((r.right - r.left) > screen_w || (r.bottom - r.top) > screen_h))
{
MP_VERBOSE(w32, "requested window size larger than the screen\n");
// Use the aspect of the client area, not the full window size.
// Basically, try to compute the maximum window size.
long n_w = screen_w - (r.right - cr.right) - (cr.left - r.left) - 1;
long n_h = screen_h - (r.bottom - cr.bottom) - (cr.top - r.top) - 1;
long n_w = screen_w - (r.right - cr.right) - (cr.left - r.left);
long n_h = screen_h - (r.bottom - cr.bottom) - (cr.top - r.top);
// Letterbox
double asp = (cr.right - cr.left) / (double)(cr.bottom - cr.top);
double s_asp = n_w / (double)n_h;
Expand Down

0 comments on commit bab7ead

Please sign in to comment.