From 95b5fb9213d745aa8dd435044ca771554f2a3794 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Mon, 23 Nov 2020 19:51:24 +0000 Subject: [PATCH] Revert "Share code handling legacy SkFilterQuality" This reverts commit 9a8cbe52e18aff6d7cc54ca0eacb75402e6ef6eb. Reason for revert: forgot to retain the ganesh-diff of performing trilerp for kMedium Original change's description: > Share code handling legacy SkFilterQuality > > Change-Id: Idfd3b96896d7fa2cdcf9127b4d30e2fc29bcab79 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337436 > Reviewed-by: Brian Salomon > Commit-Queue: Mike Reed TBR=bsalomon@google.com,robertphillips@google.com,reed@google.com Change-Id: I1e126be4c81fa3cfd21ead6734a530eb9509c3d7 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337639 Reviewed-by: Mike Reed --- src/gpu/SkGr.cpp | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 56716da5ed2f0..d08b4f0010e3f 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -457,10 +457,14 @@ GrInterpretFilterQuality(SkISize imageDims, const SkMatrix& localM, bool sharpenMipmappedTextures, bool allowFilterQualityReduction) { + using Filter = GrSamplerState::Filter; + using MipmapMode = GrSamplerState::MipmapMode; switch (paintFilterQuality) { - case kNone_SkFilterQuality: break; - case kLow_SkFilterQuality: break; - case kMedium_SkFilterQuality: + case kNone_SkFilterQuality: + return {Filter::kNearest, MipmapMode::kNone, false}; + case kLow_SkFilterQuality: + return {Filter::kLinear, MipmapMode::kNone, false}; + case kMedium_SkFilterQuality: { if (allowFilterQualityReduction) { SkMatrix matrix; matrix.setConcat(viewM, localM); @@ -475,22 +479,25 @@ GrInterpretFilterQuality(SkISize imageDims, // 2^0.5/2 = s SkScalar mipScale = sharpenMipmappedTextures ? SK_ScalarRoot2Over2 : SK_Scalar1; if (matrix.getMinScale() >= mipScale) { - paintFilterQuality = kLow_SkFilterQuality; + return {Filter::kLinear, MipmapMode::kNone, false}; } } - break; - case kHigh_SkFilterQuality: + return {Filter::kLinear, MipmapMode::kLinear, false}; + } + case kHigh_SkFilterQuality: { if (allowFilterQualityReduction) { SkMatrix matrix; matrix.setConcat(viewM, localM); paintFilterQuality = SkMatrixPriv::AdjustHighQualityFilterLevel(matrix); } - break; + switch (paintFilterQuality) { + case kNone_SkFilterQuality: return {Filter::kNearest, MipmapMode::kNone , false}; + case kLow_SkFilterQuality: return {Filter::kLinear , MipmapMode::kNone , false}; + case kMedium_SkFilterQuality: return {Filter::kLinear , MipmapMode::kLinear, false}; + case kHigh_SkFilterQuality: return {Filter::kNearest, MipmapMode::kNone , true }; + } + SkUNREACHABLE; + } } - auto sampling = SkSamplingOptions(paintFilterQuality); - return { - static_cast(sampling.fFilter), - static_cast(sampling.fMipmap), - sampling.fUseCubic, - }; + SkUNREACHABLE; }