Browse Source
Merge branch 'master' into js/quantizer
pull/1654/head
James Jackson-South
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
5 additions and
2 deletions
-
src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs
-
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeKernelMapTests.cs
|
|
|
@ -130,9 +130,9 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms |
|
|
|
int radius = (int)TolerantMath.Ceiling(scale * sampler.Radius); |
|
|
|
|
|
|
|
// 'ratio' is a rational number.
|
|
|
|
// Multiplying it by LCM(sourceSize, destSize)/sourceSize will result in a whole number "again".
|
|
|
|
// Multiplying it by destSize/GCD(sourceSize, destSize) will result in a whole number "again".
|
|
|
|
// This value is determining the length of the periods in repeating kernel map rows.
|
|
|
|
int period = Numerics.LeastCommonMultiple(sourceSize, destinationSize) / sourceSize; |
|
|
|
int period = destinationSize / Numerics.GreatestCommonDivisor(sourceSize, destinationSize); |
|
|
|
|
|
|
|
// the center position at i == 0:
|
|
|
|
double center0 = (ratio - 1) * 0.5; |
|
|
|
|
|
|
|
@ -80,6 +80,9 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
|
{ KnownResamplers.Bicubic, 1680, 1200 }, |
|
|
|
{ KnownResamplers.Box, 13, 299 }, |
|
|
|
{ KnownResamplers.Lanczos5, 3032, 600 }, |
|
|
|
|
|
|
|
// Large number. https://github.com/SixLabors/ImageSharp/issues/1616
|
|
|
|
{ KnownResamplers.Bicubic, 207773, 51943 } |
|
|
|
}; |
|
|
|
|
|
|
|
public static TheoryData<string, int, int> GeneratedImageResizeData = |
|
|
|
|