Index: src/gpu/GrTextContext.cpp |
=================================================================== |
--- src/gpu/GrTextContext.cpp (revision 8241) |
+++ src/gpu/GrTextContext.cpp (working copy) |
@@ -18,12 +18,10 @@ |
#include "SkPath.h" |
#include "SkStrokeRec.h" |
-enum { |
- // glyph rendering shares this stage with edge rendering |
- // (kEdgeEffectStage in GrContext) && SW path rendering |
- // (kPathMaskStage in GrSWMaskHelper) |
- kGlyphMaskStage = GrPaint::kTotalStages, |
-}; |
+// 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) { |
@@ -35,8 +33,12 @@ |
GrAssert(GrIsALIGN4(fCurrVertex)); |
GrAssert(fCurrTexture); |
GrTextureParams params(SkShader::kRepeat_TileMode, false); |
- drawState->createTextureEffect(kGlyphMaskStage, fCurrTexture, SkMatrix::I(), params); |
+ // This effect could be stored with one of the cache objects (atlas?) |
+ drawState->setEffect(kGlyphMaskStage, |
+ GrSimpleTextureEffect::CreateWithCustomCoords(fCurrTexture, params), |
+ kGlyphCoordsAttributeIndex)->unref(); |
+ |
if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) { |
if (kOne_GrBlendCoeff != fPaint.getSrcBlendCoeff() || |
kISA_GrBlendCoeff != fPaint.getDstBlendCoeff() || |
@@ -195,7 +197,7 @@ |
{kVec2f_GrVertexAttribType, 0}, |
{kVec2f_GrVertexAttribType, sizeof(GrPoint)} |
}; |
- static const GrAttribBindings kAttribBindings = GrDrawState::ExplicitTexCoordAttribBindingsBit(kGlyphMaskStage); |
+ static const GrAttribBindings kAttribBindings = 0; |
// If we need to reserve vertices allow the draw target to suggest |
// a number of verts to reserve and whether to perform a flush. |
@@ -214,7 +216,6 @@ |
fDrawTarget->drawState()->setVertexAttribs(kVertexAttribs, SK_ARRAY_COUNT(kVertexAttribs)); |
} |
fDrawTarget->drawState()->setAttribIndex(GrDrawState::kPosition_AttribIndex, 0); |
- fDrawTarget->drawState()->setAttribIndex(GrDrawState::kTexCoord_AttribIndex, 1); |
fDrawTarget->drawState()->setAttribBindings(kAttribBindings); |
fMaxVertices = kDefaultRequestedVerts; |
// ignore return, no point in flushing again. |