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

Unified Diff: tests/ClipCacheTest.cpp

Issue 54543008: Revert "Avoid re-rendering stencil clip for every draw with reducable clip stack" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 070f8eb46900ec0c780ee33a5a8db869de455896..fab1f58dd70609887a12fa47fcc98db62e95ff00 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -106,6 +106,7 @@ 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());
@@ -115,19 +116,6 @@ 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
@@ -140,8 +128,14 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
cache.setContext(context);
+ SkClipStack emptyClip;
+ emptyClip.reset();
+
+ SkIRect emptyBound;
+ emptyBound.setEmpty();
+
// check initial state
- check_empty_state(reporter, cache);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
// set the current state
SkIRect bound1;
@@ -171,7 +165,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
cache.push();
// verify that the pushed state is initially empty
- check_empty_state(reporter, cache);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
REPORTER_ASSERT(reporter, texture1->getRefCnt());
// modify the new state
@@ -208,7 +202,7 @@ static void test_cache(skiatest::Reporter* reporter, GrContext* context) {
cache.reset();
// verify it is now empty
- check_empty_state(reporter, cache);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
// pop again - so there is no state
cache.pop();
@@ -216,7 +210,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_empty_state(reporter, cache);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
#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