]> granicus.if.org Git - handbrake/commitdiff
LinGui: tweak to loose crop
authorjstebbins <jstebbins.hb@gmail.com>
Tue, 20 Sep 2011 16:14:26 +0000 (16:14 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Tue, 20 Sep 2011 16:14:26 +0000 (16:14 +0000)
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

gtk/src/hb-backend.c

index 733340784926ff0a4542d59ec0fdaae62abaecbf..a4034143d5b0b6444906b785c703e96ad192622e 100644 (file)
@@ -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;