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

Unified Diff: tests/ClipCacheTest.cpp

Issue 48593003: Avoid re-rendering stencil clip for every draw with reducable clip stack (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: gcc-4.2 mac os 10.6 fix Created 7 years, 1 month 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/gpu/SkGpuDevice.cpp ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ClipCacheTest.cpp
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index fab1f58dd70609887a12fa47fcc98db62e95ff00..070f8eb46900ec0c780ee33a5a8db869de455896 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -106,7 +106,6 @@ static void check_state(skiatest::Reporter* reporter,
const SkClipStack& clip,
GrTexture* mask,
const SkIRect& bound) {
- SkClipStack cacheClip;
REPORTER_ASSERT(reporter, clip.getTopmostGenID() == cache.getLastClipGenID());
REPORTER_ASSERT(reporter, mask == cache.getLastMask());
@@ -116,6 +115,19 @@ static void check_state(skiatest::Reporter* reporter,
REPORTER_ASSERT(reporter, bound == cacheBound);
}
+static void check_empty_state(skiatest::Reporter* reporter,
+ const GrClipMaskCache& cache) {
+ REPORTER_ASSERT(reporter, SkClipStack::kInvalidGenID == cache.getLastClipGenID());
+ REPORTER_ASSERT(reporter, NULL == cache.getLastMask());
+
+ SkIRect emptyBound;
+ emptyBound.setEmpty();
+
+ SkIRect cacheBound;
+ cache.getLastBound(&cacheBound);
+ REPORTER_ASSERT(reporter, emptyBound == cacheBound);
+}
+
////////////////////////////////////////////////////////////////////////////////
// basic test of the cache's base functionality:
// push, pop, set, canReuse & getters
@@ -128,14 +140,8 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
cache.setContext(context);
- SkClipStack emptyClip;
- emptyClip.reset();
-
- SkIRect emptyBound;
- emptyBound.setEmpty();
-
// check initial state
- check_state(reporter, cache, emptyClip, NULL, emptyBound);
+ check_empty_state(reporter, cache);
// set the current state
SkIRect bound1;
@@ -165,7 +171,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
cache.push();
// verify that the pushed state is initially empty
- check_state(reporter, cache, emptyClip, NULL, emptyBound);
+ check_empty_state(reporter, cache);
REPORTER_ASSERT(reporter, texture1->getRefCnt());
// modify the new state
@@ -202,7 +208,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
cache.reset();
// verify it is now empty
- check_state(reporter, cache, emptyClip, NULL, emptyBound);
+ check_empty_state(reporter, cache);
// pop again - so there is no state
cache.pop();
@@ -210,7 +216,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
#if !defined(SK_DEBUG)
// verify that the getters don't crash
// only do in release since it generates asserts in debug
- check_state(reporter, cache, emptyClip, NULL, emptyBound);
+ check_empty_state(reporter, cache);
#endif
}
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698