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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 const GrDistanceFieldAdjustTable* distanceAdju
stTable, | 412 const GrDistanceFieldAdjustTable* distanceAdju
stTable, |
413 const SkPaint& skPaint, | 413 const SkPaint& skPaint, |
414 const GrPaint& grPaint, | 414 const GrPaint& grPaint, |
415 SkDrawFilter* drawFilter, | 415 SkDrawFilter* drawFilter, |
416 const GrClip& clip, | 416 const GrClip& clip, |
417 const SkMatrix& viewMatrix, | 417 const SkMatrix& viewMatrix, |
418 const SkIRect& clipBounds, | 418 const SkIRect& clipBounds, |
419 SkScalar x, SkScalar y) { | 419 SkScalar x, SkScalar y) { |
420 // We loop through the runs of the blob, flushing each. If any run is too l
arge, then we flush | 420 // We loop through the runs of the blob, flushing each. If any run is too l
arge, then we flush |
421 // it as paths | 421 // it as paths |
422 GrPipelineBuilder pipelineBuilder(grPaint, dc->accessRenderTarget()); | 422 GrPipelineBuilder pipelineBuilder(grPaint, dc->isUnifiedMultisampled()); |
| 423 pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); |
423 | 424 |
424 GrColor color = grPaint.getColor(); | 425 GrColor color = grPaint.getColor(); |
425 | 426 |
426 SkTextBlobRunIterator it(blob); | 427 SkTextBlobRunIterator it(blob); |
427 for (int run = 0; !it.done(); it.next(), run++) { | 428 for (int run = 0; !it.done(); it.next(), run++) { |
428 if (fRuns[run].fDrawAsPaths) { | 429 if (fRuns[run].fDrawAsPaths) { |
429 this->flushRunAsPaths(context, dc, props, it, clip, skPaint, | 430 this->flushRunAsPaths(context, dc, props, it, clip, skPaint, |
430 drawFilter, viewMatrix, clipBounds, x, y); | 431 drawFilter, viewMatrix, clipBounds, x, y); |
431 continue; | 432 continue; |
432 } | 433 } |
433 this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color,
skPaint, props, | 434 this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color,
skPaint, props, |
434 distanceAdjustTable, context->getBatchFontCache()); | 435 distanceAdjustTable, context->getBatchFontCache()); |
435 } | 436 } |
436 | 437 |
437 // Now flush big glyphs | 438 // Now flush big glyphs |
438 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound
s); | 439 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound
s); |
439 } | 440 } |
440 | 441 |
441 void GrAtlasTextBlob::flushThrowaway(GrContext* context, | 442 void GrAtlasTextBlob::flushThrowaway(GrContext* context, |
442 GrDrawContext* dc, | 443 GrDrawContext* dc, |
443 const SkSurfaceProps& props, | 444 const SkSurfaceProps& props, |
444 const GrDistanceFieldAdjustTable* distanceA
djustTable, | 445 const GrDistanceFieldAdjustTable* distanceA
djustTable, |
445 const SkPaint& skPaint, | 446 const SkPaint& skPaint, |
446 const GrPaint& grPaint, | 447 const GrPaint& grPaint, |
447 const GrClip& clip, | 448 const GrClip& clip, |
448 const SkMatrix& viewMatrix, | 449 const SkMatrix& viewMatrix, |
449 const SkIRect& clipBounds, | 450 const SkIRect& clipBounds, |
450 SkScalar x, SkScalar y) { | 451 SkScalar x, SkScalar y) { |
451 GrPipelineBuilder pipelineBuilder(grPaint, dc->accessRenderTarget()); | 452 GrPipelineBuilder pipelineBuilder(grPaint, dc->isUnifiedMultisampled()); |
| 453 pipelineBuilder.setRenderTarget(dc->accessRenderTarget()); |
452 | 454 |
453 GrColor color = grPaint.getColor(); | 455 GrColor color = grPaint.getColor(); |
454 for (int run = 0; run < fRunCount; run++) { | 456 for (int run = 0; run < fRunCount; run++) { |
455 this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color,
skPaint, props, | 457 this->flushRun(dc, &pipelineBuilder, clip, run, viewMatrix, x, y, color,
skPaint, props, |
456 distanceAdjustTable, context->getBatchFontCache()); | 458 distanceAdjustTable, context->getBatchFontCache()); |
457 } | 459 } |
458 | 460 |
459 // Now flush big glyphs | 461 // Now flush big glyphs |
460 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound
s); | 462 this->flushBigGlyphs(context, dc, clip, skPaint, viewMatrix, x, y, clipBound
s); |
461 } | 463 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 562 |
561 void GrAtlasTextBlob::Run::SubRunInfo::computeTranslation(const SkMatrix& viewMa
trix, | 563 void GrAtlasTextBlob::Run::SubRunInfo::computeTranslation(const SkMatrix& viewMa
trix, |
562 SkScalar x, SkScalar y
, SkScalar* transX, | 564 SkScalar x, SkScalar y
, SkScalar* transX, |
563 SkScalar* transY) { | 565 SkScalar* transY) { |
564 calculate_translation(!this->drawAsDistanceFields(), viewMatrix, x, y, | 566 calculate_translation(!this->drawAsDistanceFields(), viewMatrix, x, y, |
565 fCurrentViewMatrix, fX, fY, transX, transY); | 567 fCurrentViewMatrix, fX, fY, transX, transY); |
566 fCurrentViewMatrix = viewMatrix; | 568 fCurrentViewMatrix = viewMatrix; |
567 fX = x; | 569 fX = x; |
568 fY = y; | 570 fY = y; |
569 } | 571 } |
OLD | NEW |