OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrClipMaskManager.h" | 8 #include "GrClipMaskManager.h" |
9 #include "GrCaps.h" | 9 #include "GrCaps.h" |
10 #include "GrDrawingManager.h" | 10 #include "GrDrawingManager.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 0xffff>() | 654 0xffff>() |
655 ); | 655 ); |
656 if (Element::kRect_Type == element->getType()) { | 656 if (Element::kRect_Type == element->getType()) { |
657 drawContext->drawContextPriv().stencilRect(clip, &kDrawToSte ncil, useHWAA, | 657 drawContext->drawContextPriv().stencilRect(clip, &kDrawToSte ncil, useHWAA, |
658 viewMatrix, eleme nt->getRect()); | 658 viewMatrix, eleme nt->getRect()); |
659 } else { | 659 } else { |
660 if (!clipPath.isEmpty()) { | 660 if (!clipPath.isEmpty()) { |
661 GrShape shape(clipPath, GrStyle::SimpleFill()); | 661 GrShape shape(clipPath, GrStyle::SimpleFill()); |
662 if (canRenderDirectToStencil) { | 662 if (canRenderDirectToStencil) { |
663 GrPaint paint; | 663 GrPaint paint; |
664 paint.setColor4f(GrColor4f(1.0f, 1.0f, 1.0f, 1.0f)); | |
bsalomon
2016/07/07 13:53:22
Should we have a constant for white GrColor4f? Als
robertphillips
2016/07/07 14:10:55
Done - removed unnecessary setColor calls.
| |
664 paint.setXPFactory(GrDisableColorXPFactory::Make()); | 665 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
665 paint.setAntiAlias(element->isAA()); | 666 paint.setAntiAlias(element->isAA()); |
666 | 667 |
667 GrPathRenderer::DrawPathArgs args; | 668 GrPathRenderer::DrawPathArgs args; |
668 args.fResourceProvider = context->resourceProvider() ; | 669 args.fResourceProvider = context->resourceProvider() ; |
669 args.fPaint = &paint; | 670 args.fPaint = &paint; |
670 args.fUserStencilSettings = &kDrawToStencil; | 671 args.fUserStencilSettings = &kDrawToStencil; |
671 args.fDrawContext = drawContext; | 672 args.fDrawContext = drawContext; |
672 args.fClip = &clip; | 673 args.fClip = &clip; |
673 args.fColor = GrColor_WHITE; | |
674 args.fViewMatrix = &viewMatrix; | 674 args.fViewMatrix = &viewMatrix; |
675 args.fShape = &shape; | 675 args.fShape = &shape; |
676 args.fAntiAlias = false; | 676 args.fAntiAlias = false; |
677 args.fGammaCorrect = false; | 677 args.fGammaCorrect = false; |
678 pr->drawPath(args); | 678 pr->drawPath(args); |
679 } else { | 679 } else { |
680 GrPathRenderer::StencilPathArgs args; | 680 GrPathRenderer::StencilPathArgs args; |
681 args.fResourceProvider = context->resourceProvider() ; | 681 args.fResourceProvider = context->resourceProvider() ; |
682 args.fDrawContext = drawContext; | 682 args.fDrawContext = drawContext; |
683 args.fClip = &clip; | 683 args.fClip = &clip; |
(...skipping 11 matching lines...) Expand all Loading... | |
695 clip.enableStencilClip(true); | 695 clip.enableStencilClip(true); |
696 for (GrUserStencilSettings const* const* pass = stencilPasses; *pass ; ++pass) { | 696 for (GrUserStencilSettings const* const* pass = stencilPasses; *pass ; ++pass) { |
697 | 697 |
698 if (drawDirectToClip) { | 698 if (drawDirectToClip) { |
699 if (Element::kRect_Type == element->getType()) { | 699 if (Element::kRect_Type == element->getType()) { |
700 drawContext->drawContextPriv().stencilRect(clip, *pass, useHWAA, viewMatrix, | 700 drawContext->drawContextPriv().stencilRect(clip, *pass, useHWAA, viewMatrix, |
701 element->getR ect()); | 701 element->getR ect()); |
702 } else { | 702 } else { |
703 GrShape shape(clipPath, GrStyle::SimpleFill()); | 703 GrShape shape(clipPath, GrStyle::SimpleFill()); |
704 GrPaint paint; | 704 GrPaint paint; |
705 paint.setColor4f(GrColor4f(1.0f, 1.0f, 1.0f, 1.0f)); | |
705 paint.setXPFactory(GrDisableColorXPFactory::Make()); | 706 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
706 paint.setAntiAlias(element->isAA()); | 707 paint.setAntiAlias(element->isAA()); |
707 GrPathRenderer::DrawPathArgs args; | 708 GrPathRenderer::DrawPathArgs args; |
708 args.fResourceProvider = context->resourceProvider(); | 709 args.fResourceProvider = context->resourceProvider(); |
709 args.fPaint = &paint; | 710 args.fPaint = &paint; |
710 args.fUserStencilSettings = *pass; | 711 args.fUserStencilSettings = *pass; |
711 args.fDrawContext = drawContext; | 712 args.fDrawContext = drawContext; |
712 args.fClip = &clip; | 713 args.fClip = &clip; |
713 args.fColor = GrColor_WHITE; | |
714 args.fViewMatrix = &viewMatrix; | 714 args.fViewMatrix = &viewMatrix; |
715 args.fShape = &shape; | 715 args.fShape = &shape; |
716 args.fAntiAlias = false; | 716 args.fAntiAlias = false; |
717 args.fGammaCorrect = false; | 717 args.fGammaCorrect = false; |
718 pr->drawPath(args); | 718 pr->drawPath(args); |
719 } | 719 } |
720 } else { | 720 } else { |
721 // The view matrix is setup to do clip space -> stencil spac e translation, so | 721 // The view matrix is setup to do clip space -> stencil spac e translation, so |
722 // draw rect in clip space. | 722 // draw rect in clip space. |
723 drawContext->drawContextPriv().stencilRect(clip, *pass, fals e, viewMatrix, | 723 drawContext->drawContextPriv().stencilRect(clip, *pass, fals e, viewMatrix, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
800 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); | 800 sk_sp<GrTexture> result(texProvider->createApproxTexture(desc)); |
801 if (!result) { | 801 if (!result) { |
802 return nullptr; | 802 return nullptr; |
803 } | 803 } |
804 result->resourcePriv().setUniqueKey(key); | 804 result->resourcePriv().setUniqueKey(key); |
805 | 805 |
806 helper.toTexture(result.get()); | 806 helper.toTexture(result.get()); |
807 | 807 |
808 return result; | 808 return result; |
809 } | 809 } |
OLD | NEW |