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.h b/src/gpu/GrClipMaskManager.h
index 6520567..9c72552 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -68,8 +68,9 @@
GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
- if (back->fLastWidth >= width &&
- back->fLastHeight >= height &&
+ if (back->fLastMask &&
+ back->fLastMask->width() >= width &&
+ back->fLastMask->height() >= height &&
clip == back->fLastClip) {
return true;
}
@@ -77,8 +78,7 @@
return false;
}
- void set(const GrClip& clip, int width, int height,
- GrTexture* mask, const GrRect& bound) {
+ void set(const GrClip& clip, GrTexture* mask, const GrRect& bound) {
if (fStack.empty()) {
GrAssert(false);
@@ -87,8 +87,6 @@
GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
- back->fLastWidth = width;
- back->fLastHeight = height;
back->fLastClip = clip;
SkSafeRef(mask);
back->fLastMask.reset(mask);
@@ -127,30 +125,6 @@
}
}
- int getLastWidth() const {
-
- if (fStack.empty()) {
- GrAssert(false);
- return -1;
- }
-
- GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
-
- return back->fLastWidth;
- }
-
- int getLastHeight() const {
-
- if (fStack.empty()) {
- GrAssert(false);
- return -1;
- }
-
- GrClipStackFrame* back = (GrClipStackFrame*) fStack.back();
-
- return back->fLastHeight;
- }
-
void getLastClip(GrClip* clip) const {
if (fStack.empty()) {
@@ -254,19 +228,11 @@
}
void reset () {
- fLastWidth = -1;
- fLastHeight = -1;
fLastClip.setEmpty();
fLastMask.reset(NULL);
fLastBound.setEmpty();
}
- // fLastWidth & fLastHeight store the render target size used when
- // creating the mask. They factor into the reuse decision (in canReuse)
- // TODO: We should probably use the mask's width & height rather than
- // the render target's width & height for reuse decisions
- int fLastWidth;
- int fLastHeight;
GrClip fLastClip;
// The mask's width & height values are used in setupDrawStateAAClip to
// correctly scale the uvs for geometry drawn with this mask