Mercurial > mplayer.hg
comparison libvo/vo_sdl.c @ 36236:6e2919257e92
Ensure that the allocated surface is always large enough.
author | reimar |
---|---|
date | Tue, 11 Jun 2013 18:38:56 +0000 |
parents | 9269e341748f |
children | 3e7ce8fc870d |
comparison
equal
deleted
inserted
replaced
36235:c00402488d80 | 36236:6e2919257e92 |
---|---|
66 #include "fastmemcpy.h" | 66 #include "fastmemcpy.h" |
67 #include "sub/sub.h" | 67 #include "sub/sub.h" |
68 #include "aspect.h" | 68 #include "aspect.h" |
69 #include "libmpcodecs/vfcap.h" | 69 #include "libmpcodecs/vfcap.h" |
70 #include "osdep/setenv.h" | 70 #include "osdep/setenv.h" |
71 #include "libavutil/common.h" | |
71 | 72 |
72 #ifdef CONFIG_X11 | 73 #ifdef CONFIG_X11 |
73 #include <X11/Xlib.h> | 74 #include <X11/Xlib.h> |
74 #include "x11_common.h" | 75 #include "x11_common.h" |
75 #endif | 76 #endif |
710 struct sdl_priv_s *priv = &sdl_priv; | 711 struct sdl_priv_s *priv = &sdl_priv; |
711 float v_scale = ((float) priv->dstheight) / priv->height; | 712 float v_scale = ((float) priv->dstheight) / priv->height; |
712 int surfwidth, surfheight; | 713 int surfwidth, surfheight; |
713 | 714 |
714 surfwidth = priv->width; | 715 surfwidth = priv->width; |
715 surfheight = priv->height + (priv->surface->h - priv->dstheight) / v_scale; | 716 surfheight = priv->height + FFMAX(priv->surface->h - priv->dstheight, 0) / v_scale + 1; |
716 surfheight&= ~1; | 717 surfheight&= ~1; |
717 /* Place the image in the middle of the screen */ | 718 /* Place the image in the middle of the screen */ |
718 priv->y = (surfheight - priv->height) / 2; | 719 priv->y = (surfheight - priv->height) / 2; |
719 priv->y_screen_top = priv->y * v_scale; | 720 priv->y_screen_top = priv->y * v_scale; |
720 priv->y_screen_bottom = priv->y_screen_top + priv->dstheight; | 721 priv->y_screen_bottom = priv->y_screen_top + priv->dstheight; |