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/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 19f18b5..65c5c7a 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -18,17 +18,15 @@
#include "SkPath.h"
#include "SkStrokeRec.h"
-// glyph rendering shares this stage with edge rendering (kEdgeEffectStage in GrContext) && SW path
-// rendering (kPathMaskStage in GrSWMaskHelper)
-static const int kGlyphMaskStage = GrPaint::kTotalStages;
static const int kGlyphCoordsAttributeIndex = 1;
void GrTextContext::flushGlyphs() {
if (NULL == fDrawTarget) {
return;
}
- GrDrawTarget::AutoStateRestore asr(fDrawTarget, GrDrawTarget::kPreserve_ASRInit);
+
GrDrawState* drawState = fDrawTarget->drawState();
+ GrDrawState::AutoRestoreEffects are(drawState);
drawState->setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget());
if (fCurrVertex > 0) {
@@ -38,9 +36,9 @@
GrTextureParams params(SkShader::kRepeat_TileMode, false);
// This effect could be stored with one of the cache objects (atlas?)
- drawState->setEffect(kGlyphMaskStage,
- GrSimpleTextureEffect::CreateWithCustomCoords(fCurrTexture, params),
- kGlyphCoordsAttributeIndex)->unref();
+ drawState->addCoverageEffect(
+ GrSimpleTextureEffect::CreateWithCustomCoords(fCurrTexture, params),
+ kGlyphCoordsAttributeIndex)->unref();
if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) {
if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() ||