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 #include "GrAtlasTextBatch.h" | 8 #include "GrAtlasTextBatch.h" |
9 | 9 |
10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 fGeoData[i].fColor, | 240 fGeoData[i].fColor, |
241 fGeoData[i].fTransX, | 241 fGeoData[i].fTransX, |
242 fGeoData[i].fTransY, | 242 fGeoData[i].fTransY, |
243 fGeoData[i].fBlob->fRunCount); | 243 fGeoData[i].fBlob->fRunCount); |
244 } | 244 } |
245 | 245 |
246 str.append(INHERITED::dumpInfo()); | 246 str.append(INHERITED::dumpInfo()); |
247 return str; | 247 return str; |
248 } | 248 } |
249 | 249 |
250 void GrAtlasTextBatch::getInvariantOutputColor(GrInitInvariantOutput* out) const
{ | 250 void GrAtlasTextBatch::computePipelineOptimizations(GrInitInvariantOutput* color
, |
| 251 GrInitInvariantOutput* cover
age, |
| 252 GrBatchToXPOverrides* overri
des) const { |
251 if (kColorBitmapMask_MaskType == fMaskType) { | 253 if (kColorBitmapMask_MaskType == fMaskType) { |
252 out->setUnknownFourComponents(); | 254 color->setUnknownFourComponents(); |
253 } else { | 255 } else { |
254 out->setKnownFourComponents(fBatch.fColor); | 256 color->setKnownFourComponents(fBatch.fColor); |
| 257 } |
| 258 switch (fMaskType) { |
| 259 case kGrayscaleDistanceField_MaskType: |
| 260 case kGrayscaleCoverageMask_MaskType: |
| 261 coverage->setUnknownSingleComponent(); |
| 262 break; |
| 263 case kLCDCoverageMask_MaskType: |
| 264 case kLCDDistanceField_MaskType: |
| 265 coverage->setUnknownOpaqueFourComponents(); |
| 266 coverage->setUsingLCDCoverage(); |
| 267 break; |
| 268 case kColorBitmapMask_MaskType: |
| 269 coverage->setKnownSingleComponent(0xff); |
255 } | 270 } |
256 } | 271 } |
257 | 272 |
258 void GrAtlasTextBatch::getInvariantOutputCoverage(GrInitInvariantOutput* out) co
nst { | 273 void GrAtlasTextBatch::initBatchTracker(const GrXPOverridesForBatch& overrides)
{ |
259 switch (fMaskType) { | |
260 case kGrayscaleDistanceField_MaskType: | |
261 case kGrayscaleCoverageMask_MaskType: | |
262 out->setUnknownSingleComponent(); | |
263 break; | |
264 case kLCDCoverageMask_MaskType: | |
265 case kLCDDistanceField_MaskType: | |
266 out->setUnknownOpaqueFourComponents(); | |
267 out->setUsingLCDCoverage(); | |
268 break; | |
269 case kColorBitmapMask_MaskType: | |
270 out->setKnownSingleComponent(0xff); | |
271 } | |
272 } | |
273 | |
274 void GrAtlasTextBatch::initBatchTracker(const GrPipelineOptimizations& opt) { | |
275 // Handle any color overrides | 274 // Handle any color overrides |
276 if (!opt.readsColor()) { | 275 if (!overrides.readsColor()) { |
277 fGeoData[0].fColor = GrColor_ILLEGAL; | 276 fGeoData[0].fColor = GrColor_ILLEGAL; |
278 } | 277 } |
279 opt.getOverrideColorIfSet(&fGeoData[0].fColor); | 278 overrides.getOverrideColorIfSet(&fGeoData[0].fColor); |
280 | 279 |
281 // setup batch properties | 280 // setup batch properties |
282 fBatch.fColorIgnored = !opt.readsColor(); | 281 fBatch.fColorIgnored = !overrides.readsColor(); |
283 fBatch.fColor = fGeoData[0].fColor; | 282 fBatch.fColor = fGeoData[0].fColor; |
284 fBatch.fUsesLocalCoords = opt.readsLocalCoords(); | 283 fBatch.fUsesLocalCoords = overrides.readsLocalCoords(); |
285 fBatch.fCoverageIgnored = !opt.readsCoverage(); | 284 fBatch.fCoverageIgnored = !overrides.readsCoverage(); |
286 } | 285 } |
287 | 286 |
288 enum RegenMask { | 287 enum RegenMask { |
289 kNoRegen = 0x0, | 288 kNoRegen = 0x0, |
290 kRegenPos = 0x1, | 289 kRegenPos = 0x1, |
291 kRegenCol = 0x2, | 290 kRegenCol = 0x2, |
292 kRegenTex = 0x4, | 291 kRegenTex = 0x4, |
293 kRegenGlyph = 0x8 | kRegenTex, // we have to regenerate the texture coords w
hen we regen glyphs | 292 kRegenGlyph = 0x8 | kRegenTex, // we have to regenerate the texture coords w
hen we regen glyphs |
294 | 293 |
295 // combinations | 294 // combinations |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 return GrDistanceFieldA8TextGeoProc::Create(color, | 573 return GrDistanceFieldA8TextGeoProc::Create(color, |
575 viewMatrix, | 574 viewMatrix, |
576 texture, | 575 texture, |
577 params, | 576 params, |
578 flags, | 577 flags, |
579 this->usesLocalCoords()); | 578 this->usesLocalCoords()); |
580 #endif | 579 #endif |
581 } | 580 } |
582 | 581 |
583 } | 582 } |
OLD | NEW |