Permalink
Browse files

Ratio conversion fixed

Summary: Fixed the conversion between different ratio values

Reviewed By: kirwan

Differential Revision: D4398135

fbshipit-source-id: 3cc4ebe5682b088025e8793a597e2048cd7a72a2
  • Loading branch information...
1 parent c6dcedc commit be87e8977dc43555e6143a77fbac14a5d49c7971 @massimocarli massimocarli committed with facebook-github-bot Jan 11, 2017
@@ -346,6 +346,6 @@ private static boolean shouldRotate(RotationOptions rotationOptions, EncodedImag
* @return The ratio to use for software resize using the downsampling limitation
*/
@VisibleForTesting static int calculateDownsampleNumerator(int downsampleRatio) {
- return 8 / downsampleRatio;
+ return Math.max(1, JpegTranscoder.SCALE_DENOMINATOR / downsampleRatio);
}
}
@@ -460,6 +460,8 @@ public void testDownsamplingRatioUsage() {
assertEquals(4, calculateDownsampleNumerator(2));
assertEquals(2, calculateDownsampleNumerator(4));
assertEquals(1, calculateDownsampleNumerator(8));
+ assertEquals(1, calculateDownsampleNumerator(16));
+ assertEquals(1, calculateDownsampleNumerator(32));
}
@Test

0 comments on commit be87e89

Please sign in to comment.