Fix GrContext::drawPaint with perspective, also never apply AA

Review URL: http://codereview.appspot.com/4969074/


git-svn-id: http://skia.googlecode.com/svn/trunk@2247 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp
index b857dda..8eb8c63 100644
--- a/gpu/src/GrContext.cpp
+++ b/gpu/src/GrContext.cpp
@@ -590,13 +590,26 @@
     r.setLTRB(0, 0,
               GrIntToScalar(getRenderTarget()->width()),
               GrIntToScalar(getRenderTarget()->height()));
+    GrAutoMatrix am;
     GrMatrix inverse;
-    if (fGpu->getViewInverse(&inverse)) {
+    // We attempt to map r by the inverse matrix and draw that. mapRect will
+    // map the four corners and bound them with a new rect. This will not
+    // produce a correct result for some perspective matrices.
+    if (!this->getMatrix().hasPerspective() &&
+        fGpu->getViewInverse(&inverse)) {
         inverse.mapRect(&r);
     } else {
-        GrPrintf("---- fGpu->getViewInverse failed\n");
+        am.set(this, GrMatrix::I());
     }
-    this->drawRect(paint, r);
+    GrPaint tmpPaint;
+    const GrPaint* p = &paint;
+    // by definition this fills the entire clip, no need for AA
+    if (paint.fAntiAlias) {
+        tmpPaint = paint;
+        tmpPaint.fAntiAlias = false;
+        p = &tmpPaint;
+    }
+    this->drawRect(*p, r);
 }
 
 ////////////////////////////////////////////////////////////////////////////////