Remove unused matrix param from GrContext/GrDrawTarget rect drawing functions.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/441623005
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 704750e..edd4454 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -407,7 +407,7 @@
                                                               element->getRect(),
                                                               false);
             } else {
-                fGpu->drawSimpleRect(element->getRect(), NULL);
+                fGpu->drawSimpleRect(element->getRect());
             }
             return true;
         default: {
@@ -481,7 +481,7 @@
                                       GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
                                       GrTextureDomain::kDecal_Mode,
                                       GrTextureParams::kNone_FilterMode))->unref();
-    fGpu->drawSimpleRect(SkRect::Make(dstBound), NULL);
+    fGpu->drawSimpleRect(SkRect::Make(dstBound));
 }
 
 // get a texture to act as a temporary buffer for AA clip boolean operations
@@ -812,7 +812,7 @@
                 SET_RANDOM_COLOR
                 if (Element::kRect_Type == element->getType()) {
                     *drawState->stencil() = gDrawToStencil;
-                    fGpu->drawSimpleRect(element->getRect(), NULL);
+                    fGpu->drawSimpleRect(element->getRect());
                 } else {
                     if (!clipPath.isEmpty()) {
                         if (canRenderDirectToStencil) {
@@ -833,7 +833,7 @@
                 if (canDrawDirectToClip) {
                     if (Element::kRect_Type == element->getType()) {
                         SET_RANDOM_COLOR
-                        fGpu->drawSimpleRect(element->getRect(), NULL);
+                        fGpu->drawSimpleRect(element->getRect());
                     } else {
                         SET_RANDOM_COLOR
                         pr->drawPath(clipPath, stroke, fGpu, false);
@@ -842,7 +842,7 @@
                     SET_RANDOM_COLOR
                     // The view matrix is setup to do clip space -> stencil space translation, so
                     // draw rect in clip space.
-                    fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds), NULL);
+                    fGpu->drawSimpleRect(SkRect::Make(clipSpaceIBounds));
                 }
             }
         }
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 3dc78c1..c3f3c33 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -786,8 +786,7 @@
 
 void GrContext::drawRect(const GrPaint& paint,
                          const SkRect& rect,
-                         const GrStrokeInfo* strokeInfo,
-                         const SkMatrix* matrix) {
+                         const GrStrokeInfo* strokeInfo) {
     if (NULL != strokeInfo && strokeInfo->isDashed()) {
         SkPath path;
         path.addRect(rect);
@@ -804,10 +803,7 @@
 
     GR_CREATE_TRACE_MARKER("GrContext::drawRect", target);
     SkScalar width = NULL == strokeInfo ? -1 : strokeInfo->getStrokeRec().getWidth();
-    SkMatrix combinedMatrix = target->drawState()->getViewMatrix();
-    if (NULL != matrix) {
-        combinedMatrix.preConcat(*matrix);
-    }
+    SkMatrix matrix = target->drawState()->getViewMatrix();
 
     // Check if this is a full RT draw and can be replaced with a clear. We don't bother checking
     // cases where the RT is fully inside a stroke.
@@ -824,7 +820,7 @@
         // Does the clip contain the entire RT?
         if (!checkClip || target->getClip()->fClipStack->quickContains(clipSpaceRTRect)) {
             SkMatrix invM;
-            if (!combinedMatrix.invert(&invM)) {
+            if (!matrix.invert(&invM)) {
                 return;
             }
             // Does the rect bound the RT?
@@ -848,7 +844,7 @@
     bool useVertexCoverage;
     bool needAA = paint.isAntiAlias() &&
                   !target->getDrawState().getRenderTarget()->isMultisampled();
-    bool doAA = needAA && apply_aa_to_rect(target, rect, width, combinedMatrix, &devBoundRect,
+    bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, &devBoundRect,
                                            &useVertexCoverage);
 
     const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec();
@@ -860,12 +856,12 @@
         }
         if (width >= 0) {
             fAARectRenderer->strokeAARect(this->getGpu(), target, rect,
-                                          combinedMatrix, devBoundRect,
+                                          matrix, devBoundRect,
                                           strokeRec, useVertexCoverage);
         } else {
             // filled AA rect
             fAARectRenderer->fillAARect(this->getGpu(), target,
-                                        rect, combinedMatrix, devBoundRect,
+                                        rect, matrix, devBoundRect,
                                         useVertexCoverage);
         }
         return;
@@ -904,23 +900,16 @@
             vertex[4].set(rect.fLeft, rect.fTop);
         }
 
-        GrDrawState::AutoViewMatrixRestore avmr;
-        if (NULL != matrix) {
-            GrDrawState* drawState = target->drawState();
-            avmr.set(drawState, *matrix);
-        }
-
         target->drawNonIndexed(primType, 0, vertCount);
     } else {
         // filled BW rect
-        target->drawSimpleRect(rect, matrix);
+        target->drawSimpleRect(rect);
     }
 }
 
 void GrContext::drawRectToRect(const GrPaint& paint,
                                const SkRect& dstRect,
                                const SkRect& localRect,
-                               const SkMatrix* dstMatrix,
                                const SkMatrix* localMatrix) {
     AutoRestoreEffects are;
     AutoCheckFlush acf(this);
@@ -931,7 +920,7 @@
 
     GR_CREATE_TRACE_MARKER("GrContext::drawRectToRect", target);
 
-    target->drawRect(dstRect, dstMatrix, &localRect, localMatrix);
+    target->drawRect(dstRect, &localRect, localMatrix);
 }
 
 namespace {
@@ -1523,7 +1512,7 @@
 
                 drawState->setRenderTarget(texture->asRenderTarget());
                 SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
-                fGpu->drawSimpleRect(rect, NULL);
+                fGpu->drawSimpleRect(rect);
                 // we want to read back from the scratch's origin
                 left = 0;
                 top = 0;
@@ -1609,7 +1598,7 @@
     sampleM.preTranslate(SkIntToScalar(srcRect.fLeft), SkIntToScalar(srcRect.fTop));
     drawState->addColorTextureEffect(src, sampleM);
     SkRect dstR = SkRect::MakeWH(SkIntToScalar(srcRect.width()), SkIntToScalar(srcRect.height()));
-    fGpu->drawSimpleRect(dstR, NULL);
+    fGpu->drawSimpleRect(dstR);
 }
 
 bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,
