re-re-enable antialiased rects for gpu



git-svn-id: http://skia.googlecode.com/svn/trunk@1065 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 0c9b6ed..90728b1 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -729,7 +729,7 @@
         fillDevAARect(ctx, paint, r);
         return;
     }
-    
+
     GrAutoMatrix avm(ctx, GrMatrix::I());
 
     GrPoint verts[16];
@@ -750,6 +750,20 @@
                       gStrokeAARectIdx, SK_ARRAY_COUNT(gStrokeAARectIdx));
 }
 
+/*
+ *  If the paint has a texture, preconcat the ctx's inverse, since when we
+ *  draw verts which are already in device coordinates, we need to "undo" that
+ *  before we run our vertex shaders, which expect the coordinates to be local.
+ */
+static void preConcatInverseToTextureMatrix(GrContext* ctx, GrPaint* paint) {
+    if (paint->getTexture()) {
+        GrMatrix inverse;
+        if (ctx->getMatrix().invert(&inverse)) {
+            paint->fSampler.preConcatMatrix(inverse);
+        }
+    }
+}
+
 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
                           const SkPaint& paint) {
     CHECK_SHOULD_DRAW(draw);
@@ -770,7 +784,6 @@
         }
 
         bool doAA = paint.isAntiAlias();
-        doAA = false;
 
         if (SkDraw::kHair_RectType == type && doAA) {
             strokeSize.set(SK_Scalar1, SK_Scalar1);
@@ -786,6 +799,7 @@
                 if (doAA) {
                     SkRect devRect;
                     matrix.mapRect(&devRect, rect);
+                    preConcatInverseToTextureMatrix(fContext, &grPaint);
                     fillDevAARect(fContext, grPaint, Sk2Gr(devRect));
                 } else {
                     fContext->drawRect(grPaint, Sk2Gr(rect), -1);
@@ -795,6 +809,7 @@
                 if (doAA) {
                     SkRect devRect;
                     matrix.mapRect(&devRect, rect);
+                    preConcatInverseToTextureMatrix(fContext, &grPaint);
                     strokeDevAARect(fContext, grPaint, Sk2Gr(devRect), strokeSize);
                 } else {
                     fContext->drawRect(grPaint, Sk2Gr(rect), paint.getStrokeWidth());