summaryrefslogtreecommitdiffstats
path: root/gtk/src/hb-backend.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-09-20 16:14:26 +0000
committerjstebbins <[email protected]>2011-09-20 16:14:26 +0000
commit4b66f14ed34e840c79f97bc388ef8fff8d4eeed9 (patch)
tree6e43fecb79e5e5665de4a1c6459204a4430a5032 /gtk/src/hb-backend.c
parent0ddbb44151ad80ff7eaa1ccd9efa201b2a014c71 (diff)
LinGui: tweak to loose crop
I like how Yeasah ensures that top and left crop will be even pixel aligned in his cli patch. Do the same for the lingui. This ensures that even if the input crop values are not even pixel aligned, the result will be. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4240 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/hb-backend.c')
-rw-r--r--gtk/src/hb-backend.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 733340784..a4034143d 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3864,17 +3864,19 @@ ghb_set_scale(signal_user_data_t *ud, gint mode)
height = MOD_DOWN(crop_height, mod);
need1 = (crop_height - height) / 2;
- // If the top crop would fall on an odd boundary, crop the extra
- // line from the bottom
- need1 &= ~0x01;
+ // If the top crop would fall on an odd boundary, crop an extra
+ // line from the top
+ if ((crop[0] + need1) & 1)
+ need1++;
need2 = crop_height - height - need1;
crop[0] += need1;
crop[1] += need2;
need1 = (crop_width - width) / 2;
- // If the top crop would fall on an odd boundary, crop the extra
- // column from the right
- need1 &= ~0x01;
+ // If the left crop would fall on an odd boundary, crop an extra
+ // column from the left
+ if ((crop[2] + need1) & 1)
+ need1++;
need2 = crop_width - width - need1;
crop[2] += need1;
crop[3] += need2;