Skip to content

Commit

Permalink
Revert "Share code handling legacy SkFilterQuality"
Browse files Browse the repository at this point in the history
This reverts commit 9a8cbe5.

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 <bsalomon@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

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 <reed@google.com>
  • Loading branch information
reed-at-google committed Nov 23, 2020
1 parent f9334e9 commit 95b5fb9
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/gpu/SkGr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<GrSamplerState::Filter>(sampling.fFilter),
static_cast<GrSamplerState::MipmapMode>(sampling.fMipmap),
sampling.fUseCubic,
};
SkUNREACHABLE;
}

0 comments on commit 95b5fb9

Please sign in to comment.