Remove SkDrawFilter.
Change-Id: I0204a9522e828c87bb7c6c20ae34ce51161442af
Reviewed-on: https://skia-review.googlesource.com/137895
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/docs/SkCanvas_Reference.bmh b/docs/SkCanvas_Reference.bmh
index db14d01..91de067 100644
--- a/docs/SkCanvas_Reference.bmh
+++ b/docs/SkCanvas_Reference.bmh
@@ -6321,14 +6321,6 @@
##
-#Method SkDrawFilter* getDrawFilter() const
-#Deprecated soon
-##
-
-#Method virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter)
-#Deprecated soon
-##
-
# ------------------------------------------------------------------------------
#Method virtual bool isClipEmpty() const
diff --git a/docs/undocumented.bmh b/docs/undocumented.bmh
index c4a65a1..86c9275 100644
--- a/docs/undocumented.bmh
+++ b/docs/undocumented.bmh
@@ -285,11 +285,6 @@
##
##
-#Topic Draw_Filter
-#Class SkDrawFilter
-##
-##
-
#Topic Draw_Layer
##
diff --git a/gm/drawfilter.cpp b/gm/drawfilter.cpp
deleted file mode 100644
index f054cc5..0000000
--- a/gm/drawfilter.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gm.h"
-#include "SkBlurMask.h"
-#include "SkCanvas.h"
-#include "SkDrawFilter.h"
-#include "SkMaskFilter.h"
-#include "SkPaint.h"
-
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-
-/**
- * Initial test coverage for SkDrawFilter.
- * Draws two rectangles; if draw filters are broken, they will match.
- * If draw filters are working correctly, the first will be blue and blurred,
- * the second red and sharp.
- */
-
-namespace {
-class TestFilter : public SkDrawFilter {
-public:
- bool filter(SkPaint* p, Type) override {
- p->setColor(SK_ColorRED);
- p->setMaskFilter(nullptr);
- return true;
- }
-};
-}
-
-class DrawFilterGM : public skiagm::GM {
- sk_sp<SkMaskFilter> fBlur;
-
-protected:
- SkISize onISize() override {
- return SkISize::Make(320, 240);
- }
-
- SkString onShortName() override {
- return SkString("drawfilter");
- }
-
- void onOnceBeforeDraw() override {
- fBlur = SkMaskFilter::MakeBlur(kNormal_SkBlurStyle,
- SkBlurMask::ConvertRadiusToSigma(10.0f));
- }
-
- void onDraw(SkCanvas* canvas) override {
- SkPaint p;
- p.setColor(SK_ColorBLUE);
- p.setMaskFilter(fBlur);
- SkRect r = { 20, 20, 100, 100 };
- canvas->setDrawFilter(nullptr);
- canvas->drawRect(r, p);
- canvas->setDrawFilter(new TestFilter)->unref();
- canvas->translate(120.0f, 40.0f);
- canvas->drawRect(r, p);
- canvas->setDrawFilter(nullptr);
- }
-
-private:
- typedef GM INHERITED;
-};
-
-DEF_GM( return new DrawFilterGM; )
-
-#endif
diff --git a/gn/core.gni b/gn/core.gni
index 5b3e053..d379816 100644
--- a/gn/core.gni
+++ b/gn/core.gni
@@ -394,7 +394,6 @@
"$_include/core/SkDeque.h",
"$_include/core/SkDocument.h",
"$_include/core/SkDrawable.h",
- "$_include/core/SkDrawFilter.h",
"$_include/core/SkDrawLooper.h",
"$_include/core/SkFlattenable.h",
"$_include/core/SkFontArguments.h",
diff --git a/gn/effects.gni b/gn/effects.gni
index 299d5e9..9d14a53 100644
--- a/gn/effects.gni
+++ b/gn/effects.gni
@@ -26,7 +26,6 @@
"$_src/effects/SkOverdrawColorFilter.cpp",
"$_src/effects/SkPackBits.cpp",
"$_src/effects/SkPackBits.h",
- "$_src/effects/SkPaintFlagsDrawFilter.cpp",
"$_src/effects/SkShaderMaskFilter.cpp",
"$_src/effects/SkTableColorFilter.cpp",
"$_src/effects/SkTableMaskFilter.cpp",
@@ -67,7 +66,6 @@
"$_include/effects/SkLayerDrawLooper.h",
"$_include/effects/SkLumaColorFilter.h",
"$_include/effects/SkOverdrawColorFilter.h",
- "$_include/effects/SkPaintFlagsDrawFilter.h",
"$_include/effects/SkPerlinNoiseShader.h",
"$_include/effects/SkTableColorFilter.h",
"$_include/effects/SkTableMaskFilter.h",
diff --git a/gn/gm.gni b/gn/gm.gni
index a4074c2..1b60d5a 100644
--- a/gn/gm.gni
+++ b/gn/gm.gni
@@ -113,7 +113,6 @@
"$_gm/drawatlas.cpp",
"$_gm/drawatlascolor.cpp",
"$_gm/drawbitmaprect.cpp",
- "$_gm/drawfilter.cpp",
"$_gm/drawlooper.cpp",
"$_gm/drawminibitmaprect.cpp",
"$_gm/drawregion.cpp",
diff --git a/gn/tests.gni b/gn/tests.gni
index 7ffbb0b..b98fe46 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -56,7 +56,6 @@
"$_tests/DiscardableMemoryPoolTest.cpp",
"$_tests/DiscardableMemoryTest.cpp",
"$_tests/DrawBitmapRectTest.cpp",
- "$_tests/DrawFilterTest.cpp",
"$_tests/DrawOpAtlasTest.cpp",
"$_tests/DrawPathTest.cpp",
"$_tests/DrawTextTest.cpp",
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index abac335..bd95911 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -35,7 +35,6 @@
class SkData;
class SkDraw;
class SkDrawable;
-class SkDrawFilter;
struct SkDrawShadowRec;
class SkGlyphRunBuilder;
class SkImage;
@@ -492,9 +491,9 @@
*/
bool writePixels(const SkBitmap& bitmap, int x, int y);
- /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms).
- Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
- restoring the SkMatrix, clip, and SkDrawFilter to their state when save() was called.
+ /** Saves SkMatrix and clip.
+ Calling restore() discards changes to SkMatrix and clip, restoring the SkMatrix and clip to
+ their state when save() was called.
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(),
and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion().
@@ -508,10 +507,8 @@
*/
int save();
- /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
- and allocates a SkBitmap for subsequent drawing.
- Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
- and draws the SkBitmap.
+ /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
+ Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
@@ -531,10 +528,8 @@
*/
int saveLayer(const SkRect* bounds, const SkPaint* paint);
- /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
- and allocates a SkBitmap for subsequent drawing.
- Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
- and draws the SkBitmap.
+ /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
+ Calling restore() discards changes to SkMatrix and clip, and draws the SkBitmap.
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
@@ -556,12 +551,10 @@
return this->saveLayer(&bounds, paint);
}
- /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
- and allocates a SkBitmap for subsequent drawing.
+ /** Saves SkMatrix and clip, and allocates a SkBitmap for subsequent drawing.
LCD text is preserved when the layer is drawn to the prior layer.
- Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
- and draws layer.
+ Calling restore() discards changes to SkMatrix and clip, and draws layer.
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
@@ -585,11 +578,10 @@
*/
int saveLayerPreserveLCDTextRequests(const SkRect* bounds, const SkPaint* paint);
- /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
- and allocates SkBitmap for subsequent drawing.
+ /** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
- Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
- and blends layer with alpha opacity onto prior layer.
+ Calling restore() discards changes to SkMatrix and clip, and blends layer with alpha opacity
+ onto prior layer.
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(),
@@ -716,10 +708,9 @@
SaveLayerFlags fSaveLayerFlags = 0;
};
- /** Saves SkMatrix, clip, and SkDrawFilter (SkDrawFilter deprecated on most platforms),
- and allocates SkBitmap for subsequent drawing.
+ /** Saves SkMatrix and clip, and allocates SkBitmap for subsequent drawing.
- Calling restore() discards changes to SkMatrix, clip, and SkDrawFilter,
+ Calling restore() discards changes to SkMatrix and clip,
and blends SkBitmap with alpha opacity onto the prior layer.
SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(),
@@ -735,14 +726,14 @@
*/
int saveLayer(const SaveLayerRec& layerRec);
- /** Removes changes to SkMatrix, clip, and SkDrawFilter since SkCanvas state was
- last saved. The state is removed from the stack.
+ /** Removes changes to SkMatrix and clip since SkCanvas state was last saved.
+ The state is removed from the stack.
Does nothing if the stack is empty.
*/
void restore();
- /** Returns the number of saved states, each containing: SkMatrix, clip, and SkDrawFilter.
+ /** Returns the number of saved states, each containing: SkMatrix and clip.
Equals the number of save() calls less the number of restore() calls plus one.
The save count of a new canvas is one.
@@ -750,7 +741,7 @@
*/
int getSaveCount() const;
- /** Restores state to SkMatrix, clip, and SkDrawFilter values when save(), saveLayer(),
+ /** Restores state to SkMatrix and clip values when save(), saveLayer(),
saveLayerPreserveLCDTextRequests(), or saveLayerAlpha() returned saveCount.
Does nothing if saveCount is greater than state stack count.
@@ -2388,16 +2379,6 @@
//////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- /** To be deprecated soon.
- */
- SkDrawFilter* getDrawFilter() const;
-
- /** To be deprecated soon.
- */
- virtual SkDrawFilter* setDrawFilter(SkDrawFilter* filter);
-#endif
-
/** Returns true if clip is empty; that is, nothing will draw.
May do work when called; it should not be called
diff --git a/include/core/SkDrawFilter.h b/include/core/SkDrawFilter.h
deleted file mode 100644
index 7150419..0000000
--- a/include/core/SkDrawFilter.h
+++ /dev/null
@@ -1,53 +0,0 @@
-
-/*
- * Copyright 2011 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkDrawFilter_DEFINED
-#define SkDrawFilter_DEFINED
-
-#include "SkRefCnt.h"
-
-class SkCanvas;
-class SkPaint;
-
-/**
- * DEPRECATED - use SkPaintFilterCanvas instead.
- *
- * Right before something is being draw, filter() is called with the
- * paint. The filter may modify the paint as it wishes, which will then be
- * used for the actual drawing. Note: this modification only lasts for the
- * current draw, as a temporary copy of the paint is used.
- */
-class SK_API SkDrawFilter : public SkRefCnt {
-public:
- enum Type {
- kPaint_Type,
- kPoint_Type,
- kLine_Type,
- kBitmap_Type,
- kRect_Type,
- kRRect_Type,
- kOval_Type,
- kPath_Type,
- kText_Type,
- };
-
- static constexpr int kTypeCount = kText_Type + 1;
-
- /**
- * Called with the paint that will be used to draw the specified type.
- * The implementation may modify the paint as they wish. If filter()
- * returns false, the draw will be skipped.
- */
- virtual bool filter(SkPaint*, Type) = 0;
-
-private:
- typedef SkRefCnt INHERITED;
-};
-
-#endif
diff --git a/include/effects/SkPaintFlagsDrawFilter.h b/include/effects/SkPaintFlagsDrawFilter.h
deleted file mode 100644
index 10dd3c4..0000000
--- a/include/effects/SkPaintFlagsDrawFilter.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2008 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkPaintFlagsDrawFilter_DEFINED
-#define SkPaintFlagsDrawFilter_DEFINED
-
-#include "SkDrawFilter.h"
-
-class SK_API SkPaintFlagsDrawFilter : public SkDrawFilter {
-public:
- SkPaintFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags);
-
- bool filter(SkPaint*, Type) override;
-
-private:
- uint16_t fClearFlags; // user specified
- uint16_t fSetFlags; // user specified
-};
-
-#endif
diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h
index 188c0a1..f7307d9 100644
--- a/include/utils/SkNWayCanvas.h
+++ b/include/utils/SkNWayCanvas.h
@@ -22,13 +22,6 @@
virtual void removeCanvas(SkCanvas*);
virtual void removeAll();
- ///////////////////////////////////////////////////////////////////////////
- // These are forwarded to the N canvases we're referencing
-
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- SkDrawFilter* setDrawFilter(SkDrawFilter*) override;
-#endif
-
protected:
SkTDArray<SkCanvas*> fList;
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index 37dae88..f6c637d 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -22,7 +22,6 @@
#include "SkTime.h"
#include "SkTypeface.h"
#include "SkUtils.h"
-#include "SkDrawFilter.h"
#include "SkClipOpPriv.h"
static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) {
@@ -97,20 +96,6 @@
canvas->drawRect(r, paint);
}
-class RedFilter : public SkDrawFilter {
-public:
- bool filter(SkPaint* p, SkDrawFilter::Type) override {
- fColor = p->getColor();
- if (fColor == SK_ColorRED) {
- p->setColor(SK_ColorGREEN);
- }
- return true;
- }
-
-private:
- SkColor fColor;
-};
-
class LayersView : public SkView {
public:
LayersView() {}
diff --git a/src/core/SkBitmapDevice.h b/src/core/SkBitmapDevice.h
index e2cedaa..5c4af03 100644
--- a/src/core/SkBitmapDevice.h
+++ b/src/core/SkBitmapDevice.h
@@ -74,8 +74,7 @@
/** These are called inside the per-device-layer loop for each draw call.
When these are called, we have already applied any saveLayer operations,
- and are handling any looping from the paint, and any effects from the
- DrawFilter.
+ and are handling any looping from the paint.
*/
void drawPaint(const SkPaint& paint) override;
void drawPoints(SkCanvas::PointMode mode, size_t count,
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 5b2a2cf..afdb4f9 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -14,7 +14,6 @@
#include "SkClipStack.h"
#include "SkColorFilter.h"
#include "SkDraw.h"
-#include "SkDrawFilter.h"
#include "SkDrawLooper.h"
#include "SkDrawable.h"
#include "SkGlyphCache.h"
@@ -219,7 +218,6 @@
*/
class SkCanvas::MCRec {
public:
- SkDrawFilter* fFilter; // the current filter (or null)
DeviceCM* fLayer;
/* If there are any layers in the stack, this points to the top-most
one that is at or below this level in the stack (so we know what
@@ -233,7 +231,6 @@
int fDeferredSaveCount;
MCRec() {
- fFilter = nullptr;
fLayer = nullptr;
fTopLayer = nullptr;
fMatrix.reset();
@@ -243,7 +240,6 @@
inc_rec();
}
MCRec(const MCRec& prev) : fRasterClip(prev.fRasterClip), fMatrix(prev.fMatrix) {
- fFilter = SkSafeRef(prev.fFilter);
fLayer = nullptr;
fTopLayer = prev.fTopLayer;
fDeferredSaveCount = 0;
@@ -252,7 +248,6 @@
inc_rec();
}
~MCRec() {
- SkSafeUnref(fFilter);
delete fLayer;
dec_rec();
}
@@ -371,11 +366,6 @@
AutoDrawLooper(SkCanvas* canvas, const SkPaint& paint, bool skipLayerForImageFilter = false,
const SkRect* rawBounds = nullptr) : fOrigPaint(paint) {
fCanvas = canvas;
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- fFilter = canvas->getDrawFilter();
-#else
- fFilter = nullptr;
-#endif
fPaint = &fOrigPaint;
fSaveCount = canvas->getSaveCount();
fTempLayerForImageFilter = false;
@@ -425,7 +415,7 @@
} else {
fLooperContext = nullptr;
// can we be marked as simple?
- fIsSimple = !fFilter && !fTempLayerForImageFilter;
+ fIsSimple = !fTempLayerForImageFilter;
}
}
@@ -442,14 +432,14 @@
return *fPaint;
}
- bool next(SkDrawFilter::Type drawType) {
+ bool next() {
if (fDone) {
return false;
} else if (fIsSimple) {
fDone = true;
return !fPaint->nothingToDraw();
} else {
- return this->doNext(drawType);
+ return this->doNext();
}
}
@@ -458,7 +448,6 @@
SkLazyPaint fLazyPaintPerLooper; // per-draw-looper storage, so the looper can modify it
SkCanvas* fCanvas;
const SkPaint& fOrigPaint;
- SkDrawFilter* fFilter;
const SkPaint* fPaint;
int fSaveCount;
bool fTempLayerForImageFilter;
@@ -467,13 +456,13 @@
SkDrawLooper::Context* fLooperContext;
SkSTArenaAlloc<48> fAlloc;
- bool doNext(SkDrawFilter::Type drawType);
+ bool doNext();
};
-bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) {
+bool AutoDrawLooper::doNext() {
fPaint = nullptr;
SkASSERT(!fIsSimple);
- SkASSERT(fLooperContext || fFilter || fTempLayerForImageFilter);
+ SkASSERT(fLooperContext || fTempLayerForImageFilter);
SkPaint* paint = fLazyPaintPerLooper.set(fLazyPaintInit.isValid() ?
*fLazyPaintInit.get() : fOrigPaint);
@@ -489,20 +478,10 @@
fDone = true;
return false;
}
- if (fFilter) {
- if (!fFilter->filter(paint, drawType)) {
- fDone = true;
- return false; // can we really do this, if we haven't finished fLooperContext?
- }
- if (nullptr == fLooperContext) {
- // no looper means we only draw once
- fDone = true;
- }
- }
fPaint = paint;
// if we only came in here for the imagefilter, mark us as done
- if (!fLooperContext && !fFilter) {
+ if (!fLooperContext) {
fDone = true;
}
return true;
@@ -513,26 +492,26 @@
#define LOOPER_BEGIN_DRAWBITMAP(paint, skipLayerForFilter, bounds) \
this->predrawNotify(); \
AutoDrawLooper looper(this, paint, skipLayerForFilter, bounds); \
- while (looper.next(SkDrawFilter::kBitmap_Type)) { \
+ while (looper.next()) { \
SkDrawIter iter(this);
-#define LOOPER_BEGIN_DRAWDEVICE(paint, type) \
+#define LOOPER_BEGIN_DRAWDEVICE(paint) \
this->predrawNotify(); \
AutoDrawLooper looper(this, paint, true); \
- while (looper.next(type)) { \
+ while (looper.next()) { \
SkDrawIter iter(this);
-#define LOOPER_BEGIN(paint, type, bounds) \
+#define LOOPER_BEGIN(paint, bounds) \
this->predrawNotify(); \
AutoDrawLooper looper(this, paint, false, bounds); \
- while (looper.next(type)) { \
+ while (looper.next()) { \
SkDrawIter iter(this);
-#define LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, type, bounds, auxOpaque) \
+#define LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, bounds, auxOpaque) \
this->predrawNotify(bounds, &paint, auxOpaque); \
AutoDrawLooper looper(this, paint, false, bounds); \
- while (looper.next(type)) { \
+ while (looper.next()) { \
SkDrawIter iter(this);
#define LOOPER_END }
@@ -692,18 +671,6 @@
dec_canvas();
}
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-SkDrawFilter* SkCanvas::getDrawFilter() const {
- return fMCRec->fFilter;
-}
-
-SkDrawFilter* SkCanvas::setDrawFilter(SkDrawFilter* filter) {
- this->checkForDeferredSave();
- SkRefCnt_SafeAssign(fMCRec->fFilter, filter);
- return filter;
-}
-#endif
-
SkMetaData& SkCanvas::getMetaData() {
// metadata users are rare, so we lazily allocate it. If that changes we
// can decide to just make it a field in the device (rather than a ptr)
@@ -1255,7 +1222,7 @@
paint = &tmp;
}
- LOOPER_BEGIN_DRAWDEVICE(*paint, SkDrawFilter::kBitmap_Type)
+ LOOPER_BEGIN_DRAWDEVICE(*paint)
while (iter.next()) {
SkBaseDevice* dstDev = iter.fDevice;
@@ -1945,7 +1912,7 @@
SkPaint paint;
const SkRect& pathBounds = path.getBounds();
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, &pathBounds)
+ LOOPER_BEGIN(paint, &pathBounds)
while (iter.next()) {
iter.fDevice->drawShadow(path, rec);
}
@@ -1967,7 +1934,7 @@
}
void SkCanvas::internalDrawPaint(const SkPaint& paint) {
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kPaint_Type, nullptr, false)
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, nullptr, false)
while (iter.next()) {
iter.fDevice->drawPaint(looper.paint());
@@ -2003,7 +1970,7 @@
SkASSERT(pts != nullptr);
- LOOPER_BEGIN(paint, SkDrawFilter::kPoint_Type, bounds)
+ LOOPER_BEGIN(paint, bounds)
while (iter.next()) {
iter.fDevice->drawPoints(mode, count, pts, looper.paint());
@@ -2014,9 +1981,6 @@
static bool needs_autodrawlooper(SkCanvas* canvas, const SkPaint& paint) {
return ((intptr_t)paint.getImageFilter() |
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- (intptr_t)canvas->getDrawFilter() |
-#endif
(intptr_t)paint.getLooper() ) != 0;
}
@@ -2030,7 +1994,7 @@
}
if (needs_autodrawlooper(this, paint)) {
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, SkDrawFilter::kRect_Type, &r, false)
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(paint, &r, false)
while (iter.next()) {
iter.fDevice->drawRect(r, looper.paint());
@@ -2055,7 +2019,7 @@
}
}
- LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, ®ionRect)
+ LOOPER_BEGIN(paint, ®ionRect)
while (iter.next()) {
iter.fDevice->drawRegion(region, looper.paint());
@@ -2073,7 +2037,7 @@
}
}
- LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, &oval)
+ LOOPER_BEGIN(paint, &oval)
while (iter.next()) {
iter.fDevice->drawOval(oval, looper.paint());
@@ -2094,7 +2058,7 @@
}
}
- LOOPER_BEGIN(paint, SkDrawFilter::kOval_Type, &oval)
+ LOOPER_BEGIN(paint, &oval)
while (iter.next()) {
iter.fDevice->drawArc(oval, startAngle, sweepAngle, useCenter, looper.paint());
@@ -2121,7 +2085,7 @@
return;
}
- LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, &rrect.getBounds())
+ LOOPER_BEGIN(paint, &rrect.getBounds())
while (iter.next()) {
iter.fDevice->drawRRect(rrect, looper.paint());
@@ -2138,7 +2102,7 @@
}
}
- LOOPER_BEGIN(paint, SkDrawFilter::kRRect_Type, &outer.getBounds())
+ LOOPER_BEGIN(paint, &outer.getBounds())
while (iter.next()) {
iter.fDevice->drawDRRect(outer, inner, looper.paint());
@@ -2167,7 +2131,7 @@
}
}
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, &pathBounds)
+ LOOPER_BEGIN(paint, &pathBounds)
while (iter.next()) {
iter.fDevice->drawPath(path, looper.paint());
@@ -2275,8 +2239,7 @@
}
paint = &realPaint;
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, SkDrawFilter::kBitmap_Type, &dst,
- image->isOpaque())
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, &dst, image->isOpaque())
while (iter.next()) {
iter.fDevice->drawImageRect(image, src, dst, looper.paint(), constraint);
@@ -2356,8 +2319,7 @@
paint = lazy.init();
}
- LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, SkDrawFilter::kBitmap_Type, &dst,
- bitmap.isOpaque())
+ LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, &dst, bitmap.isOpaque())
while (iter.next()) {
iter.fDevice->drawBitmapRect(bitmap, src, dst, looper.paint(), constraint);
@@ -2385,7 +2347,7 @@
}
paint = &realPaint;
- LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
+ LOOPER_BEGIN(*paint, &dst)
while (iter.next()) {
iter.fDevice->drawImageNine(image, center, dst, looper.paint());
@@ -2408,7 +2370,7 @@
}
paint = &realPaint;
- LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
+ LOOPER_BEGIN(*paint, &dst)
while (iter.next()) {
iter.fDevice->drawBitmapNine(bitmap, center, dst, looper.paint());
@@ -2430,7 +2392,7 @@
}
paint = &realPaint;
- LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
+ LOOPER_BEGIN(*paint, &dst)
while (iter.next()) {
iter.fDevice->drawImageLattice(image, lattice, dst, looper.paint());
@@ -2452,7 +2414,7 @@
}
paint = &realPaint;
- LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &dst)
+ LOOPER_BEGIN(*paint, &dst)
while (iter.next()) {
iter.fDevice->drawBitmapLattice(bitmap, lattice, dst, looper.paint());
@@ -2464,7 +2426,7 @@
void SkCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
fScratchGlyphRunBuilder->prepareDrawText(
@@ -2479,7 +2441,7 @@
void SkCanvas::onDrawPosText(const void* text, size_t byteLength, const SkPoint pos[],
const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
fScratchGlyphRunBuilder->prepareDrawPosText(looper.paint(), text, byteLength, pos);
@@ -2493,7 +2455,7 @@
void SkCanvas::onDrawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[],
SkScalar constY, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
fScratchGlyphRunBuilder->prepareDrawPosTextH(
@@ -2507,7 +2469,7 @@
void SkCanvas::onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
const SkMatrix* matrix, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
iter.fDevice->drawTextOnPath(text, byteLength, path, matrix, looper.paint());
@@ -2522,7 +2484,7 @@
return;
}
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
iter.fDevice->drawTextRSXform(text, byteLength, xform, looper.paint());
@@ -2546,18 +2508,13 @@
// We cannot filter in the looper as we normally do, because the paint is
// incomplete at this point (text-related attributes are embedded within blob run paints).
- SkDrawFilter* drawFilter = fMCRec->fFilter;
- fMCRec->fFilter = nullptr;
-
- LOOPER_BEGIN(paint, SkDrawFilter::kText_Type, bounds)
+ LOOPER_BEGIN(paint, bounds)
while (iter.next()) {
- iter.fDevice->drawTextBlob(blob, x, y, looper.paint(), drawFilter);
+ iter.fDevice->drawTextBlob(blob, x, y, looper.paint());
}
LOOPER_END
-
- fMCRec->fFilter = drawFilter;
}
void SkCanvas::drawString(const SkString& string, SkScalar x, SkScalar y, const SkPaint& paint) {
@@ -2615,7 +2572,7 @@
void SkCanvas::onDrawVerticesObject(const SkVertices* vertices, const SkMatrix* bones,
int boneCount, SkBlendMode bmode, const SkPaint& paint) {
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
// In the common case of one iteration we could std::move vertices here.
@@ -2647,7 +2604,7 @@
return;
}
- LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
iter.fDevice->drawPatch(cubics, colors, texCoords, bmode, paint);
@@ -2698,7 +2655,7 @@
pnt = *paint;
}
- LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, nullptr)
+ LOOPER_BEGIN(pnt, nullptr)
while (iter.next()) {
iter.fDevice->drawAtlas(atlas, xform, tex, colors, count, bmode, pnt);
}
@@ -2709,7 +2666,7 @@
SkASSERT(key);
SkPaint paint;
- LOOPER_BEGIN(paint, SkDrawFilter::kRect_Type, nullptr)
+ LOOPER_BEGIN(paint, nullptr)
while (iter.next()) {
iter.fDevice->drawAnnotation(rect, key, value);
}
diff --git a/src/core/SkColorSpaceXformCanvas.cpp b/src/core/SkColorSpaceXformCanvas.cpp
index caf07fb..949dd4a 100644
--- a/src/core/SkColorSpaceXformCanvas.cpp
+++ b/src/core/SkColorSpaceXformCanvas.cpp
@@ -267,13 +267,6 @@
return kNoLayer_SaveLayerStrategy;
}
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- SkDrawFilter* setDrawFilter(SkDrawFilter* filter) override {
- SkCanvas::setDrawFilter(filter);
- return fTarget->setDrawFilter(filter);
- }
-#endif
-
// Everything from here on should be uninteresting strictly proxied state-change calls.
void willSave() override { fTarget->save(); }
void willRestore() override { fTarget->restore(); }
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index 2b7fef6..b6f5291 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -9,7 +9,6 @@
#include "SkColorFilter.h"
#include "SkDraw.h"
-#include "SkDrawFilter.h"
#include "SkGlyphRun.h"
#include "SkImageFilter.h"
#include "SkImageFilterCache.h"
@@ -141,7 +140,7 @@
}
void SkBaseDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
- const SkPaint &paint, SkDrawFilter* drawFilter) {
+ const SkPaint &paint) {
SkPaint runPaint = paint;
@@ -153,12 +152,6 @@
// so it is safe to not re-seed the paint for this reason.
it.applyFontToPaint(&runPaint);
- if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) {
- // A false return from filter() means we should abort the current draw.
- runPaint = paint;
- continue;
- }
-
switch (it.positioning()) {
case SkTextBlob::kDefault_Positioning: {
auto origin = SkPoint::Make(x + offset.x(), y + offset.y());
@@ -179,11 +172,6 @@
default:
SK_ABORT("unhandled positioning mode");
}
-
- if (drawFilter) {
- // A draw filter may change the paint arbitrarily, so we must re-seed in this case.
- runPaint = paint;
- }
}
}
diff --git a/src/core/SkDevice.h b/src/core/SkDevice.h
index 4959f1f..2173d91 100644
--- a/src/core/SkDevice.h
+++ b/src/core/SkDevice.h
@@ -15,7 +15,6 @@
#include "SkSurfaceProps.h"
class SkBitmap;
-class SkDrawFilter;
struct SkDrawShadowRec;
class SkGlyphRun;
class SkGlyphRunBuilder;
@@ -155,8 +154,7 @@
/** These are called inside the per-device-layer loop for each draw call.
When these are called, we have already applied any saveLayer operations,
- and are handling any looping from the paint, and any effects from the
- DrawFilter.
+ and are handling any looping from the paint.
*/
virtual void drawPaint(const SkPaint& paint) = 0;
virtual void drawPoints(SkCanvas::PointMode mode, size_t count,
@@ -230,8 +228,7 @@
virtual void drawShadow(const SkPath&, const SkDrawShadowRec&);
// default implementation unrolls the blob runs.
- virtual void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y,
- const SkPaint& paint, SkDrawFilter* drawFilter);
+ virtual void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint& paint);
// default implementation calls drawVertices
virtual void drawPatch(const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint);
diff --git a/src/core/SkLiteDL.cpp b/src/core/SkLiteDL.cpp
index 4240055..ea3ca6d 100644
--- a/src/core/SkLiteDL.cpp
+++ b/src/core/SkLiteDL.cpp
@@ -7,7 +7,6 @@
#include "SkCanvas.h"
#include "SkData.h"
-#include "SkDrawFilter.h"
#include "SkDrawShadowInfo.h"
#include "SkImage.h"
#include "SkImageFilter.h"
@@ -47,8 +46,8 @@
}
namespace {
-#define TYPES(M) \
- M(SetDrawFilter) M(Flush) M(Save) M(Restore) M(SaveLayer) \
+#define TYPES(M) \
+ M(Flush) M(Save) M(Restore) M(SaveLayer) \
M(Concat) M(SetMatrix) M(Translate) \
M(ClipPath) M(ClipRect) M(ClipRRect) M(ClipRegion) \
M(DrawPaint) M(DrawPath) M(DrawRect) M(DrawRegion) M(DrawOval) M(DrawArc) \
@@ -68,19 +67,6 @@
};
static_assert(sizeof(Op) == 4, "");
- struct SetDrawFilter final : Op {
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- static const auto kType = Type::SetDrawFilter;
- SetDrawFilter(SkDrawFilter* df) : drawFilter(sk_ref_sp(df)) {}
- sk_sp<SkDrawFilter> drawFilter;
-#endif
- void draw(SkCanvas* c, const SkMatrix&) const {
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- c->setDrawFilter(drawFilter.get());
-#endif
- }
- };
-
struct Flush final : Op {
static const auto kType = Type::Flush;
void draw(SkCanvas* c, const SkMatrix&) const { c->flush(); }
@@ -542,12 +528,6 @@
}
}
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-void SkLiteDL::setDrawFilter(SkDrawFilter* df) {
- this->push<SetDrawFilter>(0, df);
-}
-#endif
-
void SkLiteDL::flush() { this->push<Flush>(0); }
void SkLiteDL:: save() { this->push <Save>(0); }
diff --git a/src/core/SkLiteDL.h b/src/core/SkLiteDL.h
index b63ed0d..aa32e02 100644
--- a/src/core/SkLiteDL.h
+++ b/src/core/SkLiteDL.h
@@ -25,10 +25,6 @@
void reset();
bool empty() const { return fUsed == 0; }
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- void setDrawFilter(SkDrawFilter*);
-#endif
-
void flush();
void save();
diff --git a/src/core/SkLiteRecorder.cpp b/src/core/SkLiteRecorder.cpp
index 0891508..971e62c 100644
--- a/src/core/SkLiteRecorder.cpp
+++ b/src/core/SkLiteRecorder.cpp
@@ -22,13 +22,6 @@
return nullptr;
}
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-SkDrawFilter* SkLiteRecorder::setDrawFilter(SkDrawFilter* df) {
- fDL->setDrawFilter(df);
- return this->INHERITED::setDrawFilter(df);
-}
-#endif
-
void SkLiteRecorder::onFlush() { fDL->flush(); }
void SkLiteRecorder::willSave() { fDL->save(); }
diff --git a/src/core/SkLiteRecorder.h b/src/core/SkLiteRecorder.h
index af538ee..bc37546 100644
--- a/src/core/SkLiteRecorder.h
+++ b/src/core/SkLiteRecorder.h
@@ -20,10 +20,6 @@
sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
- SkDrawFilter* setDrawFilter(SkDrawFilter*) override;
-#endif
-
void willSave() override;
SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
void willRestore() override;
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index 774a1eb..d2c0cf8 100644
--- a/src/core/SkRemoteGlyphCache.cpp
+++ b/src/core/SkRemoteGlyphCache.cpp
@@ -240,12 +240,10 @@
}
protected:
- void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint,
- SkDrawFilter* drawFilter) override {
+ void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
+ const SkPaint& paint) override {
// The looper should be applied by the SkCanvas.
SkASSERT(paint.getDrawLooper() == nullptr);
- // We don't support SkDrawFilter.
- SkASSERT(drawFilter == nullptr);
SkPoint position{x, y};
SkPaint runPaint{paint};
diff --git a/src/effects/SkPaintFlagsDrawFilter.cpp b/src/effects/SkPaintFlagsDrawFilter.cpp
deleted file mode 100644
index 12b8fbb..0000000
--- a/src/effects/SkPaintFlagsDrawFilter.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkPaintFlagsDrawFilter.h"
-
-#include "SkPaint.h"
-#include "SkTo.h"
-
-SkPaintFlagsDrawFilter::SkPaintFlagsDrawFilter(uint32_t clearFlags,
- uint32_t setFlags) {
- fClearFlags = SkToU16(clearFlags & SkPaint::kAllFlags);
- fSetFlags = SkToU16(setFlags & SkPaint::kAllFlags);
-}
-
-bool SkPaintFlagsDrawFilter::filter(SkPaint* paint, Type) {
- paint->setFlags((paint->getFlags() & ~fClearFlags) | fSetFlags);
- return true;
-}
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 058d48e..1357fa2 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -241,8 +241,7 @@
void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& paint,
const SkMatrix& viewMatrix, const SkTextBlob* blob,
- SkScalar x, SkScalar y, SkDrawFilter* filter,
- const SkIRect& clipBounds) {
+ SkScalar x, SkScalar y, const SkIRect& clipBounds) {
ASSERT_SINGLE_OWNER
RETURN_IF_ABANDONED
SkDEBUGCODE(this->validate();)
@@ -250,7 +249,7 @@
GrTextContext* atlasTextContext = this->drawingManager()->getTextContext();
atlasTextContext->drawTextBlob(fContext, fTextTarget.get(), clip, paint, viewMatrix,
- fSurfaceProps, blob, x, y, filter, clipBounds);
+ fSurfaceProps, blob, x, y, clipBounds);
}
void GrRenderTargetContext::discard() {
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 376fe10..bdeb688 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -36,7 +36,6 @@
class GrStyle;
class GrTextureProxy;
struct GrUserStencilSettings;
-class SkDrawFilter;
struct SkDrawShadowRec;
struct SkIPoint;
struct SkIRect;
@@ -70,8 +69,7 @@
const SkIRect& clipBounds);
virtual void drawTextBlob(const GrClip&, const SkPaint&,
const SkMatrix& viewMatrix, const SkTextBlob*,
- SkScalar x, SkScalar y,
- SkDrawFilter*, const SkIRect& clipBounds);
+ SkScalar x, SkScalar y, const SkIRect& clipBounds);
/**
* Provides a perfomance hint that the render target's contents are allowed
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index c9cda0d..cc21397 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1638,12 +1638,12 @@
}
void SkGpuDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
- const SkPaint& paint, SkDrawFilter* drawFilter) {
+ const SkPaint& paint) {
ASSERT_SINGLE_OWNER
GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawTextBlob", fContext.get());
SkDEBUGCODE(this->validate();)
- fRenderTargetContext->drawTextBlob(this->clip(), paint, this->ctm(), blob, x, y, drawFilter,
+ fRenderTargetContext->drawTextBlob(this->clip(), paint, this->ctm(), blob, x, y,
this->devClipBounds());
}
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index c31e624..8d360c2 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -89,8 +89,7 @@
const SkPaint& paint) override;
void drawPosText(const void* text, size_t len, const SkScalar pos[],
int scalarsPerPos, const SkPoint& offset, const SkPaint&) override;
- void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y,
- const SkPaint& paint, SkDrawFilter* drawFilter) override;
+ void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint& paint) override;
void drawVertices(const SkVertices*, const SkMatrix bones[], int boneCount, SkBlendMode,
const SkPaint&) override;
void drawShadow(const SkPath&, const SkDrawShadowRec&) override;
diff --git a/src/gpu/text/GrTextBlob.cpp b/src/gpu/text/GrTextBlob.cpp
index 62f7d74..7b4507e 100644
--- a/src/gpu/text/GrTextBlob.cpp
+++ b/src/gpu/text/GrTextBlob.cpp
@@ -11,7 +11,6 @@
#include "GrContext.h"
#include "GrTextUtils.h"
#include "SkColorFilter.h"
-#include "SkDrawFilter.h"
#include "SkGlyphCache.h"
#include "SkMaskFilterBase.h"
#include "SkPaintPriv.h"
@@ -303,7 +302,7 @@
// GrTextBlob::makeOp only takes uint16_t values for run and subRun indices.
// Encountering something larger than this is highly unlikely, so we'll just not draw it.
int lastRun = SkTMin(fRunCount, (1 << 16)) - 1;
- GrTextUtils::RunPaint runPaint(&paint, nullptr);
+ GrTextUtils::RunPaint runPaint(&paint);
for (int runIndex = 0; runIndex <= lastRun; runIndex++) {
Run& run = fRuns[runIndex];
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 19128ab..686dac4 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -25,7 +25,6 @@
struct GrDistanceFieldAdjustTable;
struct GrGlyph;
-class SkDrawFilter;
class SkTextBlob;
class SkTextBlobRunIterator;
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 16f164c..28204eb 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -14,7 +14,6 @@
#include "GrTextBlobCache.h"
#include "SkDistanceFieldGen.h"
#include "SkDraw.h"
-#include "SkDrawFilter.h"
#include "SkDrawProcs.h"
#include "SkFindAndPlaceGlyph.h"
#include "SkGlyphRun.h"
@@ -102,7 +101,7 @@
const GrClip& clip, const SkPaint& skPaint,
const SkMatrix& viewMatrix, const SkSurfaceProps& props,
const SkTextBlob* blob, SkScalar x, SkScalar y,
- SkDrawFilter* drawFilter, const SkIRect& clipBounds) {
+ const SkIRect& clipBounds) {
// If we have been abandoned, then don't draw
if (context->abandoned()) {
return;
@@ -114,9 +113,7 @@
// It might be worth caching these things, but its not clear at this time
// TODO for animated mask filters, this will fill up our cache. We need a safeguard here
const SkMaskFilter* mf = skPaint.getMaskFilter();
- bool canCache = !(skPaint.getPathEffect() ||
- (mf && !as_MFB(mf)->asABlur(&blurRec)) ||
- drawFilter);
+ bool canCache = !(skPaint.getPathEffect() || (mf && !as_MFB(mf)->asABlur(&blurRec)));
SkScalerContextFlags scalerContextFlags = ComputeScalerContextFlags(target->colorSpaceInfo());
auto glyphCache = context->contextPriv().getGlyphCache();
@@ -154,7 +151,7 @@
cacheBlob = textBlobCache->makeCachedBlob(blob, key, blurRec, skPaint);
this->regenerateTextBlob(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), paint,
- scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
+ scalerContextFlags, viewMatrix, props, blob, x, y);
} else {
textBlobCache->makeMRU(cacheBlob.get());
@@ -166,7 +163,7 @@
sanityBlob->setupKey(key, blurRec, skPaint);
this->regenerateTextBlob(
sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
- paint, scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
+ paint, scalerContextFlags, viewMatrix, props, blob, x, y);
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
}
}
@@ -178,7 +175,7 @@
}
this->regenerateTextBlob(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), paint,
- scalerContextFlags, viewMatrix, props, blob, x, y, drawFilter);
+ scalerContextFlags, viewMatrix, props, blob, x, y);
}
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), paint,
@@ -192,13 +189,12 @@
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props, const SkTextBlob* blob,
- SkScalar x, SkScalar y,
- SkDrawFilter* drawFilter) const {
+ SkScalar x, SkScalar y) const {
cacheBlob->initReusableBlob(paint.luminanceColor(), viewMatrix, x, y);
// Regenerate textblob
SkTextBlobRunIterator it(blob);
- GrTextUtils::RunPaint runPaint(&paint, drawFilter);
+ GrTextUtils::RunPaint runPaint(&paint);
for (int run = 0; !it.done(); it.next(), run++) {
int glyphCount = it.glyphCount();
size_t textLen = glyphCount * sizeof(uint16_t);
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index dd82b3c..50ec0ab 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -50,7 +50,7 @@
const SkPoint& offset, const SkIRect& regionClipBounds);
void drawTextBlob(GrContext*, GrTextUtils::Target*, const GrClip&, const SkPaint&,
const SkMatrix& viewMatrix, const SkSurfaceProps&, const SkTextBlob*,
- SkScalar x, SkScalar y, SkDrawFilter*, const SkIRect& clipBounds);
+ SkScalar x, SkScalar y, const SkIRect& clipBounds);
std::unique_ptr<GrDrawOp> createOp_TestingOnly(GrContext*,
GrTextContext*,
@@ -122,8 +122,7 @@
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps&,
- const SkTextBlob* blob, SkScalar x, SkScalar y,
- SkDrawFilter* drawFilter) const;
+ const SkTextBlob* blob, SkScalar x, SkScalar y) const;
static bool HasLCD(const SkTextBlob*);
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index bd3647e..6f043e1 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -7,7 +7,6 @@
#include "GrTextUtils.h"
#include "GrContext.h"
-#include "SkDrawFilter.h"
#include "SkGlyphCache.h"
#include "SkGr.h"
#include "SkPaint.h"
@@ -27,21 +26,8 @@
if (!fModifiedPaint.isValid()) {
fModifiedPaint.init(fOriginalPaint->skPaint());
fPaint = fModifiedPaint.get();
- } else if (fFilter) {
- // We have to reset before applying the run because the filter could have arbitrary
- // changed the paint.
- *fModifiedPaint.get() = fOriginalPaint->skPaint();
}
paintModFunc(fModifiedPaint.get());
-
- if (fFilter) {
- if (!fFilter->filter(fModifiedPaint.get(), SkDrawFilter::kText_Type)) {
- // A false return from filter() means we should abort the current draw.
- return false;
- }
- // The draw filter could have changed either the paint color or color filter.
- this->initFilteredColor();
- }
return true;
}
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h
index 363a91e..05fbf6f 100644
--- a/src/gpu/text/GrTextUtils.h
+++ b/src/gpu/text/GrTextUtils.h
@@ -26,7 +26,6 @@
class GrPaint;
class GrShaderCaps;
class SkColorSpace;
-class SkDrawFilter;
class SkGlyph;
class SkMatrix;
struct SkIRect;
@@ -110,8 +109,7 @@
*/
class RunPaint : public Paint {
public:
- RunPaint(const Paint* paint, SkDrawFilter* filter)
- : fOriginalPaint(paint), fFilter(filter) {
+ RunPaint(const Paint* paint) : fOriginalPaint(paint) {
// Initially we represent the original paint.
fPaint = &fOriginalPaint->skPaint();
fDstColorSpaceInfo = fOriginalPaint->dstColorSpaceInfo();
@@ -123,7 +121,6 @@
private:
SkTLazy<SkPaint> fModifiedPaint;
const Paint* fOriginalPaint;
- SkDrawFilter* fFilter;
};
class PathTextIter : SkTextBaseIter {
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 6868aef..a933972 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -17,7 +17,6 @@
#include "SkColor.h"
#include "SkColorFilter.h"
#include "SkDraw.h"
-#include "SkDrawFilter.h"
#include "SkGlyphCache.h"
#include "SkImageFilterCache.h"
#include "SkJpegEncoder.h"
@@ -1459,13 +1458,10 @@
}
void SkPDFDevice::drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
- const SkPaint &paint, SkDrawFilter* drawFilter) {
+ const SkPaint &paint) {
for (SkTextBlobRunIterator it(blob); !it.done(); it.next()) {
SkPaint runPaint(paint);
it.applyFontToPaint(&runPaint);
- if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) {
- continue;
- }
SkPoint offset = it.offset() + SkPoint{x, y};
this->internalDrawText(it.glyphs(), sizeof(SkGlyphID) * it.glyphCount(),
it.pos(), it.positioning(), offset, runPaint,
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 4c9c9c8..6077aaf 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -68,8 +68,7 @@
/**
* These are called inside the per-device-layer loop for each draw call.
* When these are called, we have already applied any saveLayer
- * operations, and are handling any looping from the paint, and any
- * effects from the DrawFilter.
+ * operations, and are handling any looping from the paint.
*/
void drawPaint(const SkPaint& paint) override;
void drawPoints(SkCanvas::PointMode mode,
@@ -98,8 +97,7 @@
void drawPosText(const void* text, size_t len,
const SkScalar pos[], int scalarsPerPos,
const SkPoint& offset, const SkPaint&) override;
- void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y,
- const SkPaint &, SkDrawFilter*) override;
+ void drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint &) override;
void drawVertices(const SkVertices*, const SkMatrix* bones, int boneCount, SkBlendMode,
const SkPaint&) override;
void drawDevice(SkBaseDevice*, int x, int y,
diff --git a/src/utils/SkNWayCanvas.cpp b/src/utils/SkNWayCanvas.cpp
index 017ec05..7d1e981 100644
--- a/src/utils/SkNWayCanvas.cpp
+++ b/src/utils/SkNWayCanvas.cpp
@@ -366,13 +366,3 @@
iter->flush();
}
}
-
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-SkDrawFilter* SkNWayCanvas::setDrawFilter(SkDrawFilter* filter) {
- Iter iter(fList);
- while (iter.next()) {
- iter->setDrawFilter(filter);
- }
- return this->INHERITED::setDrawFilter(filter);
-}
-#endif
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index a1c9df4..5b3b3f3 100644
--- a/tests/CanvasStateTest.cpp
+++ b/tests/CanvasStateTest.cpp
@@ -12,7 +12,6 @@
#include "SkClipOpPriv.h"
#include "SkColor.h"
#include "SkCommandLineFlags.h"
-#include "SkDrawFilter.h"
#include "SkImageInfo.h"
#include "SkPaint.h"
#include "SkRRect.h"
@@ -274,36 +273,6 @@
////////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-
-class TestDrawFilter : public SkDrawFilter {
-public:
- bool filter(SkPaint*, Type) override { return true; }
-};
-
-DEF_TEST(CanvasState_test_draw_filters, reporter) {
- TestDrawFilter drawFilter;
- SkBitmap bitmap;
- bitmap.allocN32Pixels(10, 10);
- SkCanvas canvas(bitmap);
-
- canvas.setDrawFilter(&drawFilter);
-
- SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
- REPORTER_ASSERT(reporter, state);
- std::unique_ptr<SkCanvas> tmpCanvas = SkCanvasStateUtils::MakeFromCanvasState(state);
- REPORTER_ASSERT(reporter, tmpCanvas);
-
- REPORTER_ASSERT(reporter, canvas.getDrawFilter());
- REPORTER_ASSERT(reporter, nullptr == tmpCanvas->getDrawFilter());
-
- SkCanvasStateUtils::ReleaseCanvasState(state);
-}
-
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-
DEF_TEST(CanvasState_test_soft_clips, reporter) {
SkBitmap bitmap;
bitmap.allocN32Pixels(10, 10);
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
deleted file mode 100644
index ff8fae0..0000000
--- a/tests/DrawFilterTest.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkCanvas.h"
-#include "SkDrawFilter.h"
-#include "SkRefCnt.h"
-#include "SkSurface.h"
-#include "Test.h"
-class SkPaint;
-
-#ifdef SK_SUPPORT_LEGACY_DRAWFILTER
-
-namespace {
-class TestFilter : public SkDrawFilter {
-public:
- bool filter(SkPaint* p, Type) override {
- return true;
- }
-};
-}
-
-/**
- * canvas.setDrawFilter is defined to be local to the save/restore block, such that if you
- * do the following: save / modify-drawfilter / restore, the current drawfilter should be what
- * it was before the save.
- */
-static void test_saverestore(skiatest::Reporter* reporter) {
- auto surface(SkSurface::MakeRasterN32Premul(10, 10));
- SkCanvas* canvas = surface->getCanvas();
-
- sk_sp<TestFilter> df(new TestFilter);
-
- REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
-
- canvas->save();
- canvas->setDrawFilter(df.get());
- REPORTER_ASSERT(reporter, nullptr != canvas->getDrawFilter());
- canvas->restore();
-
- REPORTER_ASSERT(reporter, nullptr == canvas->getDrawFilter());
-}
-
-DEF_TEST(DrawFilter, reporter) {
- test_saverestore(reporter);
-}
-
-#endif