don't get dismayed by negative scales for HQ

needs https://codereview.chromium.org/1663793003/ to land first

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1668033002

Review URL: https://codereview.chromium.org/1668033002
This commit is contained in:
reed 2016-02-03 19:07:54 -08:00 committed by Commit bot
parent 50b98b424c
commit a3d99a515b

View File

@ -65,7 +65,11 @@ static inline bool cache_size_okay(const SkBitmapProvider& provider, const SkMat
// return ((origBitmapSize * matrixScaleFactor) < maximumAllocationSize);
// Skip the division step:
const size_t size = provider.info().getSafeSize(provider.info().minRowBytes());
return size < (maximumAllocation * invMat.getScaleX() * invMat.getScaleY());
SkScalar invScaleSqr = invMat.getScaleX() * invMat.getScaleY();
#ifndef SK_SUPPORT_LEGACY_NEG_SCALE_HQ
invScaleSqr = SkScalarAbs(invScaleSqr);
#endif
return size < (maximumAllocation * invScaleSqr);
}
/*
@ -97,6 +101,11 @@ bool SkDefaultBitmapControllerState::processHQRequest(const SkBitmapProvider& pr
invScaleX = scale.width();
invScaleY = scale.height();
}
#ifndef SK_SUPPORT_LEGACY_NEG_SCALE_HQ
invScaleX = SkScalarAbs(invScaleX);
invScaleY = SkScalarAbs(invScaleY);
#endif
if (SkScalarNearlyEqual(invScaleX, 1) && SkScalarNearlyEqual(invScaleY, 1)) {
return false; // no need for HQ
}