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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // last (false) parameter disallows use of the SW path renderer | 70 // last (false) parameter disallows use of the SW path renderer |
71 GrPathRendererChain::DrawType type = doAA ? | 71 GrPathRendererChain::DrawType type = doAA ? |
72 GrPathRendererChain::kColorAntiAlias_Dr
awType : | 72 GrPathRendererChain::kColorAntiAlias_Dr
awType : |
73 GrPathRendererChain::kColor_DrawType; | 73 GrPathRendererChain::kColor_DrawType; |
74 | 74 |
75 return NULL == context->getPathRenderer(gpu, pipelineBuilder, viewMatrix, *p
ath, stroke, | 75 return NULL == context->getPathRenderer(gpu, pipelineBuilder, viewMatrix, *p
ath, stroke, |
76 false, type); | 76 false, type); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
| 80 GrClipMaskManager::GrClipMaskManager(GrClipTarget* clipTarget) |
| 81 : fCurrClipMaskType(kNone_ClipMaskType) |
| 82 , fAACache(clipTarget->getContext()->resourceProvider()) |
| 83 , fClipTarget(clipTarget) |
| 84 , fClipMode(kIgnoreClip_StencilClipMode) { |
| 85 } |
| 86 |
| 87 GrContext* GrClipMaskManager::getContext() { return fClipTarget->getContext(); } |
| 88 |
80 /* | 89 /* |
81 * This method traverses the clip stack to see if the GrSoftwarePathRenderer | 90 * This method traverses the clip stack to see if the GrSoftwarePathRenderer |
82 * will be used on any element. If so, it returns true to indicate that the | 91 * will be used on any element. If so, it returns true to indicate that the |
83 * entire clip should be rendered in SW and then uploaded en masse to the gpu. | 92 * entire clip should be rendered in SW and then uploaded en masse to the gpu. |
84 */ | 93 */ |
85 bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder* pipelineBuilder, | 94 bool GrClipMaskManager::useSWOnlyPath(const GrPipelineBuilder* pipelineBuilder, |
86 const SkVector& clipToMaskOffset, | 95 const SkVector& clipToMaskOffset, |
87 const GrReducedClip::ElementList& elements
) { | 96 const GrReducedClip::ElementList& elements
) { |
88 // TODO: generalize this function so that when | 97 // TODO: generalize this function so that when |
89 // a clip gets complex enough it can just be done in SW regardless | 98 // a clip gets complex enough it can just be done in SW regardless |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 | 1112 |
1104 fCurrClipMaskType = kAlpha_ClipMaskType; | 1113 fCurrClipMaskType = kAlpha_ClipMaskType; |
1105 return result; | 1114 return result; |
1106 } | 1115 } |
1107 | 1116 |
1108 //////////////////////////////////////////////////////////////////////////////// | 1117 //////////////////////////////////////////////////////////////////////////////// |
1109 void GrClipMaskManager::purgeResources() { | 1118 void GrClipMaskManager::purgeResources() { |
1110 fAACache.purgeResources(); | 1119 fAACache.purgeResources(); |
1111 } | 1120 } |
1112 | 1121 |
1113 void GrClipMaskManager::setClipTarget(GrClipTarget* clipTarget) { | |
1114 fClipTarget = clipTarget; | |
1115 fAACache.setContext(clipTarget->getContext()); | |
1116 } | |
1117 | |
1118 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1122 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
1119 GrStencilSettings* settings) { | 1123 GrStencilSettings* settings) { |
1120 if (stencilAttachment) { | 1124 if (stencilAttachment) { |
1121 int stencilBits = stencilAttachment->bits(); | 1125 int stencilBits = stencilAttachment->bits(); |
1122 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1126 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1123 } | 1127 } |
1124 } | 1128 } |
OLD | NEW |