OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrTextUtils_DEFINED | 8 #ifndef GrTextUtils_DEFINED |
9 #define GrTextUtils_DEFINED | 9 #define GrTextUtils_DEFINED |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 * A class to house a bunch of common text utilities. This class should *ONLY*
have static | 31 * A class to house a bunch of common text utilities. This class should *ONLY*
have static |
32 * functions. It is not a namespace only because we wish to friend SkPaint | 32 * functions. It is not a namespace only because we wish to friend SkPaint |
33 * | 33 * |
34 */ | 34 */ |
35 class GrTextUtils { | 35 class GrTextUtils { |
36 public: | 36 public: |
37 // Functions for appending BMP text to GrAtlasTextBlob | 37 // Functions for appending BMP text to GrAtlasTextBlob |
38 static void DrawBmpText(GrAtlasTextBlob*, int runIndex, | 38 static void DrawBmpText(GrAtlasTextBlob*, int runIndex, |
39 GrBatchFontCache*, const SkSurfaceProps&, | 39 GrBatchFontCache*, const SkSurfaceProps&, |
40 const SkPaint&, | 40 const SkPaint&, |
41 GrColor, SkPaint::FakeGamma, const SkMatrix& viewMat
rix, | 41 GrColor, uint32_t scalerContextFlags, const SkMatrix
& viewMatrix, |
42 const char text[], size_t byteLength, | 42 const char text[], size_t byteLength, |
43 SkScalar x, SkScalar y); | 43 SkScalar x, SkScalar y); |
44 | 44 |
45 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, | 45 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, |
46 GrBatchFontCache*, const SkSurfaceProps&, const S
kPaint&, | 46 GrBatchFontCache*, const SkSurfaceProps&, const S
kPaint&, |
47 GrColor, SkPaint::FakeGamma, const SkMatrix& view
Matrix, | 47 GrColor, uint32_t scalerContextFlags, const SkMat
rix& viewMatrix, |
48 const char text[], size_t byteLength, | 48 const char text[], size_t byteLength, |
49 const SkScalar pos[], int scalarsPerPosition, | 49 const SkScalar pos[], int scalarsPerPosition, |
50 const SkPoint& offset); | 50 const SkPoint& offset); |
51 | 51 |
52 // functions for appending distance field text | 52 // functions for appending distance field text |
53 static bool CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix&
viewMatrix, | 53 static bool CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix&
viewMatrix, |
54 const SkSurfaceProps& props, const GrSha
derCaps& caps); | 54 const SkSurfaceProps& props, const GrSha
derCaps& caps); |
55 | 55 |
56 static void DrawDFText(GrAtlasTextBlob* blob, int runIndex, | 56 static void DrawDFText(GrAtlasTextBlob* blob, int runIndex, |
57 GrBatchFontCache*, const SkSurfaceProps&, | 57 GrBatchFontCache*, const SkSurfaceProps&, |
58 const SkPaint& skPaint, GrColor color, SkPaint::FakeG
amma, | 58 const SkPaint& skPaint, GrColor color, uint32_t scale
rContextFlags, |
59 const SkMatrix& viewMatrix, | 59 const SkMatrix& viewMatrix, |
60 const char text[], size_t byteLength, | 60 const char text[], size_t byteLength, |
61 SkScalar x, SkScalar y); | 61 SkScalar x, SkScalar y); |
62 | 62 |
63 static void DrawDFPosText(GrAtlasTextBlob* blob, int runIndex, | 63 static void DrawDFPosText(GrAtlasTextBlob* blob, int runIndex, |
64 GrBatchFontCache*, const SkSurfaceProps&, const Sk
Paint&, | 64 GrBatchFontCache*, const SkSurfaceProps&, const Sk
Paint&, |
65 GrColor color, SkPaint::FakeGamma, const SkMatrix&
viewMatrix, | 65 GrColor color, uint32_t scalerContextFlags, |
| 66 const SkMatrix& viewMatrix, |
66 const char text[], size_t byteLength, | 67 const char text[], size_t byteLength, |
67 const SkScalar pos[], int scalarsPerPosition, | 68 const SkScalar pos[], int scalarsPerPosition, |
68 const SkPoint& offset); | 69 const SkPoint& offset); |
69 | 70 |
70 // Functions for drawing text as paths | 71 // Functions for drawing text as paths |
71 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, | 72 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, |
72 const SkPaint& origPaint, const SkMatrix& viewMat
rix, | 73 const SkPaint& origPaint, const SkMatrix& viewMat
rix, |
73 const char text[], size_t byteLength, SkScalar x,
SkScalar y, | 74 const char text[], size_t byteLength, SkScalar x,
SkScalar y, |
74 const SkIRect& clipBounds); | 75 const SkIRect& clipBounds); |
75 | 76 |
(...skipping 22 matching lines...) Expand all Loading... |
98 GrColor color, GrFontScaler*); | 99 GrColor color, GrFontScaler*); |
99 | 100 |
100 static bool DfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*, | 101 static bool DfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*, |
101 GrBatchTextStrike**, const SkGlyph&, | 102 GrBatchTextStrike**, const SkGlyph&, |
102 SkScalar sx, SkScalar sy, GrColor color, | 103 SkScalar sx, SkScalar sy, GrColor color, |
103 GrFontScaler* scaler, | 104 GrFontScaler* scaler, |
104 SkScalar textRatio, const SkMatrix& viewMatrix); | 105 SkScalar textRatio, const SkMatrix& viewMatrix); |
105 }; | 106 }; |
106 | 107 |
107 #endif | 108 #endif |
OLD | NEW |