MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / rotate_changed_cb

Function rotate_changed_cb

gtk/src/callbacks.c:3659–3732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3657}
3658
3659G_MODULE_EXPORT void
3660rotate_changed_cb (GtkWidget *widget, gpointer data)
3661{
3662 int angle, hflip, prev_angle, prev_hflip;
3663 signal_user_data_t *ud = ghb_ud();
3664
3665 ghb_log_func();
3666 prev_angle = ghb_dict_get_int(ud->settings, "rotate");
3667 prev_hflip = ghb_dict_get_int(ud->settings, "hflip");
3668
3669 ghb_widget_to_setting(ud->settings, widget);
3670 ghb_clear_presets_selection(ud);
3671 ghb_live_reset(ud);
3672
3673 hb_geometry_crop_t geo;
3674
3675 // First normalize current settings to 0 angle 0 hflip
3676 geo.geometry.width = ghb_dict_get_int(ud->settings, "scale_width");
3677 geo.geometry.height = ghb_dict_get_int(ud->settings, "scale_height");
3678 geo.geometry.par.num =
3679 ghb_dict_get_int(ud->settings, "PicturePARWidth");
3680 geo.geometry.par.den =
3681 ghb_dict_get_int(ud->settings, "PicturePARHeight");
3682 geo.crop[0] = ghb_dict_get_int(ud->settings, "PictureTopCrop");
3683 geo.crop[1] = ghb_dict_get_int(ud->settings, "PictureBottomCrop");
3684 geo.crop[2] = ghb_dict_get_int(ud->settings, "PictureLeftCrop");
3685 geo.crop[3] = ghb_dict_get_int(ud->settings, "PictureRightCrop");
3686
3687 geo.pad[0] = ghb_dict_get_int(ud->settings, "PicturePadTop");
3688 geo.pad[1] = ghb_dict_get_int(ud->settings, "PicturePadBottom");
3689 geo.pad[2] = ghb_dict_get_int(ud->settings, "PicturePadLeft");
3690 geo.pad[3] = ghb_dict_get_int(ud->settings, "PicturePadRight");
3691 // Normally hflip is applied, then rotation.
3692 // To revert, must apply rotation then hflip.
3693 hb_rotate_geometry(&geo, &geo, 360 - prev_angle, 0);
3694 hb_rotate_geometry(&geo, &geo, 0, prev_hflip);
3695
3696 const hb_title_t * title;
3697 int title_id, titleindex;
3698
3699 title_id = ghb_dict_get_int(ud->settings, "title");
3700 title = ghb_lookup_title(title_id, &titleindex);
3701 if (title != NULL)
3702 {
3703 // If there is a title, reset to title width/height so that
3704 // dimension limits get properly re-applied
3705 geo.geometry.width = title->geometry.width;
3706 geo.geometry.height = title->geometry.height;
3707 }
3708
3709 // rotate dimensions to new angle and hflip
3710 angle = ghb_dict_get_int(ud->settings, "rotate");
3711 hflip = ghb_dict_get_int(ud->settings, "hflip");
3712 hb_rotate_geometry(&geo, &geo, angle, hflip);
3713
3714 ghb_dict_set_int(ud->settings, "scale_width",
3715 geo.geometry.width - geo.crop[2] - geo.crop[3]);
3716 ghb_dict_set_int(ud->settings, "scale_height",

Callers

nothing calls this directly

Calls 9

ghb_udFunction · 0.85
ghb_dict_get_intFunction · 0.85
ghb_widget_to_settingFunction · 0.85
ghb_live_resetFunction · 0.85
hb_rotate_geometryFunction · 0.85
ghb_lookup_titleFunction · 0.85
ghb_dict_set_intFunction · 0.85
ghb_set_scaleFunction · 0.85

Tested by

no test coverage detected