Chromium Code Reviews| Index: src/core/SkBitmapController.cpp |
| diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp |
| index f4d352507aa616dba7012a677dfce95ad0cad52d..e11a840976d62935307729b6694cc09114cd6678 100644 |
| --- a/src/core/SkBitmapController.cpp |
| +++ b/src/core/SkBitmapController.cpp |
| @@ -65,7 +65,8 @@ 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 = SkScalarAbs(invMat.getScaleX() * invMat.getScaleY()); |
| + return size < (maximumAllocation * invScaleSqr); |
| } |
| /* |
| @@ -97,6 +98,9 @@ bool SkDefaultBitmapControllerState::processHQRequest(const SkBitmapProvider& pr |
| invScaleX = scale.width(); |
| invScaleY = scale.height(); |
| } |
| + invScaleX = SkScalarAbs(invScaleX); |
|
vmpstr
2016/02/04 00:59:04
This is the only bit that requires some thought fo
|
| + invScaleY = SkScalarAbs(invScaleY); |
| + |
| if (SkScalarNearlyEqual(invScaleX, 1) && SkScalarNearlyEqual(invScaleY, 1)) { |
| return false; // no need for HQ |
| } |