Index: src/gpu/GrLayerHoister.cpp |
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp |
index 7d6f5ab1b3879b4f1648d459ec6bc3111405622c..3bb7b2e2fd2364b4759ddf84dee9935bc7380a94 100644 |
--- a/src/gpu/GrLayerHoister.cpp |
+++ b/src/gpu/GrLayerHoister.cpp |
@@ -10,6 +10,8 @@ |
#include "GrRecordReplaceDraw.h" |
#include "SkCanvas.h" |
+#include "SkDeviceImageFilterProxy.h" |
+#include "SkDeviceProperties.h" |
#include "SkGpuDevice.h" |
#include "SkGrPixelRef.h" |
#include "SkLayerInfo.h" |
@@ -274,13 +276,19 @@ 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; |
@@ -294,7 +302,6 @@ 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(); |
@@ -303,9 +310,11 @@ void GrLayerHoister::FilterLayer(GrContext* context, |
SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefaultCacheSize)); |
SkImageFilter::Context filterContext(totMat, clipBounds, cache); |
- if (!device->filterTexture(context, layer->texture(), layer->filter(), |
bsalomon
2015/01/13 18:08:40
Is this still used anywhere? Otherwise, lgtm.
robertphillips
2015/01/13 18:28:24
SkImageFilter::filterImage actually loops back aro
|
- filterContext, &filteredBitmap, &offset)) { |
- // Filtering failed. Press on with the unfiltered version |
+ 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. |
return; |
} |