summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2014-03-03 16:47:18 +0000
committerjstebbins <[email protected]>2014-03-03 16:47:18 +0000
commit1ea78b3a154253ebb292244e8da0ed0980705bec (patch)
tree4c461ad7e930627492179d29af666f824bc1adcd /gtk
parent8f4098ff907b3e1c36ecf9c0dcbf83b296cb0a2d (diff)
LinGui: allow more flexibility in manual cropping
Do not limit cropping to half of width or height. Instead, just make sure resulting image width and height are never less than 16. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6096 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c4
-rw-r--r--gtk/src/hb-backend.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 13d270f15..db77248d2 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1008,8 +1008,8 @@ ghb_set_widget_ranges(signal_user_data_t *ud, GValue *settings)
// Set the limits of cropping. hb_set_anamorphic_size crashes if
// you pass it a cropped width or height == 0.
gint vbound, hbound;
- vbound = title->height / 2 - 8;
- hbound = title->width / 2 - 8;
+ vbound = title->height;
+ hbound = title->width;
val = ghb_settings_get_int(ud->settings, "PictureTopCrop");
spin_configure(ud, "PictureTopCrop", val, 0, vbound);
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 057625375..f6b7021d0 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3509,6 +3509,15 @@ ghb_set_scale_settings(GValue *settings, gint mode)
crop[1] = ghb_settings_get_int(settings, "PictureBottomCrop");
crop[2] = ghb_settings_get_int(settings, "PictureLeftCrop");
crop[3] = ghb_settings_get_int(settings, "PictureRightCrop");
+ // Prevent manual crop from creating too small an image
+ if (title->height - crop[0] < crop[1] + 16)
+ {
+ crop[0] = title->height - crop[1] - 16;
+ }
+ if (title->width - crop[2] < crop[3] + 16)
+ {
+ crop[2] = title->width - crop[3] - 16;
+ }
}
if (noscale)
{
@@ -3558,9 +3567,9 @@ ghb_set_scale_settings(GValue *settings, gint mode)
g_debug("max_width %d, max_height %d\n", max_width, max_height);
if (width < 16)
- width = title->width - crop[2] - crop[3];
+ width = 16;
if (height < 16)
- height = title->height - crop[0] - crop[1];
+ height = 16;
width = MOD_ROUND(width, mod);
height = MOD_ROUND(height, mod);