OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrAADistanceFieldPathRenderer.h" | 8 #include "GrAADistanceFieldPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 SkSTArray<1, Geometry, true> fGeoData; | 521 SkSTArray<1, Geometry, true> fGeoData; |
522 GrBatchAtlas* fAtlas; | 522 GrBatchAtlas* fAtlas; |
523 PathCache* fPathCache; | 523 PathCache* fPathCache; |
524 PathDataList* fPathList; | 524 PathDataList* fPathList; |
525 bool fGammaCorrect; | 525 bool fGammaCorrect; |
526 | 526 |
527 typedef GrVertexBatch INHERITED; | 527 typedef GrVertexBatch INHERITED; |
528 }; | 528 }; |
529 | 529 |
530 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { | 530 bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) { |
531 GR_AUDIT_TRAIL_AUTO_FRAME(args.fTarget->getAuditTrail(), | 531 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
532 "GrAADistanceFieldPathRenderer::onDrawPath"); | 532 "GrAADistanceFieldPathRenderer::onDrawPath"); |
533 // we've already bailed on inverse filled paths, so this is safe | 533 // we've already bailed on inverse filled paths, so this is safe |
534 if (args.fPath->isEmpty()) { | 534 if (args.fPath->isEmpty()) { |
535 return true; | 535 return true; |
536 } | 536 } |
537 | 537 |
538 if (!fAtlas) { | 538 if (!fAtlas) { |
539 fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig, | 539 fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig, |
540 ATLAS_TEXTURE_WIDTH, ATLAS_
TEXTURE_HEIGHT, | 540 ATLAS_TEXTURE_WIDTH, ATLAS_
TEXTURE_HEIGHT, |
541 NUM_PLOTS_X, NUM_PLOTS_Y, | 541 NUM_PLOTS_X, NUM_PLOTS_Y, |
(...skipping 15 matching lines...) Expand all Loading... |
557 geometry.fAntiAlias = args.fAntiAlias; | 557 geometry.fAntiAlias = args.fAntiAlias; |
558 // Note: this is the generation ID of the _original_ path. When a new path i
s | 558 // Note: this is the generation ID of the _original_ path. When a new path i
s |
559 // generated due to stroking it is important that the original path's id is
used | 559 // generated due to stroking it is important that the original path's id is
used |
560 // for caching. | 560 // for caching. |
561 geometry.fGenID = args.fPath->getGenerationID(); | 561 geometry.fGenID = args.fPath->getGenerationID(); |
562 | 562 |
563 SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry, | 563 SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry, |
564 *args.fView
Matrix, fAtlas, | 564 *args.fView
Matrix, fAtlas, |
565 &fPathCache
, &fPathList, | 565 &fPathCache
, &fPathList, |
566 args.fGamma
Correct)); | 566 args.fGamma
Correct)); |
567 args.fTarget->drawBatch(*args.fPipelineBuilder, *args.fClip, batch); | 567 |
| 568 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnified
Multisampled()); |
| 569 pipelineBuilder.setRenderTarget(args.fDrawContext->accessRenderTarget()); |
| 570 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 571 |
| 572 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
568 | 573 |
569 return true; | 574 return true; |
570 } | 575 } |
571 | 576 |
572 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 577 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
573 | 578 |
574 #ifdef GR_TEST_UTILS | 579 #ifdef GR_TEST_UTILS |
575 | 580 |
576 struct PathTestStruct { | 581 struct PathTestStruct { |
577 typedef GrAADistanceFieldPathRenderer::PathCache PathCache; | 582 typedef GrAADistanceFieldPathRenderer::PathCache PathCache; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 geometry.fGenID = random->nextU(); | 645 geometry.fGenID = random->nextU(); |
641 | 646 |
642 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, | 647 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, |
643 gTestStruct.fAtlas, | 648 gTestStruct.fAtlas, |
644 &gTestStruct.fPathCache, | 649 &gTestStruct.fPathCache, |
645 &gTestStruct.fPathList, | 650 &gTestStruct.fPathList, |
646 gammaCorrect); | 651 gammaCorrect); |
647 } | 652 } |
648 | 653 |
649 #endif | 654 #endif |
OLD | NEW |