use (temp) gpu-imagefilter-cache for applyFilter
BUG=skia: Review URL: https://codereview.chromium.org/1414653003
This commit is contained in:
parent
3dc6ae55ca
commit
13ccbf8a68
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user