| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // We shouldn't get here with an empty clip element. | 79 // We shouldn't get here with an empty clip element. |
| 80 SkASSERT(Element::kEmpty_Type != element->getType()); | 80 SkASSERT(Element::kEmpty_Type != element->getType()); |
| 81 | 81 |
| 82 // the gpu alpha mask will draw the inverse paths as non-inverse to a te
mp buffer | 82 // the gpu alpha mask will draw the inverse paths as non-inverse to a te
mp buffer |
| 83 SkPath path; | 83 SkPath path; |
| 84 element->asPath(&path); | 84 element->asPath(&path); |
| 85 if (path.isInverseFillType()) { | 85 if (path.isInverseFillType()) { |
| 86 path.toggleInverseFillType(); | 86 path.toggleInverseFillType(); |
| 87 } | 87 } |
| 88 GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle); | 88 GrStrokeInfo stroke(SkStrokeRec::kFill_InitStyle); |
| 89 | 89 |
| 90 GrPathRendererChain::DrawType type; | 90 GrPathRendererChain::DrawType type; |
| 91 | 91 |
| 92 if (needsStencil) { | 92 if (needsStencil) { |
| 93 type = element->isAA() | 93 type = element->isAA() |
| 94 ? GrPathRendererChain::kStencilAndColorAntiAlias_Dra
wType | 94 ? GrPathRendererChain::kStencilAndColorAntiAlias_Dra
wType |
| 95 : GrPathRendererChain::kStencilAndColor_DrawType; | 95 : GrPathRendererChain::kStencilAndColor_DrawType; |
| 96 } else { | 96 } else { |
| 97 type = element->isAA() | 97 type = element->isAA() |
| 98 ? GrPathRendererChain::kColorAntiAlias_DrawType | 98 ? GrPathRendererChain::kColorAntiAlias_DrawType |
| 99 : GrPathRendererChain::kColor_DrawType; | 99 : GrPathRendererChain::kColor_DrawType; |
| 100 } | 100 } |
| 101 | 101 |
| 102 GrPathRenderer::CanDrawPathArgs canDrawArgs; | 102 GrPathRenderer::CanDrawPathArgs canDrawArgs; |
| 103 canDrawArgs.fShaderCaps = context->caps()->shaderCaps(); | 103 canDrawArgs.fShaderCaps = context->caps()->shaderCaps(); |
| 104 canDrawArgs.fViewMatrix = &viewMatrix; | 104 canDrawArgs.fViewMatrix = &viewMatrix; |
| 105 canDrawArgs.fPath = &path; | 105 canDrawArgs.fPath = &path; |
| 106 canDrawArgs.fStroke = &stroke; | 106 canDrawArgs.fStroke = &stroke; |
| 107 canDrawArgs.fAntiAlias = element->isAA(); | 107 canDrawArgs.fAntiAlias = element->isAA(); |
| 108 canDrawArgs.fIsStencilDisabled = isStencilDisabled; | 108 canDrawArgs.fIsStencilDisabled = isStencilDisabled; |
| 109 canDrawArgs.fIsStencilBufferMSAA = rt->isStencilBufferMultisampled(); | 109 canDrawArgs.fIsStencilBufferMSAA = rt->isStencilBufferMultisampled(); |
| 110 | 110 |
| 111 // the 'false' parameter disallows use of the SW path renderer | 111 // the 'false' parameter disallows use of the SW path renderer |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 // Set the matrix so that rendered clip elements are transformed to mask spa
ce from clip | 171 // Set the matrix so that rendered clip elements are transformed to mask spa
ce from clip |
| 172 // space. | 172 // space. |
| 173 const SkMatrix translate = SkMatrix::MakeTrans(clipToMaskOffset.fX, clipToMa
skOffset.fY); | 173 const SkMatrix translate = SkMatrix::MakeTrans(clipToMaskOffset.fX, clipToMa
skOffset.fY); |
| 174 | 174 |
| 175 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.get();
iter.next()) { | 175 for (GrReducedClip::ElementList::Iter iter(elements.headIter()); iter.get();
iter.next()) { |
| 176 const Element* element = iter.get(); | 176 const Element* element = iter.get(); |
| 177 | 177 |
| 178 SkRegion::Op op = element->getOp(); | 178 SkRegion::Op op = element->getOp(); |
| 179 bool invert = element->isInverseFilled(); | 179 bool invert = element->isInverseFilled(); |
| 180 bool needsStencil = invert || | 180 bool needsStencil = invert || |
| 181 SkRegion::kIntersect_Op == op || SkRegion::kReverseD
ifference_Op == op; | 181 SkRegion::kIntersect_Op == op || SkRegion::kReverseD
ifference_Op == op; |
| 182 | 182 |
| 183 if (PathNeedsSWRenderer(context, pipelineBuilder.getStencil().isDisabled
(), | 183 if (PathNeedsSWRenderer(context, pipelineBuilder.getStencil().isDisabled
(), |
| 184 rt, translate, element, nullptr, needsStencil))
{ | 184 rt, translate, element, nullptr, needsStencil))
{ |
| 185 return true; | 185 return true; |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 return false; | 188 return false; |
| 189 } | 189 } |
| 190 | 190 |
| (...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 | 1154 |
| 1155 //////////////////////////////////////////////////////////////////////////////// | 1155 //////////////////////////////////////////////////////////////////////////////// |
| 1156 | 1156 |
| 1157 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, | 1157 void GrClipMaskManager::adjustPathStencilParams(const GrStencilAttachment* stenc
ilAttachment, |
| 1158 GrStencilSettings* settings) { | 1158 GrStencilSettings* settings) { |
| 1159 if (stencilAttachment) { | 1159 if (stencilAttachment) { |
| 1160 int stencilBits = stencilAttachment->bits(); | 1160 int stencilBits = stencilAttachment->bits(); |
| 1161 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1161 this->adjustStencilParams(settings, fClipMode, stencilBits); |
| 1162 } | 1162 } |
| 1163 } | 1163 } |
| OLD | NEW |