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/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 {