use (temp) gpu-imagefilter-cache for applyFilter

BUG=skia:

Review URL: https://codereview.chromium.org/1414653003
This commit is contained in:
reed 2015-10-20 09:56:52 -07:00 committed by Commit bot
parent 3dc6ae55ca
commit 13ccbf8a68
3 changed files with 11 additions and 4 deletions

View File

@ -2015,10 +2015,14 @@ bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture
#endif
}
SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
// We always return a transient cache, so it is freed after each
// filter traversal.
SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() {
return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
}
SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
// We always return a transient cache, so it is freed after each
// filter traversal.
return SkGpuDevice::NewImageFilterCache();
}
#endif

View File

@ -135,6 +135,8 @@ public:
const SkImageFilter::Context&,
SkBitmap* result, SkIPoint* offset);
static SkImageFilter::Cache* NewImageFilterCache();
protected:
bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override;
bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) override;

View File

@ -235,7 +235,8 @@ SkImage* SkImage_Gpu::onApplyFilter(SkImageFilter* filter, SkIPoint* offsetResul
const SkIRect clipBounds = srcBounds;
SkGpuImageFilterProxy proxy(fTexture->getContext());
SkImageFilter::Context ctx(SkMatrix::I(), clipBounds, SkImageFilter::Cache::Get());
SkAutoTUnref<SkImageFilter::Cache> cache(SkGpuDevice::NewImageFilterCache());
SkImageFilter::Context ctx(SkMatrix::I(), clipBounds, cache);
SkBitmap dst;
if (!filter->filterImage(&proxy, src, ctx, &dst, offsetResult)) {