Fix kMediumQuality invMatrix setup for sizes == mip levels
When downscaling with kMediumQuality in non-clamp mode, if we happen to hit a size == mip level, then SkBitmapProcInfo::init takes the trivial matrix path and doesn't set up a matrix for normalized coords on the assumption that we're going to ignore the transform. But kMediumQuality disables allow_ignore_fractional_translate, so we take the filter path after all - but with an incorrect matrix.
R=reed@google.com
BUG=chromium:661180
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2476713002
Review-Url: https://codereview.chromium.org/2476713002
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp
index 1508f94..f04379c 100644
--- a/src/core/SkBitmapProcState.cpp
+++ b/src/core/SkBitmapProcState.cpp
@@ -158,7 +158,9 @@
// We don't do this if we're either trivial (can ignore the matrix) or clamping
// in both X and Y since clamping to width,height is just as easy as to 0xFFFF.
- if (!(clampClamp || trivialMatrix)) {
+ // Note that we cannot ignore the matrix when allow_ignore_fractional_translate is false.
+
+ if (!(clampClamp || (trivialMatrix && allow_ignore_fractional_translate))) {
fInvMatrix.postIDiv(fPixmap.width(), fPixmap.height());
}