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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 /* | 29 /* |
30 * A class to house a bunch of common text utilities. This class should *ONLY*
have static | 30 * A class to house a bunch of common text utilities. This class should *ONLY*
have static |
31 * functions. It is not a namespace only because we wish to friend SkPaint | 31 * functions. It is not a namespace only because we wish to friend SkPaint |
32 * | 32 * |
33 */ | 33 */ |
34 class GrTextUtils { | 34 class GrTextUtils { |
35 public: | 35 public: |
36 // Functions for appending BMP text to GrAtlasTextBlob | 36 // Functions for appending BMP text to GrAtlasTextBlob |
37 static void DrawBmpText(GrAtlasTextBlob*, int runIndex, | 37 static void DrawBmpText(GrAtlasTextBlob*, int runIndex, |
38 GrBatchFontCache*, const SkSurfaceProps&, | 38 GrBatchFontCache*, SkGlyphCache*, const SkPaint&, |
39 const SkPaint&, | |
40 GrColor, const SkMatrix& viewMatrix, | 39 GrColor, const SkMatrix& viewMatrix, |
41 const char text[], size_t byteLength, | 40 const char text[], size_t byteLength, |
42 SkScalar x, SkScalar y); | 41 SkScalar x, SkScalar y); |
43 | 42 |
44 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, | 43 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, |
45 GrBatchFontCache*, const SkSurfaceProps&, const S
kPaint&, | 44 GrBatchFontCache*, SkGlyphCache*, const SkPaint&, |
46 GrColor, const SkMatrix& viewMatrix, | 45 GrColor, const SkMatrix& viewMatrix, |
47 const char text[], size_t byteLength, | 46 const char text[], size_t byteLength, |
48 const SkScalar pos[], int scalarsPerPosition, | 47 const SkScalar pos[], int scalarsPerPosition, |
49 const SkPoint& offset); | 48 const SkPoint& offset); |
50 | 49 |
51 // Functions for drawing text as paths | 50 // Functions for drawing text as paths |
52 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, | 51 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, |
53 const SkPaint& origPaint, const SkMatrix& viewMat
rix, | 52 const SkPaint& origPaint, const SkMatrix& viewMat
rix, |
54 const char text[], size_t byteLength, SkScalar x,
SkScalar y, | 53 const char text[], size_t byteLength, SkScalar x,
SkScalar y, |
55 const SkIRect& clipBounds); | 54 const SkIRect& clipBounds); |
56 | 55 |
57 static void DrawPosTextAsPath(GrContext* context, | 56 static void DrawPosTextAsPath(GrContext* context, |
58 GrDrawContext* dc, | 57 GrDrawContext* dc, |
59 const SkSurfaceProps& props, | 58 const SkSurfaceProps& props, |
60 const GrClip& clip, | 59 const GrClip& clip, |
61 const SkPaint& origPaint, const SkMatrix& view
Matrix, | 60 const SkPaint& origPaint, const SkMatrix& view
Matrix, |
62 const char text[], size_t byteLength, | 61 const char text[], size_t byteLength, |
63 const SkScalar pos[], int scalarsPerPosition, | 62 const SkScalar pos[], int scalarsPerPosition, |
64 const SkPoint& offset, const SkIRect& clipBoun
ds); | 63 const SkPoint& offset, const SkIRect& clipBoun
ds); |
65 private: | 64 private: |
66 static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*
, | 65 static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*
, |
67 GrBatchTextStrike**, const SkGlyph&, int left, in
t top, | 66 GrBatchTextStrike**, const SkGlyph&, int left, in
t top, |
68 GrColor color, GrFontScaler*); | 67 GrColor color, GrFontScaler*); |
69 }; | 68 }; |
70 | 69 |
71 #endif | 70 #endif |
OLD | NEW |