Chromium Code Reviews| Index: src/core/SkBitmapProcState.cpp |
| diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp |
| index d48679e8c993b0ddbb4e7a989b6edad8855307cc..9b708ca82795deb00a1a35bd3c9738b520136b96 100644 |
| --- a/src/core/SkBitmapProcState.cpp |
| +++ b/src/core/SkBitmapProcState.cpp |
| @@ -167,6 +167,21 @@ bool SkBitmapProcState::possiblyScaleImage() { |
| SkScalar invScaleX = fInvMatrix.getScaleX(); |
| SkScalar invScaleY = fInvMatrix.getScaleY(); |
| + if (SkScalarNearlyEqual(invScaleX,1.0f) && |
| + SkScalarNearlyEqual(invScaleY,1.0f)) { |
| + // short-circuit identity scaling; the output is supposed to |
| + // be the same as the input, so we might as well go fast. |
| + |
| + // TODO -- consider short circuiting here if the scale is |
|
reed1
2014/08/08 18:28:21
remove the TODO
humper
2014/08/08 18:39:05
Done.
|
| + // CLOSE to one. |
| + |
| + // Set our filter level to low -- the only post-filtering this |
| + // image might require is some interpolation if the translation |
| + // is fractional. |
| + fFilterLevel = SkPaint::kLow_FilterLevel; |
| + return false; |
| + } |
| + |
| fScaledCacheID = SkScaledImageCache::FindAndLock(fOrigBitmap, |
| invScaleX, invScaleY, |
| &fScaledBitmap); |
| @@ -218,8 +233,10 @@ bool SkBitmapProcState::possiblyScaleImage() { |
| fInvMatrix.setTranslate(fInvMatrix.getTranslateX() / fInvMatrix.getScaleX(), |
| fInvMatrix.getTranslateY() / fInvMatrix.getScaleY()); |
| - // no need for any further filtering; we just did it! |
| - fFilterLevel = SkPaint::kNone_FilterLevel; |
| + // Set our filter level to low -- the only post-filtering this |
| + // image might require is some interpolation if the translation |
| + // is fractional. |
| + fFilterLevel = SkPaint::kLow_FilterLevel; |
| unlocker.release(); |
| return true; |
| } |
| @@ -458,6 +475,12 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { |
| trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0; |
| + // |
|
reed1
2014/08/08 18:28:21
remove //
|
| + |
| + if (trivialMatrix && fFilterLevel > SkPaint::kMedium_FilterLevel) { |
|
reed1
2014/08/08 18:28:21
I *think* we can remove this check now, yes?
humper
2014/08/08 18:39:04
Done.
|
| + fFilterLevel = SkPaint::kMedium_FilterLevel; |
| + } |
| + |
| if (SkPaint::kHigh_FilterLevel == fFilterLevel) { |
| // If this is still set, that means we wanted HQ sampling |
| // but couldn't do it as a preprocess. Let's try to install |