Made clip mask cache reuse depend on mask size/bounds (instead of render target size)
http://codereview.appspot.com/6190067/
git-svn-id: http://skia.googlecode.com/svn/trunk@3903 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index 999dc54..a8b220d 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -40,14 +40,9 @@
// verify that the top state of the stack matches the passed in state
static void check_state(skiatest::Reporter* reporter,
const GrClipMaskCache& cache,
- int width,
- int height,
const GrClip& clip,
GrTexture* mask,
const GrRect& bound) {
- REPORTER_ASSERT(reporter, width == cache.getLastWidth());
- REPORTER_ASSERT(reporter, height == cache.getLastHeight());
-
GrClip cacheClip;
cache.getLastClip(&cacheClip);
REPORTER_ASSERT(reporter, clip == cacheClip);
@@ -73,7 +68,7 @@
emptyBound.setEmpty();
// check initial state
- check_state(reporter, cache, -1, -1, emptyClip, NULL, emptyBound);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
// set the current state
GrRect bound1;
@@ -89,17 +84,17 @@
return;
}
- cache.set(clip1, 128, 128, texture.get(), bound1);
+ cache.set(clip1, texture.get(), bound1);
// check that the set took
- check_state(reporter, cache, 128, 128, clip1, texture.get(), bound1);
+ check_state(reporter, cache, clip1, texture.get(), bound1);
REPORTER_ASSERT(reporter, 2 == texture.get()->getRefCnt());
// push the state
cache.push();
// verify that the pushed state is initially empty
- check_state(reporter, cache, -1, -1, emptyClip, NULL, emptyBound);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
REPORTER_ASSERT(reporter, 2 == texture.get()->getRefCnt());
// modify the new state
@@ -110,10 +105,10 @@
clip2.setEmpty();
clip2.setFromRect(bound2);
- cache.set(clip2, 10, 10, texture.get(), bound2);
+ cache.set(clip2, texture.get(), bound2);
// check that the changes took
- check_state(reporter, cache, 10, 10, clip2, texture.get(), bound2);
+ check_state(reporter, cache, clip2, texture.get(), bound2);
REPORTER_ASSERT(reporter, 3 == texture.get()->getRefCnt());
// check to make sure canReuse works
@@ -124,14 +119,14 @@
cache.pop();
// verify that the old state is restored
- check_state(reporter, cache, 128, 128, clip1, texture.get(), bound1);
+ check_state(reporter, cache, clip1, texture.get(), bound1);
REPORTER_ASSERT(reporter, 2 == texture.get()->getRefCnt());
// manually clear the state
cache.reset();
// verify it is now empty
- check_state(reporter, cache, -1, -1, emptyClip, NULL, emptyBound);
+ check_state(reporter, cache, emptyClip, NULL, emptyBound);
REPORTER_ASSERT(reporter, 1 == texture.get()->getRefCnt());
// pop again - so there is no state