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 #include "GrGeometryProcessor.h" | |
14 | |
15 class GrTextStrike; | |
16 | |
17 /* | |
18 * This class implements GrTextContext using standard bitmap fonts | |
19 */ | |
20 class GrBitmapTextContext : public GrTextContext { | |
21 public: | |
22 static GrBitmapTextContext* Create(GrContext*, SkGpuDevice*, const SkDevice
Properties&); | |
23 | |
24 virtual ~GrBitmapTextContext() {} | |
25 | |
26 private: | |
27 GrTextStrike* fStrike; | |
28 void* fVertices; | |
29 int fCurrVertex; | |
30 int fAllocVertexCount; | |
31 int fTotalVertexCount; | |
32 SkRect fVertexBounds; | |
33 GrTexture* fCurrTexture; | |
34 GrMaskFormat fCurrMaskFormat; | |
35 SkAutoTUnref<const GrGeometryProcessor> fCachedGeometryProcessor; | |
36 // Used to check whether fCachedEffect is still valid. | |
37 uint32_t fEffectTextureUniqueID; | |
38 SkMatrix fLocalMatrix; | |
39 | |
40 GrBitmapTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); | |
41 | |
42 bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, | |
43 const SkPaint&, const SkMatrix& viewMatrix) override; | |
44 | |
45 void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPain
t&, | |
46 const SkMatrix& viewMatrix, const char text[], size_t byteLe
ngth, | |
47 SkScalar x, SkScalar y, const SkIRect& regionClipBounds) ove
rride; | |
48 void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, const SkP
aint&, | |
49 const SkMatrix& viewMatrix, | |
50 const char text[], size_t byteLength, | |
51 const SkScalar pos[], int scalarsPerPosition, | |
52 const SkPoint& offset, const SkIRect& regionClipBounds) o
verride; | |
53 | |
54 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | |
55 const SkIRect& regionClipBounds); | |
56 void appendGlyph(GrGlyph::PackedID, SkFixed left, SkFixed top, GrFontScaler*
); | |
57 bool uploadGlyph(GrGlyph*, GrFontScaler*); | |
58 void flush(); // automatically called by destructor | |
59 void finish(); | |
60 }; | |
61 | |
62 #endif | |
OLD | NEW |