jvanverth@google.com | c7a40fa | 2013-10-16 18:15:34 +0000 | [diff] [blame] | 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: |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame^] | 20 | virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkScalar y) SK_OVERRIDE; |
| 21 | virtual void drawPosText(const char text[], size_t byteLength, |
| 22 | const SkScalar pos[], SkScalar constY, |
| 23 | int scalarsPerPosition) SK_OVERRIDE; |
jvanverth@google.com | c7a40fa | 2013-10-16 18:15:34 +0000 | [diff] [blame] | 24 | |
| 25 | private: |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame^] | 26 | GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDeviceProperties&); |
commit-bot@chromium.org | cc40f06 | 2014-01-24 14:38:27 +0000 | [diff] [blame] | 27 | virtual ~GrBitmapTextContext(); |
| 28 | friend class GrTTextContextManager<GrBitmapTextContext>; |
| 29 | |
jvanverth@google.com | c7a40fa | 2013-10-16 18:15:34 +0000 | [diff] [blame] | 30 | GrTextStrike* fStrike; |
| 31 | |
commit-bot@chromium.org | e8612d9 | 2014-01-28 22:02:07 +0000 | [diff] [blame^] | 32 | void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*); |
jvanverth@google.com | c7a40fa | 2013-10-16 18:15:34 +0000 | [diff] [blame] | 33 | void flushGlyphs(); // automatically called by destructor |
| 34 | |
| 35 | enum { |
| 36 | kMinRequestedGlyphs = 1, |
| 37 | kDefaultRequestedGlyphs = 64, |
| 38 | kMinRequestedVerts = kMinRequestedGlyphs * 4, |
| 39 | kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, |
| 40 | }; |
| 41 | |
jvanverth@google.com | c7a40fa | 2013-10-16 18:15:34 +0000 | [diff] [blame] | 42 | SkPoint* fVertices; |
| 43 | int32_t fMaxVertices; |
| 44 | GrTexture* fCurrTexture; |
| 45 | int fCurrVertex; |
| 46 | }; |
| 47 | |
| 48 | #endif |