diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-05-11 02:21:16 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-05-11 02:21:16 +0000 |
commit | 10993e3a5e6fbe2c32883b30f780e1146d08148d (patch) | |
tree | fad8281c6450c869aec12a9603336558bd802aa4 /src | |
parent | 12bcd4246b47c9e4886f5a458a34f3e8453da2d1 (diff) | |
download | xine-lib-10993e3a5e6fbe2c32883b30f780e1146d08148d.tar.gz xine-lib-10993e3a5e6fbe2c32883b30f780e1146d08148d.tar.bz2 |
make sure displayed values are sane, that is, we are not trying to display
something outside the delivered image.
fixes border calculation for zoom < 100%.
CVS patchset: 6517
CVS date: 2004/05/11 02:21:16
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-engine/vo_scale.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index 656c8569e..5704a1c8c 100644 --- a/src/xine-engine/vo_scale.c +++ b/src/xine-engine/vo_scale.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: vo_scale.c,v 1.30 2004/01/18 18:17:55 mroi Exp $ + * $Id: vo_scale.c,v 1.31 2004/05/11 02:21:16 miguelfreitas Exp $ * * Contains common code to calculate video scaling parameters. * In short, it will map frame dimensions to screen/window size. @@ -168,6 +168,21 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->displayed_height = this->delivered_height; } } + + /* make sure displayed values are sane, that is, we are not trying to display + * something outside the delivered image. may happen when zoom < 100%. + */ + if( this->displayed_width > this->delivered_width ) { + this->output_width = (double) this->output_width * + this->delivered_width / this->displayed_width + 0.5; + this->displayed_width = this->delivered_width; + } + if( this->displayed_height > this->delivered_height ) { + this->output_height = (double) this->output_height * + this->delivered_height / this->displayed_height + 0.5; + this->displayed_height = this->delivered_height; + } + this->output_xoffset = (this->gui_width - this->output_width) * this->output_horizontal_position + this->gui_x; this->output_yoffset = @@ -206,7 +221,7 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) { this->border[2].w = this->output_xoffset; this->border[2].h = this->gui_height; /* right */ - this->border[3].x = this->output_xoffset + this->output_width;; + this->border[3].x = this->output_xoffset + this->output_width; this->border[3].y = 0; this->border[3].w = this->gui_width - this->border[3].x; this->border[3].h = this->gui_height; |