Added requires_AA method to GrClipMaskManager.cpp to replace GrClip capability

http://codereview.appspot.com/6422062/



git-svn-id: http://skia.googlecode.com/svn/trunk@4738 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index ceba429..4deebf4 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -69,6 +69,27 @@
     }
 }
 
+/**
+ * Does any individual clip in 'clipIn' use anti-aliasing?
+ */
+bool requires_AA(const GrClip& clipIn) {
+
+    GrClip::Iter iter;
+    iter.reset(clipIn, GrClip::Iter::kBottom_IterStart);
+
+    const GrClip::Iter::Clip* clip = NULL;
+    for (clip = iter.skipToTopmost(SkRegion::kReplace_Op);
+         NULL != clip;
+         clip = iter.next()) {
+
+        if (clip->fDoAA) {
+            return true;
+        }
+    }
+
+    return false;
+}
+
 }
 
 /*
@@ -78,11 +99,6 @@
  */
 bool GrClipMaskManager::useSWOnlyPath(const GrClip& clipIn) {
 
-    if (!clipIn.requiresAA()) {
-        // The stencil buffer can handle this case
-        return false;
-    }
-
     // TODO: generalize this function so that when
     // a clip gets complex enough it can just be done in SW regardless
     // of whether it would invoke the GrSoftwarePathRenderer.
@@ -144,12 +160,15 @@
         return false;
     }
 
+    bool requiresAA = requires_AA(clipIn);
+    GrAssert(requiresAA == clipIn.requiresAA());
+
 #if GR_SW_CLIP
     // If MSAA is enabled we can do everything in the stencil buffer.
     // Otherwise check if we should just create the entire clip mask 
     // in software (this will only happen if the clip mask is anti-aliased
     // and too complex for the gpu to handle in its entirety)
-    if (0 == rt->numSamples() && this->useSWOnlyPath(clipIn)) {
+    if (0 == rt->numSamples() && requiresAA && this->useSWOnlyPath(clipIn)) {
         // The clip geometry is complex enough that it will be more
         // efficient to create it entirely in software
         GrTexture* result = NULL;
@@ -169,7 +188,7 @@
 #if GR_AA_CLIP
     // If MSAA is enabled use the (faster) stencil path for AA clipping
     // otherwise the alpha clip mask is our only option
-    if (0 == rt->numSamples() && clipIn.requiresAA()) {
+    if (0 == rt->numSamples() && requiresAA) {
         // Since we are going to create a destination texture of the correct
         // size for the mask (rather than being bound by the size of the
         // render target) we aren't going to use scissoring like the stencil