| OLD | NEW |
| (Empty) |
| 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 virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkSc
alar y) SK_OVERRIDE; | |
| 21 virtual void drawPosText(const char text[], size_t byteLength, | |
| 22 const SkScalar pos[], SkScalar constY, | |
| 23 int scalarsPerPosition) SK_OVERRIDE; | |
| 24 | |
| 25 static bool CanDraw(const SkPaint& paint, const SkMatrix& ctm); | |
| 26 | |
| 27 private: | |
| 28 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&, | |
| 29 const SkDeviceProperties&); | |
| 30 virtual ~GrDistanceFieldTextContext(); | |
| 31 friend class GrTTextContextManager<GrDistanceFieldTextContext>; | |
| 32 | |
| 33 GrTextStrike* fStrike; | |
| 34 SkScalar fTextRatio; | |
| 35 | |
| 36 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca
ler*); | |
| 37 void flushGlyphs(); // automatically called by destructor | |
| 38 | |
| 39 enum { | |
| 40 kMinRequestedGlyphs = 1, | |
| 41 kDefaultRequestedGlyphs = 64, | |
| 42 kMinRequestedVerts = kMinRequestedGlyphs * 4, | |
| 43 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | |
| 44 }; | |
| 45 | |
| 46 SkPoint* fVertices; | |
| 47 int32_t fMaxVertices; | |
| 48 GrTexture* fCurrTexture; | |
| 49 int fCurrVertex; | |
| 50 }; | |
| 51 | |
| 52 #endif | |
| OLD | NEW |