Add GrEllipseEdgeEffect.

Adds the effect that replaces the old oval rendering code. Also hooks in code to set attribute names and indices for effects.

Author: jvanverth@google.com

Review URL: https://chromiumcodereview.appspot.com/12462008

git-svn-id: http://skia.googlecode.com/svn/trunk@8092 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 046e067..7c85212 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -12,6 +12,7 @@
 #include "effects/GrConvolutionEffect.h"
 #include "effects/GrSingleTextureEffect.h"
 #include "effects/GrConfigConversionEffect.h"
+#include "effects/GrEllipseEdgeEffect.h"
 
 #include "GrBufferAllocPool.h"
 #include "GrGpu.h"
@@ -1072,12 +1073,8 @@
         {kVec2f_GrVertexAttribType, 0},
         {kVec4f_GrVertexAttribType, sizeof(GrPoint)}
     };
-    static const GrAttribBindings kAttributeBindings = GrDrawState::kEdge_AttribBindingsBit;
-
     drawState->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs));
     drawState->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0);
-    drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1);
-    drawState->setAttribBindings(kAttributeBindings);
     GrAssert(sizeof(CircleVertex) == drawState->getVertexSize());
 
     GrDrawTarget::AutoReleaseGeometry geo(target, 4, 0);
@@ -1097,7 +1094,9 @@
     SkScalar B;
 
     if (isCircle) {
+        drawState->setAttribBindings(GrDrawState::kEdge_AttribBindingsBit);
         drawState->setVertexEdgeType(GrDrawState::kCircle_EdgeType);
+        drawState->setAttribIndex(GrDrawState::kEdge_AttribIndex, 1);
 
         xRadius = vm.mapRadius(xRadius);
 
@@ -1129,7 +1128,17 @@
         T = -outerRadius;
         B = +outerRadius;
     } else {  // is axis-aligned ellipse
-        drawState->setVertexEdgeType(GrDrawState::kEllipse_EdgeType);
+        drawState->setAttribBindings(GrDrawState::kDefault_AttribBindings);
+
+        enum {
+            // the edge effects share this stage with glyph rendering 
+            // (kGlyphMaskStage in GrTextContext) && SW path rendering 
+            // (kPathMaskStage in GrSWMaskHelper)
+            kEdgeEffectStage = GrPaint::kTotalStages,
+        };
+        GrEffectRef* effect = GrEllipseEdgeEffect::Create();
+        static const int kEdgeAttrIndex = 1;
+        drawState->setEffect(kEdgeEffectStage, effect, &kEdgeAttrIndex)->unref();
 
         SkRect xformedRect;
         vm.mapRect(&xformedRect, oval);