revert 8265-8264 (broke build)



git-svn-id: http://skia.googlecode.com/svn/trunk@8268 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 6966858..31b1a57 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -74,8 +74,9 @@
 
 void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
                                    const SkMatrix* matrix,
-                                   const GrRect* localRect,
-                                   const SkMatrix* localMatrix) {
+                                   const GrRect* srcRect,
+                                   const SkMatrix* srcMatrix,
+                                   int stage) {
 
     GrAttribBindings bindings = GrDrawState::kDefault_AttribBindings;
     GrDrawState::AutoColorRestore acr;
@@ -85,7 +86,7 @@
     GrColor color = drawState->getColor();
     GrVertexAttribArray<3> attribs;
     size_t currentOffset = 0;
-    int colorOffset = -1, localOffset = -1;
+    int colorOffset = -1, texOffset = -1;
 
     // set position attrib
     drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, attribs.count());
@@ -114,13 +115,15 @@
         acr.set(drawState, 0xFFFFFFFF);
     }
 
-    if (NULL != localRect) {
-        bindings |= GrDrawState::kLocalCoords_AttribBindingsBit;
-        drawState->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex, attribs.count());
+    uint32_t explicitCoordMask = 0;
+    if (NULL != srcRect) {
+        bindings |= GrDrawState::ExplicitTexCoordAttribBindingsBit(stage);
+        drawState->setAttribIndex(GrDrawState::kTexCoord_AttribIndex, attribs.count());
         currAttrib.set(kVec2f_GrVertexAttribType, currentOffset);
         attribs.push_back(currAttrib);
-        localOffset = currentOffset;
+        texOffset = currentOffset;
         currentOffset += sizeof(GrPoint);
+        explicitCoordMask = (1 << stage);
     }
 
     drawState->setVertexAttribs(attribs.begin(), attribs.count());
@@ -142,7 +145,7 @@
     // 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.
-    GrDrawState::AutoDeviceCoordDraw adcd(drawState);
+    GrDrawState::AutoDeviceCoordDraw adcd(drawState, explicitCoordMask);
     if (!adcd.succeeded()) {
         return;
     }
@@ -158,13 +161,15 @@
     // unnecessary clipping in our onDraw().
     get_vertex_bounds(geo.vertices(), vsize, 4, &devBounds);
 
-    if (localOffset >= 0) {
-        GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + localOffset);
-        coords->setRectFan(localRect->fLeft, localRect->fTop,
-                           localRect->fRight, localRect->fBottom,
+    if (texOffset >= 0) {
+        GrAssert(explicitCoordMask != 0);
+        GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) +
+                                            texOffset);
+        coords->setRectFan(srcRect->fLeft, srcRect->fTop,
+                            srcRect->fRight, srcRect->fBottom,
                             vsize);
-        if (NULL != localMatrix) {
-            localMatrix->mapPointsWithStride(coords, vsize, 4);
+        if (NULL != srcMatrix) {
+            srcMatrix->mapPointsWithStride(coords, vsize, 4);
         }
     }