Replace fixed-size array of effect stages in GrDrawState with two appendable arrays, one for color, one for coverage.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/16952006
git-svn-id: http://skia.googlecode.com/svn/trunk@9592 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 70b5c77..465dd2b 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -349,16 +349,10 @@
SkStrokeRec::Style style = stroke.getStyle();
bool isStroked = (SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_Style == style);
- enum {
- // the edge effects share this stage with glyph rendering
- // (kGlyphMaskStage in GrTextContext) && SW path rendering
- // (kPathMaskStage in GrSWMaskHelper)
- kEdgeEffectStage = GrPaint::kTotalStages,
- };
GrEffectRef* effect = CircleEdgeEffect::Create(isStroked);
static const int kCircleEdgeAttrIndex = 1;
- drawState->setEffect(kEdgeEffectStage, effect, kCircleEdgeAttrIndex)->unref();
+ drawState->addCoverageEffect(effect, kCircleEdgeAttrIndex)->unref();
SkScalar innerRadius = 0.0f;
SkScalar outerRadius = radius;
@@ -509,18 +503,11 @@
EllipseVertex* verts = reinterpret_cast<EllipseVertex*>(geo.vertices());
- enum {
- // the edge effects share this stage with glyph rendering
- // (kGlyphMaskStage in GrTextContext) && SW path rendering
- // (kPathMaskStage in GrSWMaskHelper)
- kEdgeEffectStage = GrPaint::kTotalStages,
- };
GrEffectRef* effect = EllipseEdgeEffect::Create(isStroked);
static const int kEllipseCenterAttrIndex = 1;
static const int kEllipseEdgeAttrIndex = 2;
- drawState->setEffect(kEdgeEffectStage, effect,
- kEllipseCenterAttrIndex, kEllipseEdgeAttrIndex)->unref();
+ drawState->addCoverageEffect(effect, kEllipseCenterAttrIndex, kEllipseEdgeAttrIndex)->unref();
// Compute the reciprocals of the radii here to save time in the shader
SkScalar xRadRecip = SkScalarInvert(xRadius);
@@ -657,13 +644,6 @@
bool isStroked = (SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_Style == style);
- enum {
- // the edge effects share this stage with glyph rendering
- // (kGlyphMaskStage in GrTextContext) && SW path rendering
- // (kPathMaskStage in GrSWMaskHelper)
- kEdgeEffectStage = GrPaint::kTotalStages,
- };
-
GrIndexBuffer* indexBuffer = this->rRectIndexBuffer(context->getGpu());
if (NULL == indexBuffer) {
GrPrintf("Failed to create index buffer!\n");
@@ -702,7 +682,7 @@
GrEffectRef* effect = CircleEdgeEffect::Create(isStroked);
static const int kCircleEdgeAttrIndex = 1;
- drawState->setEffect(kEdgeEffectStage, effect, kCircleEdgeAttrIndex)->unref();
+ drawState->addCoverageEffect(effect, kCircleEdgeAttrIndex)->unref();
// The radii are outset for two reasons. First, it allows the shader to simply perform
// clamp(distance-to-center - radius, 0, 1). Second, the outer radius is used to compute the
@@ -805,8 +785,8 @@
GrEffectRef* effect = EllipseEdgeEffect::Create(isStroked);
static const int kEllipseOffsetAttrIndex = 1;
static const int kEllipseRadiiAttrIndex = 2;
- drawState->setEffect(kEdgeEffectStage, effect,
- kEllipseOffsetAttrIndex, kEllipseRadiiAttrIndex)->unref();
+ drawState->addCoverageEffect(effect,
+ kEllipseOffsetAttrIndex, kEllipseRadiiAttrIndex)->unref();
// Compute the reciprocals of the radii here to save time in the shader
SkScalar xRadRecip = SkScalarInvert(xRadius);