Stop using filterquality
Change-Id: I67d1a464618f1a54f4e3bd4e1409b1d91a90e66a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429336
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/gm/bmpfilterqualityrepeat.cpp b/gm/bmpfilterqualityrepeat.cpp
index cec9c07..aa27d70 100644
--- a/gm/bmpfilterqualityrepeat.cpp
+++ b/gm/bmpfilterqualityrepeat.cpp
@@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
-#include "include/core/SkFilterQuality.h"
#include "include/core/SkFont.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
@@ -59,16 +58,6 @@
private:
void drawAll(SkCanvas* canvas, SkScalar scaleX) const {
- constexpr struct {
- SkFilterQuality fQuality;
- const char* fName;
- } kQualities[] = {
- {kNone_SkFilterQuality, "none"},
- {kLow_SkFilterQuality, "low"},
- {kMedium_SkFilterQuality, "medium"},
- {kHigh_SkFilterQuality, "high"},
- };
-
SkRect rect = SkRect::MakeLTRB(20, 60, 220, 210);
SkMatrix lm = SkMatrix::I();
lm.setScaleX(scaleX);
@@ -84,12 +73,21 @@
SkAutoCanvasRestore acr(canvas, true);
- for (size_t q = 0; q < SK_ARRAY_COUNT(kQualities); ++q) {
+ const struct {
+ const char* name;
+ SkSamplingOptions sampling;
+ } recs[] = {
+ { "none", SkSamplingOptions(SkFilterMode::kNearest) },
+ { "low", SkSamplingOptions(SkFilterMode::kLinear) },
+ { "medium", SkSamplingOptions(SkFilterMode::kLinear, SkMipmapMode::kLinear) },
+ { "high", SkSamplingOptions(SkCubicResampler::Mitchell()) },
+ };
+
+ for (const auto& rec : recs) {
constexpr SkTileMode kTM = SkTileMode::kRepeat;
- bmpPaint.setShader(fBmp.makeShader(kTM, kTM,
- SkSamplingOptions(kQualities[q].fQuality), lm));
+ bmpPaint.setShader(fBmp.makeShader(kTM, kTM, rec.sampling, lm));
canvas->drawRect(rect, bmpPaint);
- canvas->drawString(kQualities[q].fName, 20, 40, font, textPaint);
+ canvas->drawString(rec.name, 20, 40, font, textPaint);
canvas->translate(250, 0);
}