Share code with SkRect

http://codereview.appspot.com/4523046/



git-svn-id: http://skia.googlecode.com/svn/trunk@1277 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrClip.cpp b/gpu/src/GrClip.cpp
index 425ad27..2d1680c 100644
--- a/gpu/src/GrClip.cpp
+++ b/gpu/src/GrClip.cpp
@@ -87,6 +87,12 @@
     }
 }
 
+static void intersectWith(SkRect* dst, const SkRect& src) {
+    if (!dst->intersect(src)) {
+        dst->setEmpty();
+    }
+}
+
 void GrClip::setFromIterator(GrClipIterator* iter, GrScalar tx, GrScalar ty,
                              const GrRect* conservativeBounds) {
     fList.reset();
@@ -118,7 +124,7 @@
                                 rectCount = 1;
                                 fList.pop_back();
                                 GrAssert(kRect_ClipType == fList.back().fType);
-                                fList.back().fRect.intersectWith(e.fRect);
+                                intersectWith(&fList.back().fRect, e.fRect);
                             }
                         } else {
                             isectRectValid = false;