diff options
author | sr55 <[email protected]> | 2017-07-04 22:08:26 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2017-07-04 22:08:44 +0100 |
commit | 63e20c1d2c79792c092fbe943a0fd5a9d49e6958 (patch) | |
tree | cf61ca9caf424cf8688089d690e2e6c43b7a04e5 /win/CS/HandBrake.ApplicationServices | |
parent | dfe48634d770a386d43ef4d8d21bc537ee02a090 (diff) |
WinGui: Don't enable the Display Width control for Custom Anamorphic when KeepAR is checked. Implement Reduce function for PAR so that the behaviour matches the Linux GUI. Couple of Logic and ordering bug fixes.
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs index 1acb411b0..b8fb24778 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs @@ -304,6 +304,29 @@ namespace HandBrake.ApplicationServices.Interop return JsonConvert.DeserializeObject<Geometry>(result);
}
+ public static void Reduce(long den, long num, out long x, out long y)
+ {
+ // find the greatest common divisor of num & den by Euclid's algorithm
+ long n = num, d = den;
+ while (d > 0)
+ {
+ long t = d;
+ d = n % d;
+ n = t;
+ }
+
+ // at this point n is the gcd. if it's non-zero remove it from num
+ // and den. Otherwise just return the original values.
+ if (n > 0)
+ {
+ num /= n;
+ den /= n;
+ }
+
+ x = num;
+ y = den;
+ }
+
/// <summary>
/// Sends the message logged event to any registered listeners.
/// </summary>
|