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

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

Issue 1519083002: A change to cleanup some organization around df text (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext12textutilsdftext
Patch Set: Created 5 years 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 | « no previous file | src/gpu/text/GrAtlasTextContext.cpp » ('j') | src/gpu/text/GrAtlasTextContext.cpp » ('J')
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 GrAtlasTextContext_DEFINED 8 #ifndef GrAtlasTextContext_DEFINED
9 #define GrAtlasTextContext_DEFINED 9 #define GrAtlasTextContext_DEFINED
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 const SkMatrix& viewMatrix, SkPaint* dfPaint, 59 const SkMatrix& viewMatrix, SkPaint* dfPaint,
60 SkScalar* textRatio); 60 SkScalar* textRatio);
61 void bmpAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, int left , int top, 61 void bmpAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, int left , int top,
62 GrColor color, GrFontScaler*); 62 GrColor color, GrFontScaler*);
63 bool dfAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, SkScalar sx, SkScalar sy, 63 bool dfAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, SkScalar sx, SkScalar sy,
64 GrColor color, GrFontScaler*, SkScalar textRatio, 64 GrColor color, GrFontScaler*, SkScalar textRatio,
65 const SkMatrix& viewMatrix); 65 const SkMatrix& viewMatrix);
66 66
67 // A helper for drawing BitmapText in a run of distance fields 67 // A helper for drawing BitmapText in a run of distance fields
68 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex, 68 inline void fallbackDrawPosText(GrAtlasTextBlob*, int runIndex,
69 const GrClip&, GrColor color, 69 GrColor color,
70 const SkPaint&, const SkMatrix& viewMatrix, 70 const SkPaint&, const SkMatrix& viewMatrix,
71 const SkTDArray<char>& fallbackTxt, 71 const SkTDArray<char>& fallbackTxt,
72 const SkTDArray<SkScalar>& fallbackPos, 72 const SkTDArray<SkScalar>& fallbackPos,
73 int scalarsPerPosition, 73 int scalarsPerPosition,
74 const SkPoint& offset); 74 const SkPoint& offset);
75 75
76 void internalDrawDFText(GrAtlasTextBlob*, int runIndex, const SkPaint&, 76 void internalDrawDFText(GrAtlasTextBlob*, int runIndex,
77 SkGlyphCache*, const SkPaint&,
77 GrColor color, const SkMatrix& viewMatrix, 78 GrColor color, const SkMatrix& viewMatrix,
78 const char text[], size_t byteLength, 79 const char text[], size_t byteLength,
79 SkScalar x, SkScalar y, 80 SkScalar x, SkScalar y,
80 SkScalar textRatio, 81 SkScalar textRatio, const SkPaint& origPaint);
81 SkTDArray<char>* fallbackTxt, 82 void internalDrawDFPosText(GrAtlasTextBlob*, int runIndex,
82 SkTDArray<SkScalar>* fallbackPos, 83 SkGlyphCache*, const SkPaint&,
83 SkPoint* offset, const SkPaint& origPaint);
84 void internalDrawDFPosText(GrAtlasTextBlob*, int runIndex, const SkPaint&,
85 GrColor color, const SkMatrix& viewMatrix, 84 GrColor color, const SkMatrix& viewMatrix,
86 const char text[], size_t byteLength, 85 const char text[], size_t byteLength,
87 const SkScalar pos[], int scalarsPerPosition, 86 const SkScalar pos[], int scalarsPerPosition,
88 const SkPoint& offset, 87 const SkPoint& offset,
89 SkScalar textRatio, 88 SkScalar textRatio,
90 SkTDArray<char>* fallbackTxt, 89 const SkPaint& origPaint);
91 SkTDArray<SkScalar>* fallbackPos);
92 90
93 // sets up the descriptor on the blob and returns a detached cache. Client must attach 91 // sets up the descriptor on the blob and returns a detached cache. Client must attach
94 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); 92 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd);
95 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa trix, bool noGamma); 93 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix* viewMa trix, bool noGamma);
96 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r, 94 void regenerateTextBlob(GrAtlasTextBlob* bmp, const SkPaint& skPaint, GrColo r,
97 const SkMatrix& viewMatrix, 95 const SkMatrix& viewMatrix,
98 const SkTextBlob* blob, SkScalar x, SkScalar y, 96 const SkTextBlob* blob, SkScalar x, SkScalar y,
99 SkDrawFilter* drawFilter, 97 SkDrawFilter* drawFilter,
100 const GrClip&); 98 const GrClip&);
101 inline static bool HasLCD(const SkTextBlob*); 99 inline static bool HasLCD(const SkTextBlob*);
102 inline void initDistanceFieldPaint(GrAtlasTextBlob*, SkPaint*, SkScalar* tex tRatio, 100 inline void initDistanceFieldPaint(GrAtlasTextBlob*, SkPaint*, SkScalar* tex tRatio,
103 const SkMatrix&); 101 const SkMatrix&);
104 102
105 // Test methods 103 // Test methods
106 // TODO this is really ugly. It'd be much nicer if positioning could be mov ed to batch 104 // TODO this is really ugly. It'd be much nicer if positioning could be mov ed to batch
107 inline GrAtlasTextBlob* createDrawTextBlob(const GrClip&, const GrPaint&, 105 inline GrAtlasTextBlob* createDrawTextBlob(const GrPaint&,
108 const SkPaint&, const SkMatrix& v iewMatrix, 106 const SkPaint&, const SkMatrix& v iewMatrix,
109 const char text[], size_t byteLen gth, 107 const char text[], size_t byteLen gth,
110 SkScalar x, SkScalar y, 108 SkScalar x, SkScalar y);
111 const SkIRect& regionClipBounds); 109 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrPaint&,
112 inline GrAtlasTextBlob* createDrawPosTextBlob(const GrClip&, const GrPaint&,
113 const SkPaint&, const SkMatrix & viewMatrix, 110 const SkPaint&, const SkMatrix & viewMatrix,
114 const char text[], size_t byte Length, 111 const char text[], size_t byte Length,
115 const SkScalar pos[], int scal arsPerPosition, 112 const SkScalar pos[], int scal arsPerPosition,
116 const SkPoint& offset, 113 const SkPoint& offset);
117 const SkIRect& regionClipBound s);
118 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; } 114 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd justTable; }
119 115
120 GrBatchTextStrike* fCurrStrike; 116 GrBatchTextStrike* fCurrStrike;
121 GrTextBlobCache* fCache; 117 GrTextBlobCache* fCache;
122 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; 118 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable;
123 119
124 #ifdef GR_TEST_UTILS 120 #ifdef GR_TEST_UTILS
125 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); 121 DRAW_BATCH_TEST_FRIEND(TextBlobBatch);
126 #endif 122 #endif
127 123
128 typedef GrTextContext INHERITED; 124 typedef GrTextContext INHERITED;
129 }; 125 };
130 126
131 #endif 127 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/text/GrAtlasTextContext.cpp » ('j') | src/gpu/text/GrAtlasTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698