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 |
} |