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/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index f8c43b0..7672f5a 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -394,12 +394,6 @@
GrRenderTarget* rt = origDrawState->getRenderTarget();
GrAssert(NULL != rt);
- if (fAACache.canReuse(clipIn, rt->width(), rt->height())) {
- *result = fAACache.getLastMask();
- fAACache.getLastBound(resultBounds);
- return true;
- }
-
GrRect rtRect;
rtRect.setLTRB(0, 0,
GrIntToScalar(rt->width()), GrIntToScalar(rt->height()));
@@ -432,6 +426,14 @@
GrAssert(SkScalarIsInt(bounds.width()));
GrAssert(SkScalarIsInt(bounds.height()));
+ if (fAACache.canReuse(clipIn,
+ SkScalarCeilToInt(bounds.width()),
+ SkScalarCeilToInt(bounds.height()))) {
+ *result = fAACache.getLastMask();
+ fAACache.getLastBound(resultBounds);
+ return true;
+ }
+
const GrTextureDesc desc = {
kRenderTarget_GrTextureFlagBit|kNoStencil_GrTextureFlagBit,
SkScalarCeilToInt(bounds.width()),
@@ -548,7 +550,7 @@
}
}
- fAACache.set(clipIn, rt->width(), rt->height(), accum, bounds);
+ fAACache.set(clipIn, accum, bounds);
*result = accum;
*resultBounds = bounds;
SkSafeUnref(accum); // fAACache still has a ref to accum