From 1de89c48c3d1c5decf1020a560d442fa7b0f25e9 Mon Sep 17 00:00:00 2001 From: Mike Reed Date: Sat, 30 Jan 2021 09:10:41 -0500 Subject: [PATCH] Don't use filter-quality Bug: skia:11235 Change-Id: I184402f1c9d0f707ccfce761e3c5dbc3084e6c14 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362837 Reviewed-by: Mike Reed Commit-Queue: Mike Reed --- bench/GrMipmapBench.cpp | 5 +++-- gm/blurquickreject.cpp | 1 - gm/compositor_quads.cpp | 1 - src/core/SkCanvas.cpp | 3 --- src/effects/SkShaderMaskFilter.cpp | 1 - tests/PaintTest.cpp | 32 +------------------------- tools/viewer/Viewer.cpp | 36 ------------------------------ tools/viewer/Viewer.h | 1 - 8 files changed, 4 insertions(+), 76 deletions(-) diff --git a/bench/GrMipmapBench.cpp b/bench/GrMipmapBench.cpp index b16c23d3bc..1ed5641167 100644 --- a/bench/GrMipmapBench.cpp +++ b/bench/GrMipmapBench.cpp @@ -47,8 +47,9 @@ protected: // Clear surface once: fSurface->getCanvas()->clear(SK_ColorBLACK); + SkSamplingOptions sampling(SkFilterMode::kLinear, + SkMipmapMode::kLinear); SkPaint paint; - paint.setFilterQuality(kMedium_SkFilterQuality); paint.setColor(SK_ColorWHITE); for (int i = 0; i < loops; i++) { // Touch surface so mips are dirtied @@ -57,7 +58,7 @@ protected: // Draw reduced version of surface to original canvas, to trigger mip generation canvas->save(); canvas->scale(0.1f, 0.1f); - canvas->drawImage(fSurface->makeImageSnapshot(), 0, 0, SkSamplingOptions(), &paint); + canvas->drawImage(fSurface->makeImageSnapshot(), 0, 0, sampling, &paint); canvas->restore(); } } diff --git a/gm/blurquickreject.cpp b/gm/blurquickreject.cpp index e309be4f78..022ac7061b 100644 --- a/gm/blurquickreject.cpp +++ b/gm/blurquickreject.cpp @@ -64,7 +64,6 @@ protected: hairlinePaint.setStrokeWidth(0); SkPaint blurPaint; - blurPaint.setFilterQuality(kLow_SkFilterQuality); blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, SkBlurMask::ConvertRadiusToSigma(kBlurRadius))); diff --git a/gm/compositor_quads.cpp b/gm/compositor_quads.cpp index 8d6dfbe867..01d964a372 100644 --- a/gm/compositor_quads.cpp +++ b/gm/compositor_quads.cpp @@ -969,7 +969,6 @@ private: SkPaint paint; paint.setAntiAlias(true); - paint.setFilterQuality(kLow_SkFilterQuality); paint.setBlendMode(SkBlendMode::kSrcOver); canvas->experimental_DrawEdgeAAImageSet( diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 9f8439fb92..5e0ca4f7fc 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1889,9 +1889,6 @@ static SkPaint clean_paint_for_lattice(const SkPaint* paint) { SkPaint cleaned; if (paint) { cleaned = *paint; - if (paint->getFilterQuality() > kLow_SkFilterQuality) { - cleaned.setFilterQuality(kLow_SkFilterQuality); - } cleaned.setMaskFilter(nullptr); cleaned.setAntiAlias(false); } diff --git a/src/effects/SkShaderMaskFilter.cpp b/src/effects/SkShaderMaskFilter.cpp index 6fd40626bd..b9a361741b 100644 --- a/src/effects/SkShaderMaskFilter.cpp +++ b/src/effects/SkShaderMaskFilter.cpp @@ -99,7 +99,6 @@ bool SkShaderMF::filterMask(SkMask* dst, const SkMask& src, const SkMatrix& ctm, SkPaint paint; paint.setShader(fShader); - paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality); // this blendmode is the trick: we only draw the shader where the mask is paint.setBlendMode(SkBlendMode::kSrcIn); diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp index ba43b4dd69..c37bf1f1f1 100644 --- a/tests/PaintTest.cpp +++ b/tests/PaintTest.cpp @@ -20,29 +20,6 @@ #include "tests/Test.h" #undef ASSERT -// temparary api for bicubic, just be sure we can set/clear it -DEF_TEST(Paint_filterQuality, reporter) { - SkPaint p0, p1; - - REPORTER_ASSERT(reporter, kNone_SkFilterQuality == p0.getFilterQuality()); - - static const SkFilterQuality gQualitys[] = { - kNone_SkFilterQuality, - kLow_SkFilterQuality, - kMedium_SkFilterQuality, - kHigh_SkFilterQuality - }; - for (size_t i = 0; i < SK_ARRAY_COUNT(gQualitys); ++i) { - p0.setFilterQuality(gQualitys[i]); - REPORTER_ASSERT(reporter, gQualitys[i] == p0.getFilterQuality()); - p1 = p0; - REPORTER_ASSERT(reporter, gQualitys[i] == p1.getFilterQuality()); - - p0.reset(); - REPORTER_ASSERT(reporter, kNone_SkFilterQuality == p0.getFilterQuality()); - } -} - DEF_TEST(Paint_copy, reporter) { SkPaint paint; // set a few member variables @@ -104,12 +81,6 @@ DEF_TEST(Paint_regression_cubic, reporter) { } DEF_TEST(Paint_flattening, reporter) { - const SkFilterQuality levels[] = { - kNone_SkFilterQuality, - kLow_SkFilterQuality, - kMedium_SkFilterQuality, - kHigh_SkFilterQuality, - }; const SkPaint::Cap caps[] = { SkPaint::kButt_Cap, SkPaint::kRound_Cap, @@ -135,7 +106,6 @@ DEF_TEST(Paint_flattening, reporter) { // we don't serialize hinting or encoding -- soon to be removed from paint - FOR_SETUP(i, levels, setFilterQuality) FOR_SETUP(l, caps, setStrokeCap) FOR_SETUP(m, joins, setStrokeJoin) FOR_SETUP(p, styles, setStyle) @@ -151,7 +121,7 @@ DEF_TEST(Paint_flattening, reporter) { SkPaintPriv::Unflatten(&paint2, reader, nullptr); REPORTER_ASSERT(reporter, paint2 == paint); - }}}} + }}} #undef FOR_SETUP } diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 7a2dd0c97c..81746e8635 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -951,22 +951,6 @@ void Viewer::updateTitle() { paintFlag(&SkPaintFields::fAntiAlias, &SkPaint::isAntiAlias, "Antialias", "Alias"); paintFlag(&SkPaintFields::fDither, &SkPaint::isDither, "DITHER", "No Dither"); - if (fPaintOverrides.fFilterQuality) { - switch (fPaint.getFilterQuality()) { - case kNone_SkFilterQuality: - paintTitle.append("NoFilter"); - break; - case kLow_SkFilterQuality: - paintTitle.append("LowFilter"); - break; - case kMedium_SkFilterQuality: - paintTitle.append("MediumFilter"); - break; - case kHigh_SkFilterQuality: - paintTitle.append("HighFilter"); - break; - } - } fontFlag(&SkFontFields::fForceAutoHinting, &SkFont::isForceAutoHinting, "Force Autohint", "No Force Autohint"); @@ -1370,9 +1354,6 @@ public: if (fPaintOverrides->fDither) { paint.setDither(fPaint->isDither()); } - if (fPaintOverrides->fFilterQuality) { - paint.setFilterQuality(fPaint->getFilterQuality()); - } return true; } SkPaint* fPaint; @@ -2016,23 +1997,6 @@ void Viewer::drawImGui() { "Default\0No Dither\0Dither\0\0", &SkPaintFields::fDither, &SkPaint::isDither, &SkPaint::setDither); - - int filterQualityIdx = 0; - if (fPaintOverrides.fFilterQuality) { - filterQualityIdx = SkTo(fPaint.getFilterQuality()) + 1; - } - if (ImGui::Combo("Filter Quality", &filterQualityIdx, - "Default\0None\0Low\0Medium\0High\0\0")) - { - if (filterQualityIdx == 0) { - fPaintOverrides.fFilterQuality = false; - fPaint.setFilterQuality(kNone_SkFilterQuality); - } else { - fPaint.setFilterQuality(SkTo(filterQualityIdx - 1)); - fPaintOverrides.fFilterQuality = true; - } - paramsChanged = true; - } } if (ImGui::CollapsingHeader("Font")) { diff --git a/tools/viewer/Viewer.h b/tools/viewer/Viewer.h index 52d449307a..ae5b8b645b 100644 --- a/tools/viewer/Viewer.h +++ b/tools/viewer/Viewer.h @@ -90,7 +90,6 @@ public: bool fCapType = false; bool fJoinType = false; bool fStyle = false; - bool fFilterQuality = false; }; struct SkSurfacePropsFields { bool fFlags = false;