@@ -1736,7 +1725,7 @@
 
     drawState->setRenderTarget(target);
 
-    fGpu->drawSimpleRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)), NULL);
+    fGpu->drawSimpleRect(SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)));
     return true;
 }
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrDefaultPathRenderer.cpp b/src/gpu/GrDefaultPathRenderer.cpp
index bd9b1ea..dd6ae9d 100644
--- a/src/gpu/GrDefaultPathRenderer.cpp
+++ b/src/gpu/GrDefaultPathRenderer.cpp
@@ -491,7 +491,7 @@
                 bounds = path.getBounds();
             }
             GrDrawTarget::AutoGeometryAndStatePush agasp(target, GrDrawTarget::kPreserve_ASRInit);
-            target->drawSimpleRect(bounds, NULL);
+            target->drawSimpleRect(bounds);
         } else {
             if (passCount > 1) {
                 drawState->enableState(GrDrawState::kNoColorWrites_StateBit);
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index fd5e476..f8bb910 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -696,15 +696,9 @@
 };
 
 void GrDrawTarget::onDrawRect(const SkRect& rect,
-                              const SkMatrix* matrix,
                               const SkRect* localRect,
                               const SkMatrix* localMatrix) {
 
-    GrDrawState::AutoViewMatrixRestore avmr;
-    if (NULL != matrix) {
-        avmr.set(this->drawState(), *matrix);
-    }
-
     set_vertex_attributes(this->drawState(), NULL != localRect);
 
     AutoReleaseGeometry geo(this, 4, 0);
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 0c03e34..bd25a18 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -389,7 +389,6 @@
      * and thus will finalize any reserved geometry.
      *
      * @param rect        the rect to draw
-     * @param matrix      optional matrix applied to rect (before viewMatrix)
      * @param localRect   optional rect that specifies local coords to map onto
      *                    rect. If NULL then rect serves as the local coords.
      * @param localMatrix optional matrix applied to localRect. If
@@ -398,22 +397,21 @@
      *                    srcMatrix can be NULL when no srcMatrix is desired.
      */
     void drawRect(const SkRect& rect,
-                  const SkMatrix* matrix,
                   const SkRect* localRect,
                   const SkMatrix* localMatrix) {
         AutoGeometryPush agp(this);
-        this->onDrawRect(rect, matrix, localRect, localMatrix);
+        this->onDrawRect(rect, localRect, localMatrix);
     }
 
     /**
      * Helper for drawRect when the caller doesn't need separate local rects or matrices.
      */
-    void drawSimpleRect(const SkRect& rect, const SkMatrix* matrix = NULL) {
-        this->drawRect(rect, matrix, NULL, NULL);
+    void drawSimpleRect(const SkRect& rect) {
+        this->drawRect(rect, NULL, NULL);
     }
-    void drawSimpleRect(const SkIRect& irect, const SkMatrix* matrix = NULL) {
+    void drawSimpleRect(const SkIRect& irect) {
         SkRect rect = SkRect::Make(irect);
-        this->drawRect(rect, matrix, NULL, NULL);
+        this->drawRect(rect, NULL, NULL);
     }
 
     /**
@@ -929,7 +927,6 @@
     // drawIndexedInstances, ...). The base class draws a two triangle fan using
     // drawNonIndexed from reserved vertex space.
     virtual void onDrawRect(const SkRect& rect,
-                            const SkMatrix* matrix,
                             const SkRect* localRect,
                             const SkMatrix* localMatrix);
 
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 26b5452..0cab19f 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -137,7 +137,6 @@
 }
 
 void GrInOrderDrawBuffer::onDrawRect(const SkRect& rect,
-                                     const SkMatrix* matrix,
                                      const SkRect* localRect,
                                      const SkMatrix* localMatrix) {
     GrDrawState::AutoColorRestore acr;
@@ -167,13 +166,8 @@
     }
 
     // Go to device coords to allow batching across matrix changes
-    SkMatrix combinedMatrix;
-    if (NULL != matrix) {
-        combinedMatrix = *matrix;
-    } else {
-        combinedMatrix.reset();
-    }
-    combinedMatrix.postConcat(drawState->getViewMatrix());
+    SkMatrix matrix = drawState->getViewMatrix();
+
     // When the caller has provided an explicit source rect for a stage then we don't want to
     // modify that stage's matrix. Otherwise if the effect is generating its source rect from
     // the vertex positions then we have to account for the view matrix change.
@@ -185,7 +179,7 @@
     size_t vsize = drawState->getVertexSize();
 
     geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize);
-    combinedMatrix.mapPointsWithStride(geo.positions(), vsize, 4);
+    matrix.mapPointsWithStride(geo.positions(), vsize, 4);
 
     SkRect devBounds;
     // since we already computed the dev verts, set the bounds hint. This will help us avoid
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index b18112e..b678518 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -155,7 +155,6 @@
     // overrides from GrDrawTarget
     virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
     virtual void onDrawRect(const SkRect& rect,
-                            const SkMatrix* matrix,
                             const SkRect* localRect,
                             const SkMatrix* localMatrix) SK_OVERRIDE;
 
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index cf4c316..395c90b 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -939,7 +939,7 @@
     if (applyAA) {
         bounds.outset(SK_ScalarHalf, SK_ScalarHalf);
     }
-    target->drawRect(bounds, NULL, NULL, NULL);
+    target->drawRect(bounds, NULL, NULL);
     return true;
 }
 
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index bca2c66..0d3ef62 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -84,22 +84,22 @@
     if (devClipBounds.fTop < devPathBounds.fTop) {
         rect.iset(devClipBounds.fLeft, devClipBounds.fTop,
                   devClipBounds.fRight, devPathBounds.fTop);
-        target->drawSimpleRect(rect, NULL);
+        target->drawSimpleRect(rect);
     }
     if (devClipBounds.fLeft < devPathBounds.fLeft) {
         rect.iset(devClipBounds.fLeft, devPathBounds.fTop,
                   devPathBounds.fLeft, devPathBounds.fBottom);
-        target->drawSimpleRect(rect, NULL);
+        target->drawSimpleRect(rect);
     }
     if (devClipBounds.fRight > devPathBounds.fRight) {
         rect.iset(devPathBounds.fRight, devPathBounds.fTop,
                   devClipBounds.fRight, devPathBounds.fBottom);
-        target->drawSimpleRect(rect, NULL);
+        target->drawSimpleRect(rect);
     }
     if (devClipBounds.fBottom > devPathBounds.fBottom) {
         rect.iset(devClipBounds.fLeft, devPathBounds.fBottom,
                   devClipBounds.fRight, devClipBounds.fBottom);
-        target->drawSimpleRect(rect, NULL);
+        target->drawSimpleRect(rect);
     }
 }
 
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index b1e23f9..7c4f451 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1381,7 +1381,7 @@
                                        SkColor2GrColor(paint.getColor());
     SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grPaint);
 
-    fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL);
+    fContext->drawRectToRect(grPaint, dstRect, paintRect);
 }
 
 static bool filter_texture(SkBaseDevice* device, GrContext* context,
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 8982785..adcddcc 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1935,7 +1935,7 @@
             avmr.setIdentity(drawState);
         }
 
-        this->drawSimpleRect(bounds, NULL);
+        this->drawSimpleRect(bounds);
     }
 }
 
@@ -2012,7 +2012,7 @@
             avmr.setIdentity(drawState);
         }
 
-        this->drawSimpleRect(bounds, NULL);
+        this->drawSimpleRect(bounds);
     }
 }