Mercurial > mplayer.hg
comparison libvo/geometry.c @ 11125:d9478c8e5ffe
fix aspect hack
now geometry sets geometry_wh_changed when either width or height is changed.
aspect is still preserved in fullscreen
author | attila |
---|---|
date | Wed, 15 Oct 2003 15:17:09 +0000 |
parents | b105d7aba10d |
children | 398c24cecdc7 |
comparison
equal
deleted
inserted
replaced
11124:b5bffec1a657 | 11125:d9478c8e5ffe |
---|---|
5 #include "geometry.h" | 5 #include "geometry.h" |
6 #include "../mp_msg.h" | 6 #include "../mp_msg.h" |
7 | 7 |
8 /* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */ | 8 /* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */ |
9 char *vo_geometry = NULL; | 9 char *vo_geometry = NULL; |
10 // set when either width or height is changed | |
11 int geometry_wh_changed = 0; | |
10 | 12 |
11 #define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1; | 13 #define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1; |
12 | 14 |
13 // xpos,ypos: position of the left upper corner | 15 // xpos,ypos: position of the left upper corner |
14 // widw,widh: width and height of the window | 16 // widw,widh: width and height of the window |
67 width, height, xoff, yoff, xper, yper); | 69 width, height, xoff, yoff, xper, yper); |
68 mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," | 70 mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," |
69 " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); | 71 " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); |
70 | 72 |
71 /* FIXME: better checking of bounds... */ | 73 /* FIXME: better checking of bounds... */ |
72 if(width < 0 || width > scrw) width = (scrw < *widw) ? scrw : *widw; | 74 if( width != -1 && (width < 0 || width > scrw)) |
73 if(height < 0 || height > scrh) height = (scrh < *widh) ? scrh : *widh; | 75 width = (scrw < *widw) ? scrw : *widw; |
74 if(xoff < 0 || xoff + width > scrw) xoff = 0; | 76 if( height != -1 && (height < 0 || height > scrh)) |
75 if(yoff < 0 || yoff + height > scrh) yoff = 0; | 77 height = (scrh < *widh) ? scrh : *widh; |
78 if(xoff != -1 && (xoff < 0 || xoff + width > scrw)) xoff = 0; | |
79 if(yoff != -1 && (yoff < 0 || yoff + height > scrh)) yoff = 0; | |
76 | 80 |
77 if(xpos) *xpos = xoff; | 81 if(xoff != -1 && xpos) *xpos = xoff; |
78 if(ypos) *ypos = yoff; | 82 if(yoff != -1 && ypos) *ypos = yoff; |
79 if(widw) *widw = width; | 83 if(width != -1 && widw) *widw = width; |
80 if(widh) *widh = height; | 84 if(height != -1 && widh) *widh = height; |
85 | |
86 if( width != -1 || height != -1) | |
87 geometry_wh_changed = 1; | |
81 } | 88 } |
82 return 1; | 89 return 1; |
83 } | 90 } |
84 | 91 |
85 #undef RESET_GEOMETRY | 92 #undef RESET_GEOMETRY |