aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar senorblanco <senorblanco@chromium.org>2014-07-30 11:26:46 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-30 11:26:46 -0700
commit55b6d8be997a447ef9ce0f029697677a940bfc24 (patch)
treea33ca4d5ed0622f293b81c850b9f42ee02da7cab /tests
parent78697816b0a345c614071070eaa895d71f598e22 (diff)
Implement a persistent uniqueID-based cache for SkImageFilter.
Add a unique ID to SkImageFilter, and use it as part of a persistent cache of image-filtered results. This is used for caching frame-to-frame coherent filters. We also keep track of which filter subtrees do not reference the src input, and use a GenID of zero for the src input in that case. That way, subtrees which are not dependent on the filter input can be cached independently of it. This gives approximately a 4X speedup on letmespellitoutforyou.com/samples/svg/filter_terrain.svg on Z620 and Nexus10. The cache key consists of the uniqueID of the filter, the clip bounds, the CTM and the genID of the input bitmap. Since this does not yet handle the case where the input primitives (and part of the resulting filter tree) are unchanged, we have to keep around the external cache for that painting case. When the work to cache unchanging input primitives is done, the old cache can be removed, and the new UniqueIDCache will be renamed to Cache. R=bsalomon@google.com, mtklein@google.com Author: senorblanco@chromium.org Review URL: https://codereview.chromium.org/414483003
Diffstat (limited to 'tests')
-rw-r--r--tests/ImageFilterTest.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 7da4a911ef..0766c15edf 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -262,8 +262,7 @@ static void test_crop_rects(SkBaseDevice* device, skiatest::Reporter* reporter)
SkIPoint offset;
SkString str;
str.printf("filter %d", static_cast<int>(i));
- SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(2));
- SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), cache.get());
+ SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL);
REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ctx,
&result, &offset), str.c_str());
REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, str.c_str());