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