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:
parent
2bdf6ed96f
commit
c82ab0839f
@ -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"
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user