Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/gpu/text/GrTextUtils.h

Issue 1521633002: Move distance field text positioning into GrTextUtils (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext15
Patch Set: tweaks Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/text/GrAtlasTextContext.cpp ('k') | src/gpu/text/GrTextUtils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrColor.h"
12 #include "SkScalar.h" 12 #include "SkScalar.h"
13 13
14 class GrAtlasTextBlob; 14 class GrAtlasTextBlob;
15 class GrBatchFontCache; 15 class GrBatchFontCache;
16 class GrBatchTextStrike; 16 class GrBatchTextStrike;
17 class GrClip; 17 class GrClip;
18 class GrContext; 18 class GrContext;
19 class GrDrawContext; 19 class GrDrawContext;
20 class GrFontScaler; 20 class GrFontScaler;
21 class GrShaderCaps;
21 class SkGlyph; 22 class SkGlyph;
22 class SkMatrix; 23 class SkMatrix;
23 struct SkIRect; 24 struct SkIRect;
24 class SkPaint; 25 class SkPaint;
25 struct SkPoint; 26 struct SkPoint;
26 class SkGlyphCache; 27 class SkGlyphCache;
27 class SkSurfaceProps; 28 class SkSurfaceProps;
28 29
29 /* 30 /*
30 * 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
(...skipping 10 matching lines...) Expand all
41 const char text[], size_t byteLength, 42 const char text[], size_t byteLength,
42 SkScalar x, SkScalar y); 43 SkScalar x, SkScalar y);
43 44
44 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, 45 static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex,
45 GrBatchFontCache*, const SkSurfaceProps&, const S kPaint&, 46 GrBatchFontCache*, const SkSurfaceProps&, const S kPaint&,
46 GrColor, const SkMatrix& viewMatrix, 47 GrColor, const SkMatrix& viewMatrix,
47 const char text[], size_t byteLength, 48 const char text[], size_t byteLength,
48 const SkScalar pos[], int scalarsPerPosition, 49 const SkScalar pos[], int scalarsPerPosition,
49 const SkPoint& offset); 50 const SkPoint& offset);
50 51
52 // functions for appending distance field text
53 static bool CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix,
54 const SkSurfaceProps& props, const GrSha derCaps& caps);
55
56 static void DrawDFText(GrAtlasTextBlob* blob, int runIndex,
57 GrBatchFontCache*, const SkSurfaceProps&,
58 const SkPaint& skPaint, GrColor color,
59 const SkMatrix& viewMatrix,
60 const char text[], size_t byteLength,
61 SkScalar x, SkScalar y);
62
63 static void DrawDFPosText(GrAtlasTextBlob* blob, int runIndex,
64 GrBatchFontCache*, const SkSurfaceProps&, const Sk Paint&,
65 GrColor color, const SkMatrix& viewMatrix,
66 const char text[], size_t byteLength,
67 const SkScalar pos[], int scalarsPerPosition,
68 const SkPoint& offset);
69
51 // Functions for drawing text as paths 70 // Functions for drawing text as paths
52 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, 71 static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip,
53 const SkPaint& origPaint, const SkMatrix& viewMat rix, 72 const SkPaint& origPaint, const SkMatrix& viewMat rix,
54 const char text[], size_t byteLength, SkScalar x, SkScalar y, 73 const char text[], size_t byteLength, SkScalar x, SkScalar y,
55 const SkIRect& clipBounds); 74 const SkIRect& clipBounds);
56 75
57 static void DrawPosTextAsPath(GrContext* context, 76 static void DrawPosTextAsPath(GrContext* context,
58 GrDrawContext* dc, 77 GrDrawContext* dc,
59 const SkSurfaceProps& props, 78 const SkSurfaceProps& props,
60 const GrClip& clip, 79 const GrClip& clip,
61 const SkPaint& origPaint, const SkMatrix& view Matrix, 80 const SkPaint& origPaint, const SkMatrix& view Matrix,
62 const char text[], size_t byteLength, 81 const char text[], size_t byteLength,
63 const SkScalar pos[], int scalarsPerPosition, 82 const SkScalar pos[], int scalarsPerPosition,
64 const SkPoint& offset, const SkIRect& clipBoun ds); 83 const SkPoint& offset, const SkIRect& clipBoun ds);
65 private: 84 private:
85 static void InitDistanceFieldPaint(GrAtlasTextBlob* blob,
86 SkPaint* skPaint,
87 SkScalar* textRatio,
88 const SkMatrix& viewMatrix);
89
66 static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache* , 90 static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache* ,
67 GrBatchTextStrike**, const SkGlyph&, int left, in t top, 91 GrBatchTextStrike**, const SkGlyph&, int left, in t top,
68 GrColor color, GrFontScaler*); 92 GrColor color, GrFontScaler*);
93
94 static bool DfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*,
95 GrBatchTextStrike**, const SkGlyph&,
96 SkScalar sx, SkScalar sy, GrColor color,
97 GrFontScaler* scaler,
98 SkScalar textRatio, const SkMatrix& viewMatrix);
69 }; 99 };
70 100
71 #endif 101 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextContext.cpp ('k') | src/gpu/text/GrTextUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698