| 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 |
| 11 #include "GrColor.h" |
| 11 #include "SkScalar.h" | 12 #include "SkScalar.h" |
| 12 | 13 |
| 14 class GrAtlasTextBlob; |
| 15 class GrBatchFontCache; |
| 16 class GrBatchTextStrike; |
| 13 class GrClip; | 17 class GrClip; |
| 14 class GrContext; | 18 class GrContext; |
| 15 class GrDrawContext; | 19 class GrDrawContext; |
| 20 class GrFontScaler; |
| 21 class SkGlyph; |
| 16 class SkMatrix; | 22 class SkMatrix; |
| 17 struct SkIRect; | 23 struct SkIRect; |
| 18 class SkPaint; | 24 class SkPaint; |
| 19 struct SkPoint; | 25 struct SkPoint; |
| 26 class SkGlyphCache; |
| 20 class SkSurfaceProps; | 27 class SkSurfaceProps; |
| 21 | 28 |
| 22 /* | 29 /* |
| 23 * 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 |
| 24 * 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 |
| 25 * | 32 * |
| 26 */ | 33 */ |
| 27 class GrTextUtils { | 34 class GrTextUtils { |
| 28 public: | 35 public: |
| 36 // Functions for appending BMP text to GrAtlasTextBlob |
| 37 static void DrawBmpText(GrAtlasTextBlob*, int runIndex, |
| 38 GrBatchFontCache*, SkGlyphCache*, const SkPaint&, |
| 39 GrColor, const SkMatrix& viewMatrix, |
| 40 const char text[], size_t byteLength, |
| 41 SkScalar x, SkScalar y); |
| 29 | 42 |
| 30 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, | 43 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, |
| 31 const SkPaint& origPaint, const SkMatrix& viewMatrix, | 44 GrBatchFontCache*, SkGlyphCache*, const SkPaint&, |
| 32 const char text[], size_t byteLength, SkScalar x, SkS
calar y, | 45 GrColor, const SkMatrix& viewMatrix, |
| 33 const SkIRect& clipBounds); | 46 const char text[], size_t byteLength, |
| 47 const SkScalar pos[], int scalarsPerPosition, |
| 48 const SkPoint& offset); |
| 34 | 49 |
| 35 static void DrawPosTextAsPath(GrContext* context, | 50 // Functions for drawing text as paths |
| 36 GrDrawContext* dc, | 51 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, |
| 37 const SkSurfaceProps& props, | 52 const SkPaint& origPaint, const SkMatrix& viewMat
rix, |
| 38 const GrClip& clip, | 53 const char text[], size_t byteLength, SkScalar x,
SkScalar y, |
| 39 const SkPaint& origPaint, const SkMatrix& viewMatr
ix, | 54 const SkIRect& clipBounds); |
| 40 const char text[], size_t byteLength, | 55 |
| 41 const SkScalar pos[], int scalarsPerPosition, | 56 static void DrawPosTextAsPath(GrContext* context, |
| 42 const SkPoint& offset, const SkIRect& clipBounds); | 57 GrDrawContext* dc, |
| 58 const SkSurfaceProps& props, |
| 59 const GrClip& clip, |
| 60 const SkPaint& origPaint, const SkMatrix& view
Matrix, |
| 61 const char text[], size_t byteLength, |
| 62 const SkScalar pos[], int scalarsPerPosition, |
| 63 const SkPoint& offset, const SkIRect& clipBoun
ds); |
| 64 private: |
| 65 static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*
, |
| 66 GrBatchTextStrike**, const SkGlyph&, int left, in
t top, |
| 67 GrColor color, GrFontScaler*); |
| 43 }; | 68 }; |
| 44 | 69 |
| 45 #endif | 70 #endif |
| OLD | NEW |