Replace GrClip with SkClipStack

http://codereview.appspot.com/6449070/



git-svn-id: http://skia.googlecode.com/svn/trunk@4865 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 576a5bd..23b16dd 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -70,20 +70,6 @@
     fDrawTarget = NULL;
 }
 
-namespace {
-
-// 'rect' enters in canvas coordinates and leaves in device coordinates
-void canvas_to_device(SkRect* rect, const SkIPoint& origin) {
-    GrAssert(NULL != rect);
-
-    rect->fLeft   -= SkIntToScalar(origin.fX);
-    rect->fTop    -= SkIntToScalar(origin.fY);
-    rect->fRight  -= SkIntToScalar(origin.fX);
-    rect->fBottom -= SkIntToScalar(origin.fY);
-}
-
-};
-
 GrTextContext::GrTextContext(GrContext* context,
                              const GrPaint& paint,
                              const GrMatrix* extMatrix) : fPaint(paint) {
@@ -101,17 +87,22 @@
 
     const GrClipData* clipData = context->getClip();
 
-    GrRect conservativeBound = clipData->fClipStack->getConservativeBounds();
-    canvas_to_device(&conservativeBound, clipData->fOrigin);
+    GrRect devConservativeBound;
+    clipData->fClipStack->getConservativeBounds(
+                                     -clipData->fOrigin.fX,
+                                     -clipData->fOrigin.fY,
+                                     context->getRenderTarget()->width(),
+                                     context->getRenderTarget()->height(),
+                                     &devConservativeBound);
 
     if (!fExtMatrix.isIdentity()) {
         GrMatrix inverse;
         if (fExtMatrix.invert(&inverse)) {
-            inverse.mapRect(&conservativeBound);
+            inverse.mapRect(&devConservativeBound);
         }
     }
 
-    conservativeBound.roundOut(&fClipRect);
+    devConservativeBound.roundOut(&fClipRect);
 
     // save the context's original matrix off and restore in destructor
     // this must be done before getTextTarget.