Update last gm to use sampling, hide legacy api

persp_shaders_ gm expected diff (in gpu backends only), due to change
from filterquality (which gpu and cpu interpreted differently for mips)
to samplingoptions (which both backends interpret the same).

Specifically for kMedium:
- gpu treated as SkMipmapMode::kLinear
- cpu treated as SkMipmapMode::kNearest

Bug: skia: 7650
Change-Id: Idc53ad8d01d9c928b425c092b36191153714d347
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343737
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2020-12-12 15:24:47 -05:00 committed by Skia Commit-Bot
parent 057fcbec5d
commit 5d8f55bfa8
3 changed files with 5 additions and 8 deletions

View File

@ -60,7 +60,6 @@ protected:
kCellSize, kCellSize, SK_ColorBLUE, SK_ColorYELLOW, kCellSize / 10);
fBitmap.setImmutable();
fBitmapShader = fBitmap.makeShader();
SkPoint pts1[] = {
{ 0, 0 },
{ SkIntToScalar(kCellSize), SkIntToScalar(kCellSize) }
@ -96,8 +95,7 @@ protected:
filterPaint.setAntiAlias(fDoAA);
SkPaint pathPaint;
pathPaint.setShader(fBitmapShader);
pathPaint.setFilterQuality(filterQ);
pathPaint.setShader(fBitmap.makeShader(SkSamplingOptions(filterQ)));
pathPaint.setAntiAlias(fDoAA);
SkPaint gradPaint1;
@ -170,7 +168,6 @@ private:
bool fDoAA;
SkPath fPath;
sk_sp<SkShader> fBitmapShader;
sk_sp<SkShader> fLinearGrad1;
sk_sp<SkShader> fLinearGrad2;
SkMatrix fPerspMatrix;

View File

@ -1133,14 +1133,14 @@ public:
return this->makeShader(sampling, &localMatrix);
}
//#ifdef SK_SUPPORT_LEGACY_IMPLICIT_FILTERQUALITY
#ifdef SK_SUPPORT_LEGACY_IMPLICIT_FILTERQUALITY
sk_sp<SkShader> makeShader(SkTileMode tmx, SkTileMode tmy,
const SkMatrix* localMatrix = nullptr) const;
// defaults to Clamp in x, and y
sk_sp<SkShader> makeShader(const SkMatrix* localMatrix = nullptr) const {
return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, localMatrix);
}
//#endif
#endif
/** Asserts if internal values are illegal or inconsistent. Only available if
SK_DEBUG is defined at compile time.
*/

View File

@ -148,7 +148,7 @@ sk_sp<SkShader> SkBitmap::makeShader(SkTileMode tmx, SkTileMode tmy,
tmx, tmy, &sampling, lm);
}
//#ifdef SK_SUPPORT_LEGACY_IMPLICIT_FILTERQUALITY
#ifdef SK_SUPPORT_LEGACY_IMPLICIT_FILTERQUALITY
sk_sp<SkShader> SkBitmap::makeShader(SkTileMode tmx, SkTileMode tmy, const SkMatrix* lm) const {
if (lm && !lm->invert(nullptr)) {
return nullptr;
@ -156,7 +156,7 @@ sk_sp<SkShader> SkBitmap::makeShader(SkTileMode tmx, SkTileMode tmy, const SkMat
return SkImageShader::Make(SkMakeImageFromRasterBitmap(*this, kIfMutable_SkCopyPixelsMode),
tmx, tmy, nullptr, lm);
}
//#endif
#endif
bool SkShaderBase::appendStages(const SkStageRec& rec) const {
return this->onAppendStages(rec);