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