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