Allocate only the vertices we need for text.
This restructures the vertex allocation for text rendering to compute
the max number of vertices we would need for a line of text, and then
only allocate that much. If this number exceeds the quad index limit,
then it will allocate for the max number of quads, and reallocate for
the rest later.
Review URL: https://codereview.chromium.org/663423003
diff --git a/src/gpu/GrBitmapTextContext.h b/src/gpu/GrBitmapTextContext.h
index 7a93820..d98a9f4 100644
--- a/src/gpu/GrBitmapTextContext.h
+++ b/src/gpu/GrBitmapTextContext.h
@@ -23,17 +23,11 @@
virtual ~GrBitmapTextContext();
private:
- enum {
- kMinRequestedGlyphs = 1,
- kDefaultRequestedGlyphs = 64,
- kMinRequestedVerts = kMinRequestedGlyphs * 4,
- kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
- };
-
GrTextStrike* fStrike;
void* fVertices;
int fCurrVertex;
- int fMaxVertices;
+ int fAllocVertexCount;
+ int fTotalVertexCount;
SkRect fVertexBounds;
GrTexture* fCurrTexture;
GrMaskFormat fCurrMaskFormat;