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/GrTexture.cpp b/gpu/src/GrTexture.cpp
index 8ee531c..8df9c9e 100644
--- a/gpu/src/GrTexture.cpp
+++ b/gpu/src/GrTexture.cpp
@@ -32,8 +32,10 @@
 void GrRenderTarget::flagAsNeedingResolve(const GrIRect* rect) {
     if (kCanResolve_ResolveType == getResolveType()) {
         if (NULL != rect) {
-            fResolveRect.growToInclude(*rect);
-            fResolveRect.intersectWith(0, 0, this->width(), this->height());
+            fResolveRect.join(*rect);
+            if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
+                fResolveRect.setEmpty();
+            }
         } else {
             fResolveRect.setLTRB(0, 0, this->width(), this->height());
         }
@@ -45,7 +47,7 @@
     if (fResolveRect.isEmpty()) {
         fResolveRect.setLargestInverted();
     } else {
-        if (!fResolveRect.intersectWith(0, 0, this->width(), this->height())) {
+        if (!fResolveRect.intersect(0, 0, this->width(), this->height())) {
             fResolveRect.setLargestInverted();
         }
     }