diff options
author | reed <reed@google.com> | 2016-02-03 19:07:54 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-03 19:07:54 -0800 |
commit | a3d99a515bb379b60c38189de435b47bdc8dd528 (patch) | |
tree | 52f129d194628de0b3cb1dda3f11d24ade3434f3 /src/core/SkBitmapController.cpp | |
parent | 50b98b424ccf780f76a1a6fb6e24940ffe681d53 (diff) |
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
Diffstat (limited to 'src/core/SkBitmapController.cpp')
-rw-r--r-- | src/core/SkBitmapController.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp index f4d352507a..7a317b8c2f 100644 --- a/src/core/SkBitmapController.cpp +++ b/src/core/SkBitmapController.cpp @@ -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 } |