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 <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-01-30 09:10:41 -05:00
parent 0acd16cc02
commit 1de89c48c3
8 changed files with 4 additions and 76 deletions

View File

@ -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();
}
}

View File

@ -64,7 +64,6 @@ protected:
hairlinePaint.setStrokeWidth(0);
SkPaint blurPaint;
blurPaint.setFilterQuality(kLow_SkFilterQuality);
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
SkBlurMask::ConvertRadiusToSigma(kBlurRadius)));

View File

@ -969,7 +969,6 @@ private:
SkPaint paint;
paint.setAntiAlias(true);
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setBlendMode(SkBlendMode::kSrcOver);
canvas->experimental_DrawEdgeAAImageSet(

View File

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

View File

@ -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);

View File

@ -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
}

View File

@ -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<int>(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<SkFilterQuality>(filterQualityIdx - 1));
fPaintOverrides.fFilterQuality = true;
}
paramsChanged = true;
}
}
if (ImGui::CollapsingHeader("Font")) {

View File

@ -90,7 +90,6 @@ public:
bool fCapType = false;
bool fJoinType = false;
bool fStyle = false;
bool fFilterQuality = false;
};
struct SkSurfacePropsFields {
bool fFlags = false;