diff options
author | jstebbins <[email protected]> | 2014-05-06 13:55:49 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-05-06 13:55:49 +0000 |
commit | cf20642b9819e42dff026eb114f32b7f2f3bfc4b (patch) | |
tree | 8ef7b981f698f1a36658d5169c2f190c05c566bc /libhb/deccc608sub.c | |
parent | 605148d6f7b83974688adb9461bf221eb7af512a (diff) |
deccc608sub: fix cropping of CCs
If the CC was in the crop area at the top of the image, it's position
was not moved properly.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6172 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/deccc608sub.c')
-rw-r--r-- | libhb/deccc608sub.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libhb/deccc608sub.c b/libhb/deccc608sub.c index 5f4066b67..38e912cf5 100644 --- a/libhb/deccc608sub.c +++ b/libhb/deccc608sub.c @@ -851,7 +851,7 @@ static int write_cc_buffer_as_ssa(struct eia608_screen *data, // Get position for this CC if (row == -1) { - int last, x, y, safe_zone, cell_width, cell_height; + int last, x, y, top, safe_zone, cell_width, cell_height; int cropped_width, cropped_height, font_size; char *pos; @@ -874,14 +874,15 @@ static int write_cc_buffer_as_ssa(struct eia608_screen *data, // the baseline of the text which is lower left corner // of bottom row of characters y = cell_height * (row + 1 + rows) + safe_zone - wb->crop[0]; + top = y - rows * font_size; x = cell_width * col + safe_zone - wb->crop[2]; - if (y < 0) + if (top < safe_zone) y = (rows * font_size) + safe_zone; - if (x < 0) + if (x < safe_zone) x = safe_zone; - if (y > cropped_height) + if (y > cropped_height - safe_zone) y = cropped_height - safe_zone; - if (x + columns * cell_width > cropped_width) + if (x + columns * cell_width > cropped_width - safe_zone) x = cropped_width - columns * cell_width - safe_zone; pos = hb_strdup_printf("{\\a1\\pos(%d,%d)}", x, y); wb->enc_buffer_used += encode_line( |