This CL introduces a new path renderer.

Here are the characteristics :
- It uses the original path, before stroking
- It supports traight lines only (no curves)
- It supports butt or square caps only
- It supports miter or bevel joins only
- No AA support
Support for these will be added step by step later on.

A first pass at the benchmarks on my linux machine gave me these approximate speed improvements (running all bench with the option '--forceAA 0') :
path_stroke_small_long_line 4X
path_stroke_small_sawtooth 4X
path_stroke_big_rect 4X
path_stroke_small_rect 6X
path_stroke_big_triangle 4X
path_stroke_small_triangle 10X
lines_1_BW 1.5X
dashline_2_square 1.5X
dashline_1_square 1.5X

Also note that I can't submit this code until GrDrawTarget::isOpaque() is implemented, unless I just disable my renderer completely for now.

BUG=chromium:135111
TEST=The following gms are affected and may require rebaselining : lineclosepath, linepath, strokes_poly
Review URL: https://codereview.appspot.com/7026049

git-svn-id: http://skia.googlecode.com/svn/trunk@7047 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 12fbeb6..5961aaf 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -1063,24 +1063,15 @@
        return;
     }
 
-    const SkPath* pathPtr = &path;
-    SkPath tmpPath;
-    SkStrokeRec strokeRec(stroke);
-    if (!strokeRec.isHairlineStyle()) {
-        if (strokeRec.applyToPath(&tmpPath, *pathPtr)) {
-            pathPtr = &tmpPath;
-            strokeRec.setFillStyle();
-        }
-    }
-
     SkRect ovalRect;
-    if (!pathPtr->isInverseFillType() && pathPtr->isOval(&ovalRect)) {
-        SkScalar width = strokeRec.isHairlineStyle() ? 0 : -SK_Scalar1;
+    if ((stroke.isHairlineStyle() || stroke.isFillStyle()) && !path.isInverseFillType() &&
+        path.isOval(&ovalRect)) {
+        SkScalar width = stroke.isHairlineStyle() ? 0 : -SK_Scalar1;
         this->drawOval(paint, ovalRect, width);
         return;
     }
 
-    this->internalDrawPath(paint, *pathPtr, strokeRec);
+    this->internalDrawPath(paint, path, stroke);
 }
 
 void GrContext::internalDrawPath(const GrPaint& paint, const SkPath& path, const SkStrokeRec& stroke) {
@@ -1109,7 +1100,23 @@
     GrPathRendererChain::DrawType type = prAA ? GrPathRendererChain::kColorAntiAlias_DrawType :
                                                 GrPathRendererChain::kColor_DrawType;
 
-    GrPathRenderer* pr = this->getPathRenderer(path, stroke, target, true, type);
+    const SkPath* pathPtr = &path;
+    SkPath tmpPath;
+    SkStrokeRec strokeRec(stroke);
+
+    // Try a 1st time without stroking the path and without allowing the SW renderer
+    GrPathRenderer* pr = this->getPathRenderer(*pathPtr, strokeRec, target, false, type);
+
+    if ((NULL == pr) && !strokeRec.isHairlineStyle()) {
+        // It didn't work the 1st time, so try again with the stroked path
+        if (strokeRec.applyToPath(&tmpPath, *pathPtr)) {
+            pathPtr = &tmpPath;
+            strokeRec.setFillStyle();
+        }
+        // This time, allow SW renderer
+        pr = this->getPathRenderer(*pathPtr, strokeRec, target, true, type);
+    }
+
     if (NULL == pr) {
 #if GR_DEBUG
         GrPrintf("Unable to find path renderer compatible with path.\n");
@@ -1117,7 +1124,7 @@
         return;
     }
 
-    pr->drawPath(path, stroke, target, prAA);
+    pr->drawPath(*pathPtr, strokeRec, target, prAA);
 }
 
 ////////////////////////////////////////////////////////////////////////////////