From 63f451035ce1a099f4d7d0b8207ea268dcaba483 Mon Sep 17 00:00:00 2001 From: sr55 <sr55.hb@outlook.com> Date: Sat, 10 Feb 2018 20:41:30 +0000 Subject: [PATCH] WinGui: Fixes to Anamorphic handling on the picture tab and in static preview #1169 --- .../Interop/HandBrakeInstance.cs | 2 +- .../ViewModels/PictureSettingsViewModel.cs | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs index 3081faf24..e398edda2 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs @@ -305,7 +305,7 @@ namespace HandBrake.ApplicationServices.Interop { height = settings.Height, width = settings.Width, - par = settings.Anamorphic != Anamorphic.Custom + par = settings.Anamorphic != Anamorphic.Custom && settings.Anamorphic != Anamorphic.Automatic ? new hb_rational_t { den = title.Geometry.PAR.Den, num = title.Geometry.PAR.Num } : new hb_rational_t { den = settings.PixelAspectY, num = settings.PixelAspectX } } diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 828ddfe19..4474938c5 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -807,17 +807,11 @@ namespace HandBrakeWPF.ViewModels { // Custom // Set the Width, and Maintain Aspect ratio. That should calc the Height for us. - this.Task.Width = this.GetModulusValue(this.MaxWidth - this.CropLeft - this.CropRight); - + this.Task.Width = this.GetModulusValue(this.sourceResolution.Width - this.CropLeft - this.CropRight); + if (this.SelectedAnamorphicMode != Anamorphic.Loose) { - this.Task.Height = this.GetModulusValue(this.MaxHeight - this.CropTop - this.CropBottom); - } - - // If our height is too large, let it downscale the width for us by setting the height to the lower value. - if (!this.MaintainAspectRatio && this.Height > this.MaxHeight) - { - this.Task.Height = this.MaxHeight; + this.Task.Height = this.GetModulusValue(this.sourceResolution.Height - this.CropTop - this.CropBottom); } } @@ -829,6 +823,7 @@ namespace HandBrakeWPF.ViewModels title.ParVal.Width, title.ParVal.Height); + // Force a re-calc. This will handle MaxWidth / Height corrections. this.RecaulcatePictureSettingsProperties(ChangedPictureField.Width); } @@ -912,7 +907,7 @@ namespace HandBrakeWPF.ViewModels ParH = this.ParHeight, MaxWidth = this.MaxWidth, MaxHeight = this.MaxHeight, - KeepDisplayAspect = this.MaintainAspectRatio, + KeepDisplayAspect = false, //this.MaintainAspectRatio, AnamorphicMode = this.SelectedAnamorphicMode, Crop = new Cropping(this.CropTop, this.CropBottom, this.CropLeft, this.CropRight), }; -- 2.40.0