Skip to content

Commit

Permalink
Remove vestigates of paint's filterquality
Browse files Browse the repository at this point in the history
Assumes no client still defines/needs SK_SUPPORT_LEGACY_SETFILTERQUALITY

Change-Id: If51f91ca8cad493cb5c03afcfade3838c5d78a35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429816
Commit-Queue: Mike Reed <[email protected]>
Reviewed-by: Florin Malita <[email protected]>
  • Loading branch information
reed-at-google authored and Skia Commit-Bot committed Jul 20, 2021
1 parent e40495d commit a9c2e3b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 51 deletions.
17 changes: 0 additions & 17 deletions include/core/SkPaint.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,6 @@ class SK_API SkPaint {
*/
void setDither(bool dither) { fBitfields.fDither = static_cast<unsigned>(dither); }

#ifdef SK_SUPPORT_LEGACY_SETFILTERQUALITY
// DEPRECATED -- this field is unused.
SkFilterQuality getFilterQuality() const {
return (SkFilterQuality)fBitfields.fFilterQuality;
}

// DEPRECATED -- this field is unused.
void setFilterQuality(SkFilterQuality fq) {
fBitfields.fFilterQuality = fq;
}
#endif

/** \enum SkPaint::Style
Set Style to fill, stroke, or both fill and stroke geometry.
The stroke and fill
Expand Down Expand Up @@ -733,12 +721,7 @@ class SK_API SkPaint {
unsigned fCapType : 2;
unsigned fJoinType : 2;
unsigned fStyle : 2;
#ifdef SK_SUPPORT_LEGACY_FILTERQUALITY
unsigned fFilterQuality : 2;
unsigned fPadding : 22; // 22 == 32 -1-1-2-2-2-2
#else
unsigned fPadding : 24; // 24 == 32 -1-1-2-2-2
#endif
} fBitfields;
uint32_t fBitfieldsUInt;
};
Expand Down
12 changes: 3 additions & 9 deletions src/core/SkPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ SkPaint::SkPaint()
(unsigned)SkPaint::kDefault_Cap, // fCapType
(unsigned)SkPaint::kDefault_Join, // fJoinType
(unsigned)SkPaint::kFill_Style, // fStyle
#ifdef SK_SUPPORT_LEGACY_FILTERQUALITY
(unsigned)kNone_SkFilterQuality, // fFilterQuality
#endif
0} // fPadding
{
static_assert(sizeof(fBitfields) == sizeof(fBitfieldsUInt), "");
Expand Down Expand Up @@ -265,9 +262,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);
#ifdef SK_SUPPORT_LEGACY_SETFILTERQUALITY
packed |= shift_bits(paint.getFilterQuality(), 22, 2);
#endif
packed |= shift_bits(0, 22, 2); // was filterquality
packed |= shift_bits(flatFlags, 24, 8);
return packed;
}
Expand All @@ -290,10 +285,9 @@ static uint32_t unpack_v68(SkPaint* paint, uint32_t packed, SkSafeRange& safe) {
packed >>= 2;
paint->setStyle(safe.checkLE(packed & 0x3, SkPaint::kStrokeAndFill_Style));
packed >>= 2;
#ifdef SK_SUPPORT_LEGACY_SETFILTERQUALITY
paint->setFilterQuality(safe.checkLE(packed & 0x3, kLast_SkFilterQuality));
#endif
// skip the (now ignored) filterquality bits
packed >>= 2;

return packed;
}

Expand Down
30 changes: 5 additions & 25 deletions src/core/SkPicturePlayback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
#include "src/core/SkVerticesPriv.h"
#include "src/utils/SkPatchUtils.h"

static SkLegacyFQ get_filter_quality(const SkPaint& paint) {
#ifdef SK_SUPPORT_LEGACY_SETFILTERQUALITY
return (SkLegacyFQ)paint.getFilterQuality();
#else
return kNone_SkLegacyFQ;
#endif
}

static SkLegacyFQ get_filter_quality(const SkPaint* paint) {
return paint ? get_filter_quality(*paint) : kNone_SkLegacyFQ;
}

static const SkRect* get_rect_ptr(SkReadBuffer* reader, SkRect* storage) {
if (reader->readBool()) {
reader->readRect(storage);
Expand Down Expand Up @@ -301,7 +289,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
if (op == DRAW_EDGEAA_IMAGE_SET2) {
sampling = reader->readSampling();
} else {
sampling = SkSamplingPriv::FromFQ(get_filter_quality(paint));
sampling = SkSamplingOptions(SkFilterMode::kNearest);
}

SkCanvas::SrcRectConstraint constraint =
Expand Down Expand Up @@ -369,7 +357,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
BREAK_ON_READ_ERROR(reader);

canvas->drawImage(image, loc.fX, loc.fY,
SkSamplingPriv::FromFQ(get_filter_quality(paint)),
SkSamplingOptions(SkFilterMode::kNearest),
paint);
} break;
case DRAW_IMAGE2: {
Expand All @@ -390,11 +378,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
const SkRect* dst = reader->skipT<SkRect>();
BREAK_ON_READ_ERROR(reader);

SkFilterMode filter = SkFilterMode::kNearest;
if (paint && get_filter_quality(*paint) != kNone_SkLegacyFQ) {
filter = SkFilterMode::kLinear;
}
canvas->drawImageLattice(image, lattice, *dst, filter, paint);
canvas->drawImageLattice(image, lattice, *dst, SkFilterMode::kNearest, paint);
} break;
case DRAW_IMAGE_LATTICE2: {
const SkPaint* paint = fPictureData->optionalPaint(reader);
Expand All @@ -416,11 +400,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
reader->readRect(&dst);
BREAK_ON_READ_ERROR(reader);

SkFilterMode filter = SkFilterMode::kNearest;
if (paint && get_filter_quality(*paint) != kNone_SkLegacyFQ) {
filter = SkFilterMode::kLinear;
}
canvas->drawImageNine(image, center, dst, filter, paint);
canvas->drawImageNine(image, center, dst, SkFilterMode::kNearest, paint);
} break;
case DRAW_IMAGE_RECT: {
const SkPaint* paint = fPictureData->optionalPaint(reader);
Expand All @@ -438,7 +418,7 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader,
}
BREAK_ON_READ_ERROR(reader);

auto sampling = SkSamplingPriv::FromFQ(get_filter_quality(paint));
auto sampling = SkSamplingOptions(SkFilterMode::kNearest);
if (src) {
canvas->drawImageRect(image, *src, dst, sampling, paint, constraint);
} else {
Expand Down

0 comments on commit a9c2e3b

Please sign in to comment.