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:
parent
0acd16cc02
commit
1de89c48c3
@ -47,8 +47,9 @@ protected:
|
|||||||
// Clear surface once:
|
// Clear surface once:
|
||||||
fSurface->getCanvas()->clear(SK_ColorBLACK);
|
fSurface->getCanvas()->clear(SK_ColorBLACK);
|
||||||
|
|
||||||
|
SkSamplingOptions sampling(SkFilterMode::kLinear,
|
||||||
|
SkMipmapMode::kLinear);
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
paint.setFilterQuality(kMedium_SkFilterQuality);
|
|
||||||
paint.setColor(SK_ColorWHITE);
|
paint.setColor(SK_ColorWHITE);
|
||||||
for (int i = 0; i < loops; i++) {
|
for (int i = 0; i < loops; i++) {
|
||||||
// Touch surface so mips are dirtied
|
// Touch surface so mips are dirtied
|
||||||
@ -57,7 +58,7 @@ protected:
|
|||||||
// Draw reduced version of surface to original canvas, to trigger mip generation
|
// Draw reduced version of surface to original canvas, to trigger mip generation
|
||||||
canvas->save();
|
canvas->save();
|
||||||
canvas->scale(0.1f, 0.1f);
|
canvas->scale(0.1f, 0.1f);
|
||||||
canvas->drawImage(fSurface->makeImageSnapshot(), 0, 0, SkSamplingOptions(), &paint);
|
canvas->drawImage(fSurface->makeImageSnapshot(), 0, 0, sampling, &paint);
|
||||||
canvas->restore();
|
canvas->restore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,6 @@ protected:
|
|||||||
hairlinePaint.setStrokeWidth(0);
|
hairlinePaint.setStrokeWidth(0);
|
||||||
|
|
||||||
SkPaint blurPaint;
|
SkPaint blurPaint;
|
||||||
blurPaint.setFilterQuality(kLow_SkFilterQuality);
|
|
||||||
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
blurPaint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
|
||||||
SkBlurMask::ConvertRadiusToSigma(kBlurRadius)));
|
SkBlurMask::ConvertRadiusToSigma(kBlurRadius)));
|
||||||
|
|
||||||
|
@ -969,7 +969,6 @@ private:
|
|||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
paint.setFilterQuality(kLow_SkFilterQuality);
|
|
||||||
paint.setBlendMode(SkBlendMode::kSrcOver);
|
paint.setBlendMode(SkBlendMode::kSrcOver);
|
||||||
|
|
||||||
canvas->experimental_DrawEdgeAAImageSet(
|
canvas->experimental_DrawEdgeAAImageSet(
|
||||||
|
@ -1889,9 +1889,6 @@ static SkPaint clean_paint_for_lattice(const SkPaint* paint) {
|
|||||||
SkPaint cleaned;
|
SkPaint cleaned;
|
||||||
if (paint) {
|
if (paint) {
|
||||||
cleaned = *paint;
|
cleaned = *paint;
|
||||||
if (paint->getFilterQuality() > kLow_SkFilterQuality) {
|
|
||||||
cleaned.setFilterQuality(kLow_SkFilterQuality);
|
|
||||||
}
|
|
||||||
cleaned.setMaskFilter(nullptr);
|
cleaned.setMaskFilter(nullptr);
|
||||||
cleaned.setAntiAlias(false);
|
cleaned.setAntiAlias(false);
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,6 @@ bool SkShaderMF::filterMask(SkMask* dst, const SkMask& src, const SkMatrix& ctm,
|
|||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
paint.setShader(fShader);
|
paint.setShader(fShader);
|
||||||
paint.setFilterQuality(SkFilterQuality::kLow_SkFilterQuality);
|
|
||||||
// this blendmode is the trick: we only draw the shader where the mask is
|
// this blendmode is the trick: we only draw the shader where the mask is
|
||||||
paint.setBlendMode(SkBlendMode::kSrcIn);
|
paint.setBlendMode(SkBlendMode::kSrcIn);
|
||||||
|
|
||||||
|
@ -20,29 +20,6 @@
|
|||||||
#include "tests/Test.h"
|
#include "tests/Test.h"
|
||||||
#undef ASSERT
|
#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) {
|
DEF_TEST(Paint_copy, reporter) {
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
// set a few member variables
|
// set a few member variables
|
||||||
@ -104,12 +81,6 @@ DEF_TEST(Paint_regression_cubic, reporter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEF_TEST(Paint_flattening, reporter) {
|
DEF_TEST(Paint_flattening, reporter) {
|
||||||
const SkFilterQuality levels[] = {
|
|
||||||
kNone_SkFilterQuality,
|
|
||||||
kLow_SkFilterQuality,
|
|
||||||
kMedium_SkFilterQuality,
|
|
||||||
kHigh_SkFilterQuality,
|
|
||||||
};
|
|
||||||
const SkPaint::Cap caps[] = {
|
const SkPaint::Cap caps[] = {
|
||||||
SkPaint::kButt_Cap,
|
SkPaint::kButt_Cap,
|
||||||
SkPaint::kRound_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
|
// 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(l, caps, setStrokeCap)
|
||||||
FOR_SETUP(m, joins, setStrokeJoin)
|
FOR_SETUP(m, joins, setStrokeJoin)
|
||||||
FOR_SETUP(p, styles, setStyle)
|
FOR_SETUP(p, styles, setStyle)
|
||||||
@ -151,7 +121,7 @@ DEF_TEST(Paint_flattening, reporter) {
|
|||||||
SkPaintPriv::Unflatten(&paint2, reader, nullptr);
|
SkPaintPriv::Unflatten(&paint2, reader, nullptr);
|
||||||
REPORTER_ASSERT(reporter, paint2 == paint);
|
REPORTER_ASSERT(reporter, paint2 == paint);
|
||||||
|
|
||||||
}}}}
|
}}}
|
||||||
#undef FOR_SETUP
|
#undef FOR_SETUP
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -951,22 +951,6 @@ void Viewer::updateTitle() {
|
|||||||
|
|
||||||
paintFlag(&SkPaintFields::fAntiAlias, &SkPaint::isAntiAlias, "Antialias", "Alias");
|
paintFlag(&SkPaintFields::fAntiAlias, &SkPaint::isAntiAlias, "Antialias", "Alias");
|
||||||
paintFlag(&SkPaintFields::fDither, &SkPaint::isDither, "DITHER", "No Dither");
|
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,
|
fontFlag(&SkFontFields::fForceAutoHinting, &SkFont::isForceAutoHinting,
|
||||||
"Force Autohint", "No Force Autohint");
|
"Force Autohint", "No Force Autohint");
|
||||||
@ -1370,9 +1354,6 @@ public:
|
|||||||
if (fPaintOverrides->fDither) {
|
if (fPaintOverrides->fDither) {
|
||||||
paint.setDither(fPaint->isDither());
|
paint.setDither(fPaint->isDither());
|
||||||
}
|
}
|
||||||
if (fPaintOverrides->fFilterQuality) {
|
|
||||||
paint.setFilterQuality(fPaint->getFilterQuality());
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
SkPaint* fPaint;
|
SkPaint* fPaint;
|
||||||
@ -2016,23 +1997,6 @@ void Viewer::drawImGui() {
|
|||||||
"Default\0No Dither\0Dither\0\0",
|
"Default\0No Dither\0Dither\0\0",
|
||||||
&SkPaintFields::fDither,
|
&SkPaintFields::fDither,
|
||||||
&SkPaint::isDither, &SkPaint::setDither);
|
&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")) {
|
if (ImGui::CollapsingHeader("Font")) {
|
||||||
|
@ -90,7 +90,6 @@ public:
|
|||||||
bool fCapType = false;
|
bool fCapType = false;
|
||||||
bool fJoinType = false;
|
bool fJoinType = false;
|
||||||
bool fStyle = false;
|
bool fStyle = false;
|
||||||
bool fFilterQuality = false;
|
|
||||||
};
|
};
|
||||||
struct SkSurfacePropsFields {
|
struct SkSurfacePropsFields {
|
||||||
bool fFlags = false;
|
bool fFlags = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user