Restore text vertex buffer alloc and other optimizations.
Modifies the fontcache GM to ensure that the font cache is forced to flush.
R=bsalomon@google.com, robertphillips@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/466363009
diff --git a/src/gpu/GrDistanceFieldTextContext.h b/src/gpu/GrDistanceFieldTextContext.h
index 75a13b3..c9fe82d 100644
--- a/src/gpu/GrDistanceFieldTextContext.h
+++ b/src/gpu/GrDistanceFieldTextContext.h
@@ -30,18 +30,8 @@
virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
private:
- GrTextStrike* fStrike;
- SkScalar fTextRatio;
- bool fUseLCDText;
- bool fEnableDFRendering;
- SkAutoTUnref<GrEffect> fCachedEffect;
- // Used to check whether fCachedEffect is still valid.
- uint32_t fEffectTextureUniqueID;
- SkColor fEffectColor;
- uint32_t fEffectFlags;
- GrTexture* fGammaTexture;
-
void init(const GrPaint&, const SkPaint&);
+ void allocateVertices(const char text[], size_t byteLength);
void drawPackedGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*);
void flushGlyphs(); // automatically called by destructor
void setupCoverageEffect(const SkColor& filteredColor);
@@ -54,9 +44,19 @@
kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
};
+ GrTextStrike* fStrike;
+ SkScalar fTextRatio;
+ bool fUseLCDText;
+ bool fEnableDFRendering;
+ SkAutoTUnref<GrEffect> fCachedEffect;
+ // Used to check whether fCachedEffect is still valid.
+ uint32_t fEffectTextureUniqueID;
+ SkColor fEffectColor;
+ uint32_t fEffectFlags;
+ GrTexture* fGammaTexture;
+
void* fVertices;
- int32_t fMaxVertices;
- GrTexture* fCurrTexture;
+ int fVertexCount;
int fCurrVertex;
SkRect fVertexBounds;
};