Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 13602013: Allow single-pass filters (which use asNewEffect()) to participate in the image filter DAG. This w… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix return value of SkImageFilter::asNewEffect(). Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 45176cf8c9ac605b924989a9bf0cb89257573ebc..c1364afe0261a631d121c7adcfbdb113c50f164b 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1404,26 +1404,6 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
fContext->drawRectToRect(*grPaint, dstRect, paintRect, &m);
}
-namespace {
-
-void apply_effect(GrContext* context,
- GrTexture* srcTexture,
- GrTexture* dstTexture,
- const GrRect& rect,
- GrEffectRef* effect) {
- SkASSERT(srcTexture && srcTexture->getContext() == context);
- GrContext::AutoMatrix am;
- am.setIdentity(context);
- GrContext::AutoRenderTarget art(context, dstTexture->asRenderTarget());
- GrContext::AutoClip acs(context, rect);
-
- GrPaint paint;
- paint.colorStage(0)->setEffect(effect);
- context->drawRect(paint, rect);
-}
-
-};
-
static SkBitmap wrap_texture(GrTexture* texture) {
SkBitmap result;
bool dummy;
@@ -1439,26 +1419,11 @@ static bool filter_texture(SkDevice* device, GrContext* context,
GrAssert(filter);
SkDeviceImageFilterProxy proxy(device);
- GrTextureDesc desc;
- desc.fFlags = kRenderTarget_GrTextureFlagBit,
- desc.fWidth = w;
- desc.fHeight = h;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
- GrEffectRef* effect;
-
if (filter->canFilterImageGPU()) {
// Save the render target and set it to NULL, so we don't accidentally draw to it in the
// filter. Also set the clip wide open and the matrix to identity.
GrContext::AutoWideOpenIdentityDraw awo(context, NULL);
return filter->filterImageGPU(&proxy, wrap_texture(texture), result);
- } else if (filter->asNewEffect(&effect, texture)) {
- GrAutoScratchTexture dst(context, desc);
- SkRect r = SkRect::MakeWH(SkIntToScalar(w), SkIntToScalar(h));
- apply_effect(context, texture, dst.texture(), r, effect);
- SkAutoTUnref<GrTexture> resultTex(dst.detach());
- effect->unref();
- *result = wrap_texture(resultTex.get());
- return true;
} else {
return false;
}
@@ -1594,11 +1559,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkDevice* device,
}
bool SkGpuDevice::canHandleImageFilter(SkImageFilter* filter) {
- if (!filter->asNewEffect(NULL, NULL) &&
- !filter->canFilterImageGPU()) {
- return false;
- }
- return true;
+ return filter->canFilterImageGPU();
}
bool SkGpuDevice::filterImage(SkImageFilter* filter, const SkBitmap& src,
« src/core/SkImageFilter.cpp ('K') | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698