| 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 "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
| 10 #include "GrAAHairLinePathRenderer.h" | 10 #include "GrAAHairLinePathRenderer.h" |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 clipPath, stroke); | 835 clipPath, stroke); |
| 836 } | 836 } |
| 837 } | 837 } |
| 838 } | 838 } |
| 839 } | 839 } |
| 840 | 840 |
| 841 // now we modify the clip bit by rendering either the clip | 841 // now we modify the clip bit by rendering either the clip |
| 842 // element directly or a bounding rect of the entire clip. | 842 // element directly or a bounding rect of the entire clip. |
| 843 fClipMode = kModifyClip_StencilClipMode; | 843 fClipMode = kModifyClip_StencilClipMode; |
| 844 for (int p = 0; p < passes; ++p) { | 844 for (int p = 0; p < passes; ++p) { |
| 845 GrPipelineBuilder pipelineBuilderCopy(pipelineBuilder); | 845 *pipelineBuilder.stencil() = stencilSettings[p]; |
| 846 *pipelineBuilderCopy.stencil() = stencilSettings[p]; | |
| 847 | 846 |
| 848 if (canDrawDirectToClip) { | 847 if (canDrawDirectToClip) { |
| 849 if (Element::kRect_Type == element->getType()) { | 848 if (Element::kRect_Type == element->getType()) { |
| 850 // We need this AGP until everything is in GrBatch | 849 // We need this AGP until everything is in GrBatch |
| 851 fClipTarget->drawSimpleRect(&pipelineBuilderCopy, | 850 fClipTarget->drawSimpleRect(&pipelineBuilder, |
| 852 GrColor_WHITE, | 851 GrColor_WHITE, |
| 853 viewMatrix, | 852 viewMatrix, |
| 854 element->getRect()); | 853 element->getRect()); |
| 855 } else { | 854 } else { |
| 856 pr->drawPath(fClipTarget, &pipelineBuilderCopy, GrColor_
WHITE, | 855 pr->drawPath(fClipTarget, &pipelineBuilder, GrColor_WHIT
E, |
| 857 viewMatrix, clipPath, stroke, false); | 856 viewMatrix, clipPath, stroke, false); |
| 858 } | 857 } |
| 859 } else { | 858 } else { |
| 860 // The view matrix is setup to do clip space -> stencil spac
e translation, so | 859 // The view matrix is setup to do clip space -> stencil spac
e translation, so |
| 861 // draw rect in clip space. | 860 // draw rect in clip space. |
| 862 fClipTarget->drawSimpleRect(&pipelineBuilderCopy, | 861 fClipTarget->drawSimpleRect(&pipelineBuilder, |
| 863 GrColor_WHITE, | 862 GrColor_WHITE, |
| 864 viewMatrix, | 863 viewMatrix, |
| 865 SkRect::Make(clipSpaceIBounds)); | 864 SkRect::Make(clipSpaceIBounds)); |
| 866 } | 865 } |
| 867 } | 866 } |
| 868 } | 867 } |
| 869 } | 868 } |
| 870 // set this last because recursive draws may overwrite it back to kNone. | 869 // set this last because recursive draws may overwrite it back to kNone. |
| 871 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); | 870 SkASSERT(kNone_ClipMaskType == fCurrClipMaskType); |
| 872 fCurrClipMaskType = kStencil_ClipMaskType; | 871 fCurrClipMaskType = kStencil_ClipMaskType; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 fAACache.purgeResources(); | 1120 fAACache.purgeResources(); |
| 1122 } | 1121 } |
| 1123 | 1122 |
| 1124 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1123 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
| 1125 GrStencilSettings* settings) { | 1124 GrStencilSettings* settings) { |
| 1126 if (stencilAttachment) { | 1125 if (stencilAttachment) { |
| 1127 int stencilBits = stencilAttachment->bits(); | 1126 int stencilBits = stencilAttachment->bits(); |
| 1128 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1127 this->adjustStencilParams(settings, fClipMode, stencilBits); |
| 1129 } | 1128 } |
| 1130 } | 1129 } |
| OLD | NEW |