| 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 GrBitmapTextContext_DEFINED | |
| 9 #define GrBitmapTextContext_DEFINED | |
| 10 | |
| 11 #include "GrTextContext.h" | |
| 12 | |
| 13 class GrTextStrike; | |
| 14 | |
| 15 /* | |
| 16 * This class implements GrTextContext using standard bitmap fonts | |
| 17 */ | |
| 18 class GrBitmapTextContext : public GrTextContext { | |
| 19 public: | |
| 20 GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDevi
ceProperties&); | |
| 21 virtual ~GrBitmapTextContext(); | |
| 22 | |
| 23 virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkSc
alar y) SK_OVERRIDE; | |
| 24 virtual void drawPosText(const char text[], size_t byteLength, | |
| 25 const SkScalar pos[], SkScalar constY, | |
| 26 int scalarsPerPosition) SK_OVERRIDE; | |
| 27 | |
| 28 static bool CanDraw(const SkPaint& paint, const SkMatrix& ctm); | |
| 29 | |
| 30 private: | |
| 31 GrTextStrike* fStrike; | |
| 32 | |
| 33 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca
ler*); | |
| 34 void flushGlyphs(); // automatically called by destructor | |
| 35 | |
| 36 enum { | |
| 37 kMinRequestedGlyphs = 1, | |
| 38 kDefaultRequestedGlyphs = 64, | |
| 39 kMinRequestedVerts = kMinRequestedGlyphs * 4, | |
| 40 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | |
| 41 }; | |
| 42 | |
| 43 SkPoint* fVertices; | |
| 44 int32_t fMaxVertices; | |
| 45 GrTexture* fCurrTexture; | |
| 46 int fCurrVertex; | |
| 47 }; | |
| 48 | |
| 49 #endif | |
| OLD | NEW |