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

Unified Diff: src/gpu/GrLayerHoister.cpp

Issue 1762013002: Swap over to using SkImageFilter::filterImage instead of filterImageDeprecated (Closed) Base URL: https://skia.googlesource.com/skia.git@if-fragment
Patch Set: Fix no-GPU build Created 4 years, 9 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
« no previous file with comments | « src/core/SkSpecialImage.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerHoister.cpp
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index c39aa2007f9294bd31365906e1b454c32b9fdc62..a446be8084ed3fa814cccef03b7db41dfd0690ab 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -14,6 +14,7 @@
#include "SkGpuDevice.h"
#include "SkLayerInfo.h"
#include "SkRecordDraw.h"
+#include "SkSpecialImage.h"
#include "SkSurface.h"
#include "SkSurface_Gpu.h"
@@ -285,18 +286,14 @@ void GrLayerHoister::FilterLayer(GrContext* context,
static const int kDefaultCacheSize = 32 * 1024 * 1024;
- SkBitmap filteredBitmap;
- SkIPoint offset = SkIPoint::Make(0, 0);
-
const SkIPoint filterOffset = SkIPoint::Make(layer->srcIR().fLeft, layer->srcIR().fTop);
- SkMatrix totMat = SkMatrix::I();
- totMat.preConcat(info.fPreMat);
+ SkMatrix totMat(info.fPreMat);
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();
+ const SkIRect& clipBounds = layer->rect();
// This cache is transient, and is freed (along with all its contained
// textures) when it goes out of scope.
@@ -304,18 +301,24 @@ void GrLayerHoister::FilterLayer(GrContext* context,
SkImageFilter::Context filterContext(totMat, clipBounds, cache);
SkImageFilter::DeviceProxy proxy(device);
- SkBitmap src;
- GrWrapTextureInBitmap(layer->texture(), layer->texture()->width(), layer->texture()->height(),
- false, &src);
- if (!layer->filter()->filterImageDeprecated(&proxy, src, filterContext,
- &filteredBitmap, &offset)) {
+ // TODO: should the layer hoister store stand alone layers as SkSpecialImages internally?
+ const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->texture()->height());
+ SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(&proxy, subset,
+ kNeedNewImageUniqueID_SpecialImage,
+ layer->texture()));
+
+ SkIPoint offset = SkIPoint::Make(0, 0);
+ SkAutoTUnref<SkSpecialImage> result(layer->filter()->filterImage(img,
+ filterContext,
+ &offset));
+ if (!result) {
// Filtering failed. Press on with the unfiltered version.
return;
}
- SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.height());
- layer->setTexture(filteredBitmap.getTexture(), newRect, false);
+ SkASSERT(result->peekTexture());
+ layer->setTexture(result->peekTexture(), result->subset(), false);
layer->setOffset(offset);
}
« no previous file with comments | « src/core/SkSpecialImage.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698