blob: c66f8a856431343042679e8d33d8b4ae615dc70a [file] [log] [blame]
jvanverth@google.comc7a40fa2013-10-16 18:15:34 +00001/*
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
13class GrTextStrike;
14
15/*
16 * This class implements GrTextContext using standard bitmap fonts
17 */
18class GrBitmapTextContext : public GrTextContext {
19public:
commit-bot@chromium.orge8612d92014-01-28 22:02:07 +000020 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.comc7a40fa2013-10-16 18:15:34 +000024
25private:
commit-bot@chromium.orge8612d92014-01-28 22:02:07 +000026 GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDeviceProperties&);
commit-bot@chromium.orgcc40f062014-01-24 14:38:27 +000027 virtual ~GrBitmapTextContext();
28 friend class GrTTextContextManager<GrBitmapTextContext>;
29
jvanverth@google.comc7a40fa2013-10-16 18:15:34 +000030 GrTextStrike* fStrike;
31
commit-bot@chromium.orge8612d92014-01-28 22:02:07 +000032 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontScaler*);
jvanverth@google.comc7a40fa2013-10-16 18:15:34 +000033 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.comc7a40fa2013-10-16 18:15:34 +000042 SkPoint* fVertices;
43 int32_t fMaxVertices;
44 GrTexture* fCurrTexture;
45 int fCurrVertex;
46};
47
48#endif