| 3990 | } |
| 3991 | |
| 3992 | static void |
| 3993 | apply_pad (GhbValue *settings, |
| 3994 | const hb_geometry_settings_t * geo, |
| 3995 | hb_geometry_t * result) |
| 3996 | { |
| 3997 | gboolean fillwidth, fillheight; |
| 3998 | gint pad[4] = {0,}; |
| 3999 | |
| 4000 | const gchar * pad_mode; |
| 4001 | |
| 4002 | pad_mode = ghb_dict_get_string(settings, "PicturePadMode"); |
| 4003 | fillwidth = fillheight = !strcmp(pad_mode, "fill"); |
| 4004 | fillheight = fillheight || !strcmp(pad_mode, "letterbox"); |
| 4005 | fillwidth = fillwidth || !strcmp(pad_mode, "pillarbox"); |
| 4006 | |
| 4007 | if (!strcmp(pad_mode, "custom")) |
| 4008 | { |
| 4009 | pad[0] = ghb_dict_get_int(settings, "PicturePadTop"); |
| 4010 | pad[1] = ghb_dict_get_int(settings, "PicturePadBottom"); |
| 4011 | pad[2] = ghb_dict_get_int(settings, "PicturePadLeft"); |
| 4012 | pad[3] = ghb_dict_get_int(settings, "PicturePadRight"); |
| 4013 | } |
| 4014 | |
| 4015 | if (fillheight && geo->maxHeight > 0) |
| 4016 | { |
| 4017 | pad[0] = (geo->maxHeight - result->height) / 2; |
| 4018 | pad[1] = geo->maxHeight - result->height - pad[0]; |
| 4019 | } |
| 4020 | if (fillwidth && geo->maxWidth > 0) |
| 4021 | { |
| 4022 | pad[2] = (geo->maxWidth - result->width) / 2; |
| 4023 | pad[3] = geo->maxWidth - result->width - pad[2]; |
| 4024 | } |
| 4025 | |
| 4026 | pad[0] = MOD_DOWN(pad[0], 2); |
| 4027 | pad[1] = MOD_DOWN(pad[1], 2); |
| 4028 | pad[2] = MOD_DOWN(pad[2], 2); |
| 4029 | pad[3] = MOD_DOWN(pad[3], 2); |
| 4030 | ghb_dict_set_int(settings, "PicturePadTop", pad[0]); |
| 4031 | ghb_dict_set_int(settings, "PicturePadBottom", pad[1]); |
| 4032 | ghb_dict_set_int(settings, "PicturePadLeft", pad[2]); |
| 4033 | ghb_dict_set_int(settings, "PicturePadRight", pad[3]); |
| 4034 | |
| 4035 | result->width += pad[2] + pad[3]; |
| 4036 | result->height += pad[0] + pad[1]; |
| 4037 | } |
| 4038 | |
| 4039 | void |
| 4040 | ghb_apply_crop(GhbValue *settings, const hb_geometry_crop_t * geo, const hb_title_t * title) |
no test coverage detected