FilterQuality should no longer be needed.

Start to clean up.

Change-Id: I6dea9344d8a19010d6e22ee8d0cd2b795910a82c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386843
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2021-03-19 16:00:52 -04:00 committed by Skia Commit-Bot
parent 4b76265c66
commit 7cee3efb6b
12 changed files with 9 additions and 53 deletions

View File

@ -830,7 +830,6 @@ static void fuzz_paint(Fuzz* fuzz, SkPaint* paint, int depth) {
paint->setDither( make_fuzz_t<bool>(fuzz));
paint->setColor( make_fuzz_t<SkColor>(fuzz));
paint->setBlendMode( make_fuzz_enum_range<SkBlendMode>(fuzz, SkBlendMode::kLastMode));
SkPaintPriv::SetFQ(paint, make_fuzz_enum_range<SkFilterQuality>(fuzz, kLast_SkFilterQuality));
paint->setStyle( make_fuzz_enum_range<SkPaint::Style>(fuzz,
SkPaint::Style::kStrokeAndFill_Style));
paint->setShader( make_fuzz_shader(fuzz, depth - 1));

View File

@ -47,9 +47,6 @@ static void init_paint(Fuzz* fuzz, SkPaint* p) {
fuzz->next(&b);
p->setDither(b);
fuzz->nextRange(&tmp_u8, 0, (int)kHigh_SkFilterQuality);
SkPaintPriv::SetFQ(p, static_cast<SkFilterQuality>(tmp_u8));
fuzz->nextRange(&tmp_u8, 0, (int)SkPaint::kLast_Cap);
p->setStrokeCap(static_cast<SkPaint::Cap>(tmp_u8));

View File

@ -485,7 +485,7 @@ void SkParticleEffect::update(double now) {
void SkParticleEffect::draw(SkCanvas* canvas) {
if (this->isAlive() && fParams->fDrawable) {
SkPaint paint;
SkPaintPriv::SetFQ(&paint, SkFilterQuality::kMedium_SkFilterQuality);
paint.setFilterQuality(SkFilterQuality::kMedium_SkFilterQuality);
fParams->fDrawable->draw(canvas, fParticles, fCount, paint);
}
}

View File

@ -8,7 +8,6 @@
#include "include/core/SkBitmap.h"
#include "include/core/SkData.h"
#include "include/core/SkFilterQuality.h"
#include "include/core/SkMallocPixelRef.h"
#include "include/core/SkMath.h"
#include "include/core/SkPixelRef.h"

View File

@ -8,7 +8,6 @@
#ifndef SkMatrixPriv_DEFINE
#define SkMatrixPriv_DEFINE
#include "include/core/SkFilterQuality.h"
#include "include/core/SkM44.h"
#include "include/core/SkMatrix.h"
#include "include/private/SkNx.h"

View File

@ -235,7 +235,7 @@ static uint32_t pack_v68(const SkPaint& paint, unsigned flatFlags) {
packed |= shift_bits(paint.getStrokeCap(), 16, 2);
packed |= shift_bits(paint.getStrokeJoin(), 18, 2);
packed |= shift_bits(paint.getStyle(), 20, 2);
packed |= shift_bits(SkPaintPriv::GetFQ(paint), 22, 2);
packed |= shift_bits(paint.getFilterQuality(), 22, 2);
packed |= shift_bits(flatFlags, 24, 8);
return packed;
}

View File

@ -73,9 +73,6 @@ public:
// Since we may be filtering now, we need to know what color space to filter in,
// typically the color space of the device we're drawing into.
static void RemoveColorFilter(SkPaint*, SkColorSpace* dstCS);
static SkFilterQuality GetFQ(const SkPaint& paint) { return paint.getFilterQuality(); }
static void SetFQ(SkPaint* paint, SkFilterQuality fq) { paint->setFilterQuality(fq); }
};
#endif

View File

@ -226,7 +226,7 @@ static inline bool skpaint_to_grpaint_impl(GrRecordingContext* context,
SkBlendMode* primColorMode,
GrPaint* grPaint) {
// TODO: take sampling directly
SkSamplingOptions sampling(SkPaintPriv::GetFQ(skPaint),
SkSamplingOptions sampling(skPaint.getFilterQuality(),
SkSamplingOptions::kMedium_asMipmapLinear);
// Convert SkPaint color to 4f format in the destination color space
@ -434,7 +434,7 @@ bool SkPaintToGrPaintWithTexture(GrRecordingContext* context,
bool textureIsAlphaOnly,
GrPaint* grPaint) {
// TODO: take sampling directly
SkSamplingOptions sampling(SkPaintPriv::GetFQ(paint),
SkSamplingOptions sampling(paint.getFilterQuality(),
SkSamplingOptions::kMedium_asMipmapLinear);
std::unique_ptr<GrFragmentProcessor> shaderFP;

View File

@ -225,7 +225,7 @@ void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkSamplingO
}
void SkSurface::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) {
SkSamplingOptions sampling(paint ? SkPaintPriv::GetFQ(*paint) : kNone_SkFilterQuality);
SkSamplingOptions sampling(paint ? paint->getFilterQuality() : kNone_SkFilterQuality);
this->draw(canvas, x, y, sampling, paint);
}

View File

@ -233,9 +233,9 @@ SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec,
auto supported = [](const SkSamplingOptions& sampling) {
const std::tuple<SkFilterMode,SkMipmapMode> supported[] = {
{SkFilterMode::kNearest, SkMipmapMode::kNone}, // legacy kNone_SkFilterQuality
{SkFilterMode::kLinear, SkMipmapMode::kNone}, // legacy kLow_SkFilterQuality
{SkFilterMode::kLinear, SkMipmapMode::kNearest}, // legacy kMedium_SkFilterQuality
{SkFilterMode::kNearest, SkMipmapMode::kNone}, // legacy None
{SkFilterMode::kLinear, SkMipmapMode::kNone}, // legacy Low
{SkFilterMode::kLinear, SkMipmapMode::kNearest}, // legacy Medium
};
for (auto [f, m] : supported) {
if (sampling.filter == f && sampling.mipmap == m) {
@ -590,16 +590,6 @@ bool SkImageShader::doStages(const SkStageRec& rec, SkImageStageUpdater* updater
decal_ctx->limit_y = limit_y->scale;
}
#if 0 // TODO: when we support kMedium
if (updator && (quality == kMedium_SkFilterQuality)) {
// if we change levels in mipmap, we need to update the scales (and invScales)
updator->fGather = gather;
updator->fLimitX = limit_x;
updator->fLimitY = limit_y;
updator->fDecal = decal_ctx;
}
#endif
auto append_tiling_and_gather = [&] {
if (decal_x_and_y) {
p->append(SkRasterPipeline::decal_x_and_y, decal_ctx);

View File

@ -76,7 +76,7 @@ static void check_compressed_mipmaps(GrRecordingContext* rContext, sk_sp<SkImage
const SkSamplingOptions sampling(SkFilterMode::kLinear,
SkMipmapMode::kLinear);
SkPaint p;
SkPaintPriv::SetFQ(&p, kMedium_SkFilterQuality); // to force mipMapping
p.setFilterQuality(kMedium_SkFilterQuality); // to force mipMapping
p.setBlendMode(SkBlendMode::kSrc);
int numMipLevels = 1;

View File

@ -114,7 +114,6 @@ class GrDirectContext;
#define DEBUGCANVAS_ATTRIBUTE_CUBICS "cubics"
#define DEBUGCANVAS_ATTRIBUTE_COLORS "colors"
#define DEBUGCANVAS_ATTRIBUTE_TEXTURECOORDS "textureCoords"
#define DEBUGCANVAS_ATTRIBUTE_FILTERQUALITY "filterQuality"
#define DEBUGCANVAS_ATTRIBUTE_STARTANGLE "startAngle"
#define DEBUGCANVAS_ATTRIBUTE_SWEEPANGLE "sweepAngle"
#define DEBUGCANVAS_ATTRIBUTE_USECENTER "useCenter"
@ -192,11 +191,6 @@ class GrDirectContext;
#define DEBUGCANVAS_ALPHATYPE_UNPREMUL "unpremul"
#define DEBUGCANVAS_ALPHATYPE_UNKNOWN "unknown"
#define DEBUGCANVAS_FILTERQUALITY_NONE "none"
#define DEBUGCANVAS_FILTERQUALITY_LOW "low"
#define DEBUGCANVAS_FILTERQUALITY_MEDIUM "medium"
#define DEBUGCANVAS_FILTERQUALITY_HIGH "high"
#define DEBUGCANVAS_HINTING_NONE "none"
#define DEBUGCANVAS_HINTING_SLIGHT "slight"
#define DEBUGCANVAS_HINTING_NORMAL "normal"
@ -824,24 +818,6 @@ static void apply_paint_join(const SkPaint& paint, SkJSONWriter& writer) {
}
}
static void apply_paint_filterquality(const SkPaint& paint, SkJSONWriter& writer) {
SkFilterQuality quality = SkPaintPriv::GetFQ(paint);
switch (quality) {
case kNone_SkFilterQuality: break;
case kLow_SkFilterQuality:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILTERQUALITY, DEBUGCANVAS_FILTERQUALITY_LOW);
break;
case kMedium_SkFilterQuality:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILTERQUALITY,
DEBUGCANVAS_FILTERQUALITY_MEDIUM);
break;
case kHigh_SkFilterQuality:
writer.appendString(DEBUGCANVAS_ATTRIBUTE_FILTERQUALITY,
DEBUGCANVAS_FILTERQUALITY_HIGH);
break;
}
}
static void apply_paint_maskfilter(const SkPaint& paint,
SkJSONWriter& writer,
UrlDataManager& urlDataManager) {
@ -948,7 +924,6 @@ void DrawCommand::MakeJsonPaint(SkJSONWriter& writer,
apply_paint_blend_mode(paint, writer);
apply_paint_cap(paint, writer);
apply_paint_join(paint, writer);
apply_paint_filterquality(paint, writer);
apply_paint_patheffect(paint, writer, urlDataManager);
apply_paint_maskfilter(paint, writer, urlDataManager);
apply_flattenable(DEBUGCANVAS_ATTRIBUTE_SHADER, paint.getShader(), writer, urlDataManager);