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 SkColor filteredColor, bool isLCD, | 62 SkColor filteredColor, bool isLCD, |
62 bool useBGR) { | 63 bool useBGR) { |
63 GrAtlasTextBatch* batch = new GrAtlasTextBatch; | 64 GrAtlasTextBatch* batch = new GrAtlasTextBatch; |
64 | 65 |
65 batch->fFontCache = fontCache; | 66 batch->fFontCache = fontCache; |
66 batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistan
ceField_MaskType; | 67 batch->fMaskType = isLCD ? kLCDDistanceField_MaskType : kGrayscaleDistan
ceField_MaskType; |
67 batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable)); | 68 batch->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable)); |
| 69 batch->fUseSRGBDistanceTable = useSRGBDistanceTable; |
68 batch->fFilteredColor = filteredColor; | 70 batch->fFilteredColor = filteredColor; |
69 batch->fUseBGR = useBGR; | 71 batch->fUseBGR = useBGR; |
70 batch->fBatch.fNumGlyphs = glyphCount; | 72 batch->fBatch.fNumGlyphs = glyphCount; |
71 batch->fGeoCount = 1; | 73 batch->fGeoCount = 1; |
72 return batch; | 74 return batch; |
73 } | 75 } |
74 | 76 |
75 // 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 |
76 // 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 |
77 // 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... |
175 kGrayscaleDistanceField_MaskType, | 177 kGrayscaleDistanceField_MaskType, |
176 kLCDDistanceField_MaskType, | 178 kLCDDistanceField_MaskType, |
177 } fMaskType; | 179 } fMaskType; |
178 bool fUseBGR; // fold this into the enum? | 180 bool fUseBGR; // fold this into the enum? |
179 | 181 |
180 GrBatchFontCache* fFontCache; | 182 GrBatchFontCache* fFontCache; |
181 | 183 |
182 // Distance field properties | 184 // Distance field properties |
183 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; | 185 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; |
184 SkColor fFilteredColor; | 186 SkColor fFilteredColor; |
| 187 bool fUseSRGBDistanceTable; |
185 | 188 |
186 friend class GrBlobRegenHelper; // Needs to trigger flushes | 189 friend class GrBlobRegenHelper; // Needs to trigger flushes |
187 | 190 |
188 typedef GrVertexBatch INHERITED; | 191 typedef GrVertexBatch INHERITED; |
189 }; | 192 }; |
190 | 193 |
191 /* | 194 /* |
192 * 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. |
193 * 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 |
194 */ | 197 */ |
(...skipping 12 matching lines...) Expand all Loading... |
207 fFlushInfo->fGlyphsToFlush += glyphCount; | 210 fFlushInfo->fGlyphsToFlush += glyphCount; |
208 } | 211 } |
209 | 212 |
210 private: | 213 private: |
211 const GrAtlasTextBatch* fBatch; | 214 const GrAtlasTextBatch* fBatch; |
212 GrVertexBatch::Target* fTarget; | 215 GrVertexBatch::Target* fTarget; |
213 GrAtlasTextBatch::FlushInfo* fFlushInfo; | 216 GrAtlasTextBatch::FlushInfo* fFlushInfo; |
214 }; | 217 }; |
215 | 218 |
216 #endif | 219 #endif |
OLD | NEW |