OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" | 8 #include "GrDefaultPathRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 } else { | 436 } else { |
437 SkASSERT(style->isSimpleFill()); | 437 SkASSERT(style->isSimpleFill()); |
438 } | 438 } |
439 | 439 |
440 // Save the current xp on the draw state so we can reset it if needed | 440 // Save the current xp on the draw state so we can reset it if needed |
441 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); | 441 const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); |
442 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory)); | 442 SkAutoTUnref<const GrXPFactory> backupXPFactory(SkSafeRef(xpFactory)); |
443 // face culling doesn't make sense here | 443 // face culling doesn't make sense here |
444 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace()
); | 444 SkASSERT(GrPipelineBuilder::kBoth_DrawFace == pipelineBuilder->getDrawFace()
); |
445 | 445 |
446 int passCount = 0; | 446 int passCount = 0; |
447 const GrStencilSettings* passes[3]; | 447 const GrUserStencilSettings* passes[3]; |
448 GrPipelineBuilder::DrawFace drawFace[3]; | 448 GrPipelineBuilder::DrawFace drawFace[3]; |
449 bool reverse = false; | 449 bool reverse = false; |
450 bool lastPassIsBounds; | 450 bool lastPassIsBounds; |
451 | 451 |
452 if (isHairline) { | 452 if (isHairline) { |
453 passCount = 1; | 453 passCount = 1; |
454 if (stencilOnly) { | 454 if (stencilOnly) { |
455 passes[0] = &gDirectToStencil; | 455 passes[0] = &gDirectToStencil; |
456 } else { | 456 } else { |
457 passes[0] = nullptr; | 457 passes[0] = nullptr; |
458 } | 458 } |
459 lastPassIsBounds = false; | 459 lastPassIsBounds = false; |
460 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; | 460 drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 537 |
538 SkScalar tol = GrPathUtils::kDefaultTolerance; | 538 SkScalar tol = GrPathUtils::kDefaultTolerance; |
539 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, pat
h.getBounds()); | 539 SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, pat
h.getBounds()); |
540 | 540 |
541 SkRect devBounds; | 541 SkRect devBounds; |
542 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB
ounds); | 542 GetPathDevBounds(path, pipelineBuilder->getRenderTarget(), viewMatrix, &devB
ounds); |
543 | 543 |
544 for (int p = 0; p < passCount; ++p) { | 544 for (int p = 0; p < passCount; ++p) { |
545 pipelineBuilder->setDrawFace(drawFace[p]); | 545 pipelineBuilder->setDrawFace(drawFace[p]); |
546 if (passes[p]) { | 546 if (passes[p]) { |
547 *pipelineBuilder->stencil() = *passes[p]; | 547 pipelineBuilder->setUserStencil(passes[p]); |
548 } | 548 } |
549 | 549 |
550 if (lastPassIsBounds && (p == passCount-1)) { | 550 if (lastPassIsBounds && (p == passCount-1)) { |
551 // Reset the XP Factory on pipelineBuilder | 551 // Reset the XP Factory on pipelineBuilder |
552 pipelineBuilder->setXPFactory(backupXPFactory); | 552 pipelineBuilder->setXPFactory(backupXPFactory); |
553 SkRect bounds; | 553 SkRect bounds; |
554 SkMatrix localMatrix = SkMatrix::I(); | 554 SkMatrix localMatrix = SkMatrix::I(); |
555 if (reverse) { | 555 if (reverse) { |
556 SkASSERT(pipelineBuilder->getRenderTarget()); | 556 SkASSERT(pipelineBuilder->getRenderTarget()); |
557 // draw over the dev bounds (which will be the whole dst surface
for inv fill). | 557 // draw over the dev bounds (which will be the whole dst surface
for inv fill). |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 geometry.fColor = color; | 643 geometry.fColor = color; |
644 geometry.fPath = path; | 644 geometry.fPath = path; |
645 geometry.fTolerance = srcSpaceTol; | 645 geometry.fTolerance = srcSpaceTol; |
646 | 646 |
647 viewMatrix.mapRect(&bounds); | 647 viewMatrix.mapRect(&bounds); |
648 uint8_t coverage = GrRandomCoverage(random); | 648 uint8_t coverage = GrRandomCoverage(random); |
649 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); | 649 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds
); |
650 } | 650 } |
651 | 651 |
652 #endif | 652 #endif |
OLD | NEW |