OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrClipMaskManager.h" | 9 #include "GrClipMaskManager.h" |
10 #include "GrAAConvexPathRenderer.h" | 10 #include "GrAAConvexPathRenderer.h" |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 kAlways_StencilFunc, | 684 kAlways_StencilFunc, |
685 0xffff, | 685 0xffff, |
686 0x0000, | 686 0x0000, |
687 0xffff); | 687 0xffff); |
688 SET_RANDOM_COLOR | 688 SET_RANDOM_COLOR |
689 if (Element::kRect_Type == element->getType()) { | 689 if (Element::kRect_Type == element->getType()) { |
690 *drawState->stencil() = gDrawToStencil; | 690 *drawState->stencil() = gDrawToStencil; |
691 fGpu->drawSimpleRect(element->getRect(), NULL); | 691 fGpu->drawSimpleRect(element->getRect(), NULL); |
692 } else { | 692 } else { |
693 GrAssert(Element::kPath_Type == element->getType()); | 693 GrAssert(Element::kPath_Type == element->getType()); |
694 if (canRenderDirectToStencil) { | 694 if (!clipPath->isEmpty()) { |
695 *drawState->stencil() = gDrawToStencil; | 695 if (canRenderDirectToStencil) { |
696 pr->drawPath(*clipPath, stroke, fGpu, false); | 696 *drawState->stencil() = gDrawToStencil; |
697 } else { | 697 pr->drawPath(*clipPath, stroke, fGpu, false); |
698 pr->stencilPath(*clipPath, stroke, fGpu); | 698 } else { |
| 699 pr->stencilPath(*clipPath, stroke, fGpu); |
| 700 } |
699 } | 701 } |
700 } | 702 } |
701 } | 703 } |
702 | 704 |
703 // now we modify the clip bit by rendering either the clip | 705 // now we modify the clip bit by rendering either the clip |
704 // element directly or a bounding rect of the entire clip. | 706 // element directly or a bounding rect of the entire clip. |
705 drawState->enableState(GrGpu::kModifyStencilClip_StateBit); | 707 drawState->enableState(GrGpu::kModifyStencilClip_StateBit); |
706 for (int p = 0; p < passes; ++p) { | 708 for (int p = 0; p < passes; ++p) { |
707 *drawState->stencil() = stencilSettings[p]; | 709 *drawState->stencil() = stencilSettings[p]; |
708 if (canDrawDirectToClip) { | 710 if (canDrawDirectToClip) { |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 | 1004 |
1003 //////////////////////////////////////////////////////////////////////////////// | 1005 //////////////////////////////////////////////////////////////////////////////// |
1004 void GrClipMaskManager::releaseResources() { | 1006 void GrClipMaskManager::releaseResources() { |
1005 fAACache.releaseResources(); | 1007 fAACache.releaseResources(); |
1006 } | 1008 } |
1007 | 1009 |
1008 void GrClipMaskManager::setGpu(GrGpu* gpu) { | 1010 void GrClipMaskManager::setGpu(GrGpu* gpu) { |
1009 fGpu = gpu; | 1011 fGpu = gpu; |
1010 fAACache.setContext(gpu->getContext()); | 1012 fAACache.setContext(gpu->getContext()); |
1011 } | 1013 } |
OLD | NEW |