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>
This commit is contained in:
Mike Reed 2021-07-16 22:19:26 -04:00 committed by Skia Commit-Bot
parent 2bdf6ed96f
commit c82ab0839f
29 changed files with 27 additions and 61 deletions

View File

@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"

View File

@ -12,6 +12,12 @@
DEF_SIMPLE_GM(bicubic, canvas, 300, 320) {
canvas->clear(SK_ColorBLACK);
const SkSamplingOptions gSamplings[] = {
SkSamplingOptions(SkFilterMode::kNearest),
SkSamplingOptions(SkFilterMode::kLinear),
SkSamplingOptions(SkCubicResampler::Mitchell()),
};
auto make_img = []() {
auto surf = SkSurface::MakeRasterN32Premul(7, 7);
surf->getCanvas()->drawColor(SK_ColorBLACK);
@ -25,8 +31,8 @@ DEF_SIMPLE_GM(bicubic, canvas, 300, 320) {
auto img = make_img();
canvas->scale(40, 8);
for (auto q : {kNone_SkFilterQuality, kLow_SkFilterQuality, kHigh_SkFilterQuality}) {
canvas->drawImage(img, 0, 0, SkSamplingOptions(q), nullptr);
for (const auto& s : gSamplings) {
canvas->drawImage(img, 0, 0, s, nullptr);
canvas->translate(0, img->height() + 1.0f);
}

View File

@ -10,7 +10,6 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkFont.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPaint.h"

View File

@ -10,7 +10,6 @@
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMaskFilter.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkMaskFilter.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"

View File

@ -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 @@ protected:
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 @@ private:
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);
}

View File

@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"

View File

@ -14,7 +14,6 @@
#include "include/core/SkColor.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkData.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkFont.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"

View File

@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkData.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPixmap.h"

View File

@ -10,7 +10,6 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkFont.h"
#include "include/core/SkFontMgr.h"
#include "include/core/SkFontTypes.h"

View File

@ -10,7 +10,6 @@
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkFont.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"

View File

@ -10,7 +10,6 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"

View File

@ -10,7 +10,6 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMatrix.h"

View File

@ -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/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRect.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkScalar.h"
@ -108,22 +107,19 @@ protected:
SkMatrix m;
if (fDoRotate) {
// m.setRotate(SkIntToScalar(30), 0, 0);
m.setSkew(SK_Scalar1, 0, 0, 0);
// m.postScale(2*SK_Scalar1/3, 2*SK_Scalar1/3);
} else {
SkScalar scale = 11*SK_Scalar1/12;
m.setScale(scale, scale);
}
paint.setShader(getBitmap().makeShader(fMode, fMode,
SkSamplingOptions(fDoFilter ? kLow_SkFilterQuality
: kNone_SkFilterQuality),
m));
paint.setShader(getBitmap().makeShader(
fMode, fMode,
SkSamplingOptions(fDoFilter ? SkFilterMode::kLinear
: SkFilterMode::kNearest),
m));
canvas->translate(SkIntToScalar(50), SkIntToScalar(50));
// SkRect r = SkRect::MakeXYWH(-50, -50, 32, 16);
// canvas->drawRect(r, paint); return;
canvas->drawPaint(paint);
}

View File

@ -10,7 +10,6 @@
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkImageInfo.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMatrix.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMatrix.h"

View File

@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"

View File

@ -7,7 +7,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkFont.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkMatrix.h"

View File

@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkPaint.h"

View File

@ -8,7 +8,6 @@
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageFilter.h"
#include "include/core/SkPaint.h"

View File

@ -9,7 +9,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkImage.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
@ -60,13 +59,4 @@ DEF_SIMPLE_GM_BG(matriximagefilter, canvas, 420, 100, SK_ColorBLACK) {
canvas->translate(srcRect.width() + margin, 0);
draw(canvas, srcRect, checkerboard, matrix, SkSamplingOptions(SkFilterMode::kLinear));
#if 0
// This may be causing Mac 10.6 to barf.
canvas->translate(srcRect.width() + margin, 0);
draw(canvas, srcRect, checkerboard, matrix, kMedium_SkFilterQuality);
canvas->translate(srcRect.width() + margin, 0);
draw(canvas, srcRect, checkerboard, matrix, kHigh_SkFilterQuality);
#endif
}

View File

@ -30,7 +30,7 @@ static void build_ImFontAtlas(ImFontAtlas& atlas, SkPaint& fontPaint) {
SkPixmap pmap(info, pixels, info.minRowBytes());
SkMatrix localMatrix = SkMatrix::Scale(1.0f / w, 1.0f / h);
auto fontImage = SkImage::MakeFromRaster(pmap, nullptr, nullptr);
auto fontShader = fontImage->makeShader(SkSamplingOptions(kLow_SkFilterQuality), localMatrix);
auto fontShader = fontImage->makeShader(SkSamplingOptions(SkFilterMode::kLinear), localMatrix);
fontPaint.setShader(fontShader);
fontPaint.setColor(SK_ColorWHITE);
atlas.TexID = &fontPaint;