aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-15 08:07:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 08:07:27 -0700
commit938115c9f8a3453ad6f511c0a23dabb46ec5a71f (patch)
treee8ad18d97be355d469708e7159fe0ec02bea4d31
parent534c270465a9824893d5c9d6c5bacef7726cc389 (diff)
Remove asFragmentProcessor gpu-specific ImageFilter code path
No image filter should be using this code path now. TBR=reed@google.com GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1892493002 Review URL: https://codereview.chromium.org/1892493002
-rw-r--r--include/core/SkImageFilter.h27
-rw-r--r--src/core/SkImageFilter.cpp64
2 files changed, 6 insertions, 85 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index d90e74de77..f8f62f1d84 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -182,7 +182,7 @@ public:
* The default implementation returns asFragmentProcessor(NULL, NULL, SkMatrix::I(),
* SkIRect()).
*/
- virtual bool canFilterImageGPU() const;
+ virtual bool canFilterImageGPU() const { return false; }
/**
* Process this image filter on the GPU. This is most often used for
@@ -194,8 +194,11 @@ public:
* relative to the src when it is drawn. The default implementation does
* single-pass processing using asFragmentProcessor().
*/
- virtual bool filterImageGPUDeprecated(Proxy*, const SkBitmap& src, const Context&,
- SkBitmap* result, SkIPoint* offset) const;
+ virtual bool filterImageGPUDeprecated(Proxy*, const SkBitmap&, const Context&,
+ SkBitmap*, SkIPoint*) const {
+ SkASSERT(false);
+ return false;
+ }
#if SK_SUPPORT_GPU
static sk_sp<SkSpecialImage> DrawWithFP(GrContext* context,
@@ -452,24 +455,6 @@ protected:
SkIRect* bounds) const;
/**
- * Returns true if the filter can be expressed a single-pass
- * GrProcessor, used to process this filter on the GPU, or false if
- * not.
- *
- * If effect is non-NULL, a new GrProcessor instance is stored
- * in it. The caller assumes ownership of the stage, and it is up to the
- * caller to unref it.
- *
- * The effect can assume its vertexCoords space maps 1-to-1 with texels
- * in the texture. "matrix" is a transformation to apply to filter
- * parameters before they are used in the effect. Note that this function
- * will be called with (NULL, NULL, SkMatrix::I()) to query for support,
- * so returning "true" indicates support for all possible matrices.
- */
- virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
- const SkIRect& bounds) const;
-
- /**
* Creates a modified Context for use when recursing up the image filter DAG.
* The clip bounds are adjusted to accommodate any margins that this
* filter requires by calling this node's
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index af2b278e3d..43ea6ab6af 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -393,65 +393,6 @@ sk_sp<SkSpecialImage> SkImageFilter::onFilterImage(SkSpecialImage* src, const Co
return SkSpecialImage::internal_fromBM(src->internal_getProxy(), resultBM, &src->props());
}
-bool SkImageFilter::canFilterImageGPU() const {
- return this->asFragmentProcessor(nullptr, nullptr, SkMatrix::I(), SkIRect());
-}
-
-bool SkImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src, const Context& ctx,
- SkBitmap* result, SkIPoint* offset) const {
-#if SK_SUPPORT_GPU
- SkBitmap input = src;
- SkASSERT(fInputCount == 1);
- SkIPoint srcOffset = SkIPoint::Make(0, 0);
- if (!this->filterInputGPUDeprecated(0, proxy, src, ctx, &input, &srcOffset)) {
- return false;
- }
- GrTexture* srcTexture = input.getTexture();
- SkIRect bounds;
- if (!this->applyCropRectDeprecated(ctx, proxy, input, &srcOffset, &bounds, &input)) {
- return false;
- }
- GrContext* context = srcTexture->getContext();
-
- GrSurfaceDesc desc;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = bounds.width();
- desc.fHeight = bounds.height();
- desc.fConfig = kRGBA_8888_GrPixelConfig;
-
- SkAutoTUnref<GrTexture> dst(context->textureProvider()->createApproxTexture(desc));
- if (!dst) {
- return false;
- }
-
- GrFragmentProcessor* fp;
- offset->fX = bounds.left();
- offset->fY = bounds.top();
- bounds.offset(-srcOffset);
- SkMatrix matrix(ctx.ctm());
- matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
- GrPaint paint;
- // SRGBTODO: Don't handle sRGB here, in anticipation of this code path being deleted.
- if (this->asFragmentProcessor(&fp, srcTexture, matrix, bounds)) {
- SkASSERT(fp);
- paint.addColorFragmentProcessor(fp)->unref();
- paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
-
- SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget()));
- if (drawContext) {
- SkRect srcRect = SkRect::Make(bounds);
- SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
- GrClip clip(dstRect);
- drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
-
- GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result);
- return true;
- }
- }
-#endif
- return false;
-}
-
#if SK_SUPPORT_GPU
sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
sk_sp<GrFragmentProcessor> fp,
@@ -620,11 +561,6 @@ SkImageFilter::Context SkImageFilter::mapContext(const Context& ctx) const {
return Context(ctx.ctm(), clipBounds, ctx.cache());
}
-bool SkImageFilter::asFragmentProcessor(GrFragmentProcessor**, GrTexture*,
- const SkMatrix&, const SkIRect&) const {
- return false;
-}
-
sk_sp<SkImageFilter> SkImageFilter::MakeMatrixFilter(const SkMatrix& matrix,
SkFilterQuality filterQuality,
sk_sp<SkImageFilter> input) {