diff options
author | reed <reed@google.com> | 2016-01-20 11:04:40 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-20 11:04:40 -0800 |
commit | 2252edabc16ee349f5e7be2c0b60ece695ca6ec4 (patch) | |
tree | 4c60f78fb4306a4f06720d117ab22c1db8042baa /src/core/SkBitmapProcState.cpp | |
parent | 4e8f567fa3229133670864a06fe4df26f437d14e (diff) |
change kMedium_SkFilterQuality to never pop if we're scaling
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1605193002
Review URL: https://codereview.chromium.org/1605193002
Diffstat (limited to 'src/core/SkBitmapProcState.cpp')
-rw-r--r-- | src/core/SkBitmapProcState.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/core/SkBitmapProcState.cpp b/src/core/SkBitmapProcState.cpp index cb9027c98a..2c4f14506c 100644 --- a/src/core/SkBitmapProcState.cpp +++ b/src/core/SkBitmapProcState.cpp @@ -133,6 +133,15 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { fInvMatrix = inv; fFilterLevel = paint.getFilterQuality(); + const int origW = fProvider.info().width(); + const int origH = fProvider.info().height(); + bool allow_ignore_fractional_translate = true; // historical default +#ifndef SK_SUPPORT_LEGACY_TRANSLATEROUNDHACK + if (kMedium_SkFilterQuality == fFilterLevel) { + allow_ignore_fractional_translate = false; + } +#endif + SkDefaultBitmapController controller; fBMState = controller.requestBitmap(fProvider, inv, paint.getFilterQuality(), fBMStateStorage.get(), fBMStateStorage.size()); @@ -171,7 +180,8 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { if (matrix_only_scale_translate(fInvMatrix)) { SkMatrix forward; if (fInvMatrix.invert(&forward)) { - if (clampClamp ? just_trans_clamp(forward, fPixmap) + if ((clampClamp && allow_ignore_fractional_translate) + ? just_trans_clamp(forward, fPixmap) : just_trans_general(forward)) { #ifdef SK_SUPPORT_LEGACY_TRANSLATEROUNDHACK SkScalar tx = -SkScalarRoundToScalar(forward.getTranslateX()); @@ -202,7 +212,17 @@ bool SkBitmapProcState::chooseProcs(const SkMatrix& inv, const SkPaint& paint) { trivialMatrix = (fInvMatrix.getType() & ~SkMatrix::kTranslate_Mask) == 0; - if (kLow_SkFilterQuality == fFilterLevel) { + // If our target pixmap is the same as the original, then we revert back to legacy behavior + // and allow the code to ignore fractional translate. + // + // The width/height check allows allow_ignore_fractional_translate to stay false if we + // previously set it that way (e.g. we started in kMedium). + // + if (fPixmap.width() == origW && fPixmap.height() == origH) { + allow_ignore_fractional_translate = true; + } + + if (kLow_SkFilterQuality == fFilterLevel && allow_ignore_fractional_translate) { // Only try bilerp if the matrix is "interesting" and // the image has a suitable size. |