changeset 25918:35698e5aa40c

Implement keepaspect for Windows OpenGL vos.
author reimar
date Sat, 02 Feb 2008 17:22:07 +0000
parents afd170654f62
children 382672c7480a
files libvo/w32_common.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/w32_common.c	Sat Feb 02 17:21:19 2008 +0000
+++ b/libvo/w32_common.c	Sat Feb 02 17:22:07 2008 +0000
@@ -61,6 +61,18 @@
             vo_dheight = r.bottom;
             break;
         case WM_WINDOWPOSCHANGING:
+            if (vo_keepaspect && !vo_fs) {
+              WINDOWPOS *wpos = lParam;
+              int xborder, yborder;
+              RECT r2;
+              GetClientRect(vo_window, &r);
+              GetWindowRect(vo_window, &r2);
+              xborder = (r2.right - r2.left) - (r.right - r.left);
+              yborder = (r2.bottom - r2.top) - (r.bottom - r.top);
+              wpos->cx -= xborder; wpos->cy -= yborder;
+              aspect_fit(&wpos->cx, &wpos->cy, wpos->cx, wpos->cy);
+              wpos->cx += xborder; wpos->cy += yborder;
+            }
             return 0;
         case WM_CLOSE:
             mplayer_put_key(KEY_CLOSE_WIN);