diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/src/ghb.ui | 8 | ||||
-rw-r--r-- | gtk/src/hb-backend.c | 24 |
2 files changed, 26 insertions, 6 deletions
diff --git a/gtk/src/ghb.ui b/gtk/src/ghb.ui index 823e66785..586806f3c 100644 --- a/gtk/src/ghb.ui +++ b/gtk/src/ghb.ui @@ -178,7 +178,7 @@ <property name="value">1</property> </object> <object class="GtkAdjustment" id="adjustment25"> - <property name="upper">2000</property> + <property name="upper">4096</property> <property name="lower">0</property> <property name="page_increment">16</property> <property name="step_increment">1</property> @@ -186,7 +186,7 @@ <property name="value">0</property> </object> <object class="GtkAdjustment" id="adjustment26"> - <property name="upper">1200</property> + <property name="upper">4096</property> <property name="lower">0</property> <property name="page_increment">16</property> <property name="step_increment">1</property> @@ -210,7 +210,7 @@ <property name="value">0.0</property> </object> <object class="GtkAdjustment" id="adjustment29"> - <property name="upper">2000</property> + <property name="upper">65535</property> <property name="lower">1</property> <property name="page_increment">16</property> <property name="step_increment">1</property> @@ -218,7 +218,7 @@ <property name="value">0</property> </object> <object class="GtkAdjustment" id="adjustment30"> - <property name="upper">2000</property> + <property name="upper">65535</property> <property name="lower">1</property> <property name="page_increment">16</property> <property name="step_increment">1</property> diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c index f453f98d3..2d17a7c32 100644 --- a/gtk/src/hb-backend.c +++ b/gtk/src/hb-backend.c @@ -3518,6 +3518,26 @@ picture_settings_deps(signal_user_data_t *ud) } void +ghb_limit_rational( gint *num, gint *den, gint limit ) +{ + if (*num < limit && *den < limit) + return; + + if (*num > *den) + { + gdouble factor = (double)limit / *num; + *num = limit; + *den = factor * *den; + } + else + { + gdouble factor = (double)limit / *den; + *den = limit; + *num = factor * *num; + } +} + +void ghb_set_scale(signal_user_data_t *ud, gint mode) { hb_list_t * list; @@ -3795,9 +3815,9 @@ ghb_set_scale(signal_user_data_t *ud, gint mode) gint disp_width, dar_width, dar_height; gchar *str; - disp_width = (gdouble)(width * par_width / par_height) + 0.5; + disp_width = ((gdouble)par_width / par_height) * width + 0.5; hb_reduce(&dar_width, &dar_height, disp_width, height); - + ghb_limit_rational(&par_width, &par_height, 65535); gint iaspect = dar_width * 9 / dar_height; if (dar_width > 2 * dar_height) { |