aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-06-27 14:46:46 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-12 02:36:44 +0000
commit2c312c4f58f9c151acab8ca2dd0d39fb77c5e74a (patch)
tree527d8ef60903f99e54cc83615a051c8b65e046bb /src/gpu
parent0859252397e0a771669d21d173a8a20f814b7ca0 (diff)
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>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrRenderTargetContext.cpp5
-rw-r--r--src/gpu/GrRenderTargetContext.h4
-rw-r--r--src/gpu/SkGpuDevice.cpp4
-rw-r--r--src/gpu/SkGpuDevice.h3
-rw-r--r--src/gpu/text/GrTextBlob.cpp3
-rw-r--r--src/gpu/text/GrTextBlob.h1
-rw-r--r--src/gpu/text/GrTextContext.cpp18
-rw-r--r--src/gpu/text/GrTextContext.h5
-rw-r--r--src/gpu/text/GrTextUtils.cpp14
-rw-r--r--src/gpu/text/GrTextUtils.h5
10 files changed, 17 insertions, 45 deletions
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 058d48e49e..1357fa23c1 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -241,8 +241,7 @@ void GrRenderTargetContext::drawPosText(const GrClip& clip, const SkPaint& paint
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 @@ void GrRenderTargetContext::drawTextBlob(const GrClip& clip, const SkPaint& pain
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 376fe10735..bdeb688896 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -36,7 +36,6 @@ class GrShape;
class GrStyle;
class GrTextureProxy;
struct GrUserStencilSettings;
-class SkDrawFilter;
struct SkDrawShadowRec;
struct SkIPoint;
struct SkIRect;
@@ -70,8 +69,7 @@ public:
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 c9cda0de7d..cc21397e12 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1638,12 +1638,12 @@ void SkGpuDevice::drawPosText(const void* text, size_t byteLength,
}
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 c31e6245b3..8d360c2813 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -89,8 +89,7 @@ public:
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 62f7d74f57..7b4507eab0 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 @@ void GrTextBlob::flush(GrTextUtils::Target* target, const SkSurfaceProps& props,
// 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 19128ab98e..686dac4eb1 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -25,7 +25,6 @@ class GrAtlasManager;
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 16f164c9c8..28204eb7af 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 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
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 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
// 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 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
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 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
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 @@ void GrTextContext::drawTextBlob(GrContext* context, GrTextUtils::Target* target
}
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 @@ void GrTextContext::regenerateTextBlob(GrTextBlob* cacheBlob,
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 dd82b3ce7d..50ec0ab59e 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -50,7 +50,7 @@ public:
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 @@ private:
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 bd3647e7ad..6f043e108f 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 @@ bool GrTextUtils::RunPaint::modifyForRun(std::function<void(SkPaint*)> paintModF
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 363a91e065..05fbf6f35e 100644
--- a/src/gpu/text/GrTextUtils.h
+++ b/src/gpu/text/GrTextUtils.h
@@ -26,7 +26,6 @@ class GrGlyphCache;
class GrPaint;
class GrShaderCaps;
class SkColorSpace;
-class SkDrawFilter;
class SkGlyph;
class SkMatrix;
struct SkIRect;
@@ -110,8 +109,7 @@ public:
*/
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 @@ public:
private:
SkTLazy<SkPaint> fModifiedPaint;
const Paint* fOriginalPaint;
- SkDrawFilter* fFilter;
};
class PathTextIter : SkTextBaseIter {