diff options
author | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-11-22 18:06:09 +0000 |
---|---|---|
committer | Michael Roitzsch <mroi@users.sourceforge.net> | 2002-11-22 18:06:09 +0000 |
commit | 8cee0fd2910cbdafe45e1c5d43fa930d367cec47 (patch) | |
tree | ff10bebf427b3f9211e0a473ecc58b7eeb8b1c0f /src/xine-engine/vo_scale.c | |
parent | eef61f25b051865c9554514a66cb9b45c6a5f4bd (diff) | |
download | xine-lib-8cee0fd2910cbdafe45e1c5d43fa930d367cec47.tar.gz xine-lib-8cee0fd2910cbdafe45e1c5d43fa930d367cec47.tar.bz2 |
when the image does not fit the viewport and black bars need to be added, their
size ratio and therefore the position of the image is now configurable
(I remembered my arts lessons at school where the teacher told us that images
look more pleasing when the lower border is twice the size of the upper and set
the default accordingly. ;)
CVS patchset: 3337
CVS date: 2002/11/22 18:06:09
Diffstat (limited to 'src/xine-engine/vo_scale.c')
-rw-r--r-- | src/xine-engine/vo_scale.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c index aa9c851ba..940e9a096 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.15 2002/10/24 16:43:07 mroi Exp $ + * $Id: vo_scale.c,v 1.16 2002/11/22 18:06:13 mroi Exp $ * * Contains common code to calculate video scaling parameters. * In short, it will map frame dimensions to screen/window size. @@ -190,8 +190,10 @@ void vo_scale_compute_output_size (vo_scale_t *this) { this->displayed_height = this->delivered_height; } } - this->output_xoffset = (this->gui_width - this->output_width) / 2 + this->gui_x; - this->output_yoffset = (this->gui_height - this->output_height) / 2 + this->gui_y; + this->output_xoffset = + (this->gui_width - this->output_width) * this->output_horizontal_position + this->gui_x; + this->output_yoffset = + (this->gui_height - this->output_height) * this->output_vertical_position + this->gui_y; this->displayed_xoffset = (this->delivered_width - this->displayed_width) / 2; this->displayed_yoffset = (this->delivered_height - this->displayed_height) / 2; @@ -338,11 +340,30 @@ char *vo_scale_aspect_ratio_name(int a) { } +/* + * config callbacks + */ +static void vo_scale_horizontal_pos_changed(void *data, xine_cfg_entry_t *entry) { + vo_scale_t *this = (vo_scale_t *)data; + + this->output_horizontal_position = entry->num_value / 100.0; + this->force_redraw = 1; +} + +static void vo_scale_vertical_pos_changed(void *data, xine_cfg_entry_t *entry) { + vo_scale_t *this = (vo_scale_t *)data; + + this->output_vertical_position = entry->num_value / 100.0; + this->force_redraw = 1; +} + + /* * initialize rescaling struct */ -void vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled ) { +void vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled, + config_values_t *config ) { memset( this, 0, sizeof(vo_scale_t) ); this->support_zoom = support_zoom; @@ -352,5 +373,13 @@ void vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled ) { this->zoom_factor_y = 1.0; this->gui_pixel_aspect = 1.0; this->user_ratio = ASPECT_AUTO; + + this->output_horizontal_position = + config->register_range(config, "video.horizontal_position", 50, 0, 100, + _("horizontal image position in the output window"), NULL, 0, + vo_scale_horizontal_pos_changed, this) / 100.0; + this->output_vertical_position = + config->register_range(config, "video.vertical_position", 33, 0, 100, + _("vertical image position in the output window"), NULL, 0, + vo_scale_vertical_pos_changed, this) / 100.0; } - |