1 /* 2 * Copyright 2013 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrDistanceFieldTextContext_DEFINED 9 #define GrDistanceFieldTextContext_DEFINED 10 11 #include "GrTextContext.h" 12 13 class GrTextStrike; 14 15 /* 16 * This class implements GrTextContext using distance field fonts 17 */ 18 class GrDistanceFieldTextContext : public GrTextContext { 19 public: 20 GrDistanceFieldTextContext(GrContext*, const GrPaint&, SkColor, SkScalar textRatio); 21 virtual ~GrDistanceFieldTextContext(); 22 23 virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, 24 GrFontScaler*) SK_OVERRIDE; 25 26 private: 27 GrTextStrike* fStrike; 28 SkScalar fTextRatio; 29 30 void flushGlyphs(); // automatically called by destructor 31 32 enum { 33 kMinRequestedGlyphs = 1, 34 kDefaultRequestedGlyphs = 64, 35 kMinRequestedVerts = kMinRequestedGlyphs * 4, 36 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, 37 }; 38 39 SkColor fSkPaintColor; 40 SkPoint* fVertices; 41 int32_t fMaxVertices; 42 GrTexture* fCurrTexture; 43 int fCurrVertex; 44 }; 45 46 #endif 47