OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2010 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 GrTextContext_DEFINED | |
9 #define GrTextContext_DEFINED | |
10 | |
11 #include "GrClip.h" | |
12 #include "GrGlyph.h" | |
13 #include "GrPaint.h" | |
14 #include "SkSurfaceProps.h" | |
15 #include "SkPostConfig.h" | |
16 | |
17 class GrClip; | |
18 class GrContext; | |
19 class GrDrawContext; | |
20 class GrFontScaler; | |
21 class SkDrawFilter; | |
22 class SkTextBlob; | |
23 | |
24 /* | |
25 * This class wraps the state for a single text render | |
26 */ | |
27 class GrTextContext { | |
28 public: | |
29 virtual ~GrTextContext() {} | |
30 | |
31 virtual void drawText(GrContext*, GrDrawContext* dc, | |
32 const GrClip&, const GrPaint&, const SkPaint&, | |
33 const SkMatrix& viewMatrix, | |
34 const SkSurfaceProps& props, const char text[], size_t
byteLength, | |
35 SkScalar x, SkScalar y, const SkIRect& clipBounds) = 0
; | |
36 virtual void drawPosText(GrContext*, GrDrawContext* dc, | |
37 const GrClip&, const GrPaint&, const SkPaint&, | |
38 const SkMatrix& viewMatrix, | |
39 const SkSurfaceProps& props, | |
40 const char text[], size_t byteLength, | |
41 const SkScalar pos[], int scalarsPerPosition, | |
42 const SkPoint& offset, const SkIRect& clipBounds) =
0; | |
43 virtual void drawTextBlob(GrContext*, GrDrawContext* dc, const GrClip&, | |
44 const SkPaint&, const SkMatrix& viewMatrix, | |
45 const SkSurfaceProps& props, const SkTextBlob*, | |
46 SkScalar x, SkScalar y, | |
47 SkDrawFilter*, const SkIRect& clipBounds) = 0; | |
48 | |
49 static bool ShouldDisableLCD(const SkPaint& paint); | |
50 | |
51 protected: | |
52 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | |
53 static uint32_t FilterTextFlags(const SkSurfaceProps& surfaceProps, const Sk
Paint& paint); | |
54 | |
55 friend class GrAtlasTextBatch; | |
56 friend class GrAtlasTextBlob; // for FilterTextFlags | |
57 friend class GrTextUtils; // for some static functions | |
58 }; | |
59 | |
60 #endif | |
OLD | NEW |