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 GrAtlasTextBatch_DEFINED | 8 #ifndef GrAtlasTextBatch_DEFINED |
9 #define GrAtlasTextBatch_DEFINED | 9 #define GrAtlasTextBatch_DEFINED |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 batch->fGeoCount = 1; | 51 batch->fGeoCount = 1; |
52 batch->fFilteredColor = 0; | 52 batch->fFilteredColor = 0; |
53 batch->fFontCache = fontCache; | 53 batch->fFontCache = fontCache; |
54 batch->fUseBGR = false; | 54 batch->fUseBGR = false; |
55 return batch; | 55 return batch; |
56 } | 56 } |
57 | 57 |
58 static GrAtlasTextBatch* CreateDistanceField( | 58 static GrAtlasTextBatch* CreateDistanceField( |
59 int glyphCount, GrBatchFontCache*
fontCache, | 59 int glyphCount, GrBatchFontCache*
fontCache, |
60 const GrDistanceFieldAdjustTable*
distanceAdjustTable, | 60 const GrDistanceFieldAdjustTable*
distanceAdjustTable, |
61 bool useSRGBDistanceTable, | 61 bool useGammaCorrectDistanceTable, |
62 SkColor filteredColor, bool isLCD, | 62 SkColor filteredColor, bool isLCD, |
63 bool useBGR) { | 63 bool useBGR) { |
64 GrAtlasTextBatch* batch = new GrAtlasTextBatch; | 64 GrAtlasTextBatch* batch = new GrAtlasTextBatch; |
65 | 65 |
66 batch->fFontCache = fontCache; | 66 batch->fFontCache = fontCache; |
67 batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistan
ceField_MaskType; | 67 batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistan
ceField_MaskType; |
68 batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable)); | 68 batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable)); |
69 batch->fUseSRGBDistanceTable = useSRGBDistanceTable; | 69 batch->fUseGammaCorrectDistanceTable = useGammaCorrectDistanceTable; |
70 batch->fFilteredColor = filteredColor; | 70 batch->fFilteredColor = filteredColor; |
71 batch->fUseBGR = useBGR; | 71 batch->fUseBGR = useBGR; |
72 batch->fBatch.fNumGlyphs = glyphCount; | 72 batch->fBatch.fNumGlyphs = glyphCount; |
73 batch->fGeoCount = 1; | 73 batch->fGeoCount = 1; |
74 return batch; | 74 return batch; |
75 } | 75 } |
76 | 76 |
77 // to avoid even the initial copy of the struct, we have a getter for the fi
rst item which | 77 // to avoid even the initial copy of the struct, we have a getter for the fi
rst item which |
78 // is used to seed the batch with its initial geometry. After seeding, the
client should call | 78 // is used to seed the batch with its initial geometry. After seeding, the
client should call |
79 // init() so the Batch can initialize itself | 79 // init() so the Batch can initialize itself |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 kGrayscaleDistanceField_MaskType, | 177 kGrayscaleDistanceField_MaskType, |
178 kLCDDistanceField_MaskType, | 178 kLCDDistanceField_MaskType, |
179 } fMaskType; | 179 } fMaskType; |
180 bool fUseBGR; // fold this into the enum? | 180 bool fUseBGR; // fold this into the enum? |
181 | 181 |
182 GrBatchFontCache* fFontCache; | 182 GrBatchFontCache* fFontCache; |
183 | 183 |
184 // Distance field properties | 184 // Distance field properties |
185 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; | 185 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; |
186 SkColor fFilteredColor; | 186 SkColor fFilteredColor; |
187 bool fUseSRGBDistanceTable; | 187 bool fUseGammaCorrectDistanceTable; |
188 | 188 |
189 friend class GrBlobRegenHelper; // Needs to trigger flushes | 189 friend class GrBlobRegenHelper; // Needs to trigger flushes |
190 | 190 |
191 typedef GrVertexBatch INHERITED; | 191 typedef GrVertexBatch INHERITED; |
192 }; | 192 }; |
193 | 193 |
194 /* | 194 /* |
195 * A simple helper class to abstract the interface GrAtlasTextBlob needs to rege
nerate itself. | 195 * A simple helper class to abstract the interface GrAtlasTextBlob needs to rege
nerate itself. |
196 * It'd be nicer if this was nested, but we need to forward declare it in GrAtla
sTextBlob.h | 196 * It'd be nicer if this was nested, but we need to forward declare it in GrAtla
sTextBlob.h |
197 */ | 197 */ |
(...skipping 12 matching lines...) Expand all Loading... |
210 fFlushInfo->fGlyphsToFlush += glyphCount; | 210 fFlushInfo->fGlyphsToFlush += glyphCount; |
211 } | 211 } |
212 | 212 |
213 private: | 213 private: |
214 const GrAtlasTextBatch* fBatch; | 214 const GrAtlasTextBatch* fBatch; |
215 GrVertexBatch::Target* fTarget; | 215 GrVertexBatch::Target* fTarget; |
216 GrAtlasTextBatch::FlushInfo* fFlushInfo; | 216 GrAtlasTextBatch::FlushInfo* fFlushInfo; |
217 }; | 217 }; |
218 | 218 |
219 #endif | 219 #endif |
OLD | NEW |