From 5d17286b3596c369132f10422a35a2cfca5c009a Mon Sep 17 00:00:00 2001 From: robertphillips Date: Tue, 13 Jan 2015 10:54:37 -0800 Subject: [PATCH] Revert of Switch to a more complete method of filtering hoisted layers (patchset #1 id:1 of https://codereview.chromium.org/842323003/) Reason for revert: nanobench woes Original issue's description: > Switch to a more complete method of filtering hoisted layers > > Committed: https://skia.googlesource.com/skia/+/74668a8e818fd891a08c4966cc5973b04c1ad992 TBR=bsalomon@google.com NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/851773002 --- src/gpu/GrLayerCache.h | 2 +- src/gpu/GrLayerHoister.cpp | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/gpu/GrLayerCache.h b/src/gpu/GrLayerCache.h index 11c8f07..cdbd080 100644 --- a/src/gpu/GrLayerCache.h +++ b/src/gpu/GrLayerCache.h @@ -164,7 +164,7 @@ public: SkASSERT(SK_InvalidGenID != pictureID); if (fPaint) { - if (fPaint->getImageFilter()) { + if (fPaint->getImageFilter() && fPaint->getImageFilter()->canFilterImageGPU()) { fFilter = SkSafeRef(fPaint->getImageFilter()); fPaint->setImageFilter(NULL); } diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp index 3bb7b2e..7d6f5ab 100644 --- a/src/gpu/GrLayerHoister.cpp +++ b/src/gpu/GrLayerHoister.cpp @@ -10,8 +10,6 @@ #include "GrRecordReplaceDraw.h" #include "SkCanvas.h" -#include "SkDeviceImageFilterProxy.h" -#include "SkDeviceProperties.h" #include "SkGpuDevice.h" #include "SkGrPixelRef.h" #include "SkLayerInfo.h" @@ -276,19 +274,13 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context, } } -SkBitmap wrap_texture(GrTexture* texture) { - SkBitmap result; - result.setInfo(texture->surfacePriv().info()); - result.setPixelRef(SkNEW_ARGS(SkGrPixelRef, (result.info(), texture)))->unref(); - return result; -} - void GrLayerHoister::FilterLayer(GrContext* context, SkGpuDevice* device, const GrHoistedLayer& info) { GrCachedLayer* layer = info.fLayer; SkASSERT(layer->filter()); + SkASSERT(layer->filter()->canFilterImageGPU()); static const int kDefaultCacheSize = 32 * 1024 * 1024; @@ -302,6 +294,7 @@ void GrLayerHoister::FilterLayer(GrContext* context, totMat.preConcat(info.fLocalMat); totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterOffset.fY)); + SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop); SkIRect clipBounds = layer->rect(); @@ -310,11 +303,9 @@ void GrLayerHoister::FilterLayer(GrContext* context, SkAutoTUnref cache(SkImageFilter::Cache::Create(kDefaultCacheSize)); SkImageFilter::Context filterContext(totMat, clipBounds, cache); - SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(0, kUnknown_SkPixelGeometry)); - const SkBitmap src = wrap_texture(layer->texture()); - - if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitmap, &offset)) { - // Filtering failed. Press on with the unfiltered version. + if (!device->filterTexture(context, layer->texture(), layer->filter(), + filterContext, &filteredBitmap, &offset)) { + // Filtering failed. Press on with the unfiltered version return; } -- 2.7.4