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 "GrAtlasTextBlob.h" | 8 #include "GrAtlasTextBlob.h" |
9 | 9 |
10 #include "GrBlurUtils.h" | 10 #include "GrBlurUtils.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 fViewMatrix = viewMatrix; | 225 fViewMatrix = viewMatrix; |
226 fX = x; | 226 fX = x; |
227 fY = y; | 227 fY = y; |
228 | 228 |
229 // It is possible that a blob has neither distanceField nor bitmaptext. Thi
s is in the case | 229 // It is possible that a blob has neither distanceField nor bitmaptext. Thi
s is in the case |
230 // when all of the runs inside the blob are drawn as paths. In this case, w
e always regenerate | 230 // when all of the runs inside the blob are drawn as paths. In this case, w
e always regenerate |
231 // the blob anyways at flush time, so no need to regenerate explicitly | 231 // the blob anyways at flush time, so no need to regenerate explicitly |
232 return false; | 232 return false; |
233 } | 233 } |
234 | 234 |
235 GrDrawBatch* GrAtlasTextBlob::createBatch(const Run::SubRunInfo& info, | 235 inline GrDrawBatch* GrAtlasTextBlob::createBatch( |
236 int glyphCount, int run, int subRun, | 236 const Run::SubRunInfo& info, |
237 GrColor color, SkScalar transX, SkScal
ar transY, | 237 int glyphCount, int run, int subRu
n, |
238 const SkPaint& skPaint, const SkSurfac
eProps& props, | 238 GrColor color, SkScalar transX, Sk
Scalar transY, |
239 const GrDistanceFieldAdjustTable* dist
anceAdjustTable, | 239 const SkPaint& skPaint, const SkSu
rfaceProps& props, |
240 GrBatchFontCache* cache) { | 240 const GrDistanceFieldAdjustTable*
distanceAdjustTable, |
| 241 GrBatchFontCache* cache) { |
241 GrMaskFormat format = info.maskFormat(); | 242 GrMaskFormat format = info.maskFormat(); |
242 GrColor subRunColor; | 243 GrColor subRunColor; |
243 if (kARGB_GrMaskFormat == format) { | 244 if (kARGB_GrMaskFormat == format) { |
244 uint8_t paintAlpha = skPaint.getAlpha(); | 245 uint8_t paintAlpha = skPaint.getAlpha(); |
245 subRunColor = SkColorSetARGB(paintAlpha, paintAlpha, paintAlpha, paintAl
pha); | 246 subRunColor = SkColorSetARGB(paintAlpha, paintAlpha, paintAlpha, paintAl
pha); |
246 } else { | 247 } else { |
247 subRunColor = color; | 248 subRunColor = color; |
248 } | 249 } |
249 | 250 |
250 GrAtlasTextBatch* batch; | 251 GrAtlasTextBatch* batch; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 GrColor color = grPaint.getColor(); | 406 GrColor color = grPaint.getColor(); |
406 for (int run = 0; run < fRunCount; run++) { | 407 for (int run = 0; run < fRunCount; run++) { |
407 this->flushRun(dc, &pipelineBuilder, run, color, 0, 0, skPaint, props, | 408 this->flushRun(dc, &pipelineBuilder, run, color, 0, 0, skPaint, props, |
408 distanceAdjustTable, context->getBatchFontCache()); | 409 distanceAdjustTable, context->getBatchFontCache()); |
409 } | 410 } |
410 | 411 |
411 // Now flush big glyphs | 412 // Now flush big glyphs |
412 this->flushBigGlyphs(context, dc, clip, skPaint, 0, 0, clipBounds); | 413 this->flushBigGlyphs(context, dc, clip, skPaint, 0, 0, clipBounds); |
413 } | 414 } |
414 | 415 |
| 416 GrDrawBatch* GrAtlasTextBlob::test_createBatch( |
| 417 int glyphCount, int run, int subRu
n, |
| 418 GrColor color, SkScalar transX, Sk
Scalar transY, |
| 419 const SkPaint& skPaint, const SkSu
rfaceProps& props, |
| 420 const GrDistanceFieldAdjustTable*
distanceAdjustTable, |
| 421 GrBatchFontCache* cache) { |
| 422 const GrAtlasTextBlob::Run::SubRunInfo& info = fRuns[0].fSubRunInfo[0]; |
| 423 return this->createBatch(info, glyphCount, 0, 0, color, transX, transY, skPa
int, |
| 424 props, distanceAdjustTable, cache); |
| 425 } |
415 | 426 |
416 // TODO get this code building again | 427 // TODO get this code building again |
417 #ifdef CACHE_SANITY_CHECK | 428 #ifdef CACHE_SANITY_CHECK |
418 void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo
b& r) { | 429 void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo
b& r) { |
419 SkASSERT(l.fSize == r.fSize); | 430 SkASSERT(l.fSize == r.fSize); |
420 SkASSERT(l.fPool == r.fPool); | 431 SkASSERT(l.fPool == r.fPool); |
421 | 432 |
422 SkASSERT(l.fBlurRec.fSigma == r.fBlurRec.fSigma); | 433 SkASSERT(l.fBlurRec.fSigma == r.fBlurRec.fSigma); |
423 SkASSERT(l.fBlurRec.fStyle == r.fBlurRec.fStyle); | 434 SkASSERT(l.fBlurRec.fStyle == r.fBlurRec.fStyle); |
424 SkASSERT(l.fBlurRec.fQuality == r.fBlurRec.fQuality); | 435 SkASSERT(l.fBlurRec.fQuality == r.fBlurRec.fQuality); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); | 518 rSubRun.fBulkUseToken.fPlotAlreadyUpdated); |
508 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { | 519 for (int k = 0; k < lSubRun.fBulkUseToken.fPlotsToUpdate.count(); k+
+) { |
509 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == | 520 SkASSERT(lSubRun.fBulkUseToken.fPlotsToUpdate[k] == |
510 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); | 521 rSubRun.fBulkUseToken.fPlotsToUpdate[k]); |
511 }*/ | 522 }*/ |
512 } | 523 } |
513 } | 524 } |
514 } | 525 } |
515 | 526 |
516 #endif | 527 #endif |
OLD | NEW |