| 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.fDrawContext->auditTrail(), | 531 GR_AUDIT_TRAIL_AUTO_FRAME(args.fDrawContext->auditTrail(), |
| 532 "GrAADistanceFieldPathRenderer::onDrawPath"); | 532 "GrAADistanceFieldPathRenderer::onDrawPath"); |
| 533 SkASSERT(!args.fDrawContext->isUnifiedMultisampled()); |
| 534 |
| 533 // we've already bailed on inverse filled paths, so this is safe | 535 // we've already bailed on inverse filled paths, so this is safe |
| 534 if (args.fPath->isEmpty()) { | 536 if (args.fPath->isEmpty()) { |
| 535 return true; | 537 return true; |
| 536 } | 538 } |
| 537 | 539 |
| 538 if (!fAtlas) { | 540 if (!fAtlas) { |
| 539 fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig, | 541 fAtlas = args.fResourceProvider->createAtlas(kAlpha_8_GrPixelConfig, |
| 540 ATLAS_TEXTURE_WIDTH, ATLAS_
TEXTURE_HEIGHT, | 542 ATLAS_TEXTURE_WIDTH, ATLAS_
TEXTURE_HEIGHT, |
| 541 NUM_PLOTS_X, NUM_PLOTS_Y, | 543 NUM_PLOTS_X, NUM_PLOTS_Y, |
| 542 &GrAADistanceFieldPathRende
rer::HandleEviction, | 544 &GrAADistanceFieldPathRende
rer::HandleEviction, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 558 // Note: this is the generation ID of the _original_ path. When a new path i
s | 560 // 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 | 561 // generated due to stroking it is important that the original path's id is
used |
| 560 // for caching. | 562 // for caching. |
| 561 geometry.fGenID = args.fPath->getGenerationID(); | 563 geometry.fGenID = args.fPath->getGenerationID(); |
| 562 | 564 |
| 563 SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry, | 565 SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry, |
| 564 *args.fView
Matrix, fAtlas, | 566 *args.fView
Matrix, fAtlas, |
| 565 &fPathCache
, &fPathList, | 567 &fPathCache
, &fPathList, |
| 566 args.fGamma
Correct)); | 568 args.fGamma
Correct)); |
| 567 | 569 |
| 568 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fDrawContext->isUnified
Multisampled()); | 570 GrPipelineBuilder pipelineBuilder(*args.fPaint); |
| 569 pipelineBuilder.setUserStencil(args.fUserStencilSettings); | 571 pipelineBuilder.setUserStencil(args.fUserStencilSettings); |
| 570 | 572 |
| 571 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); | 573 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
| 572 | 574 |
| 573 return true; | 575 return true; |
| 574 } | 576 } |
| 575 | 577 |
| 576 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 578 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 577 | 579 |
| 578 #ifdef GR_TEST_UTILS | 580 #ifdef GR_TEST_UTILS |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 geometry.fGenID = random->nextU(); | 646 geometry.fGenID = random->nextU(); |
| 645 | 647 |
| 646 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, | 648 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, |
| 647 gTestStruct.fAtlas, | 649 gTestStruct.fAtlas, |
| 648 &gTestStruct.fPathCache, | 650 &gTestStruct.fPathCache, |
| 649 &gTestStruct.fPathList, | 651 &gTestStruct.fPathList, |
| 650 gammaCorrect); | 652 gammaCorrect); |
| 651 } | 653 } |
| 652 | 654 |
| 653 #endif | 655 #endif |
| OLD | NEW |