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 | 8 |
9 #include "GrStencilAndCoverPathRenderer.h" | 9 #include "GrStencilAndCoverPathRenderer.h" |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 SkScalar bloat = viewMatrix.getMaxScale() * SK_ScalarHalf; | 135 SkScalar bloat = viewMatrix.getMaxScale() * SK_ScalarHalf; |
136 bounds.outset(bloat, bloat); | 136 bounds.outset(bloat, bloat); |
137 } else { | 137 } else { |
138 if (!viewMatrix.invert(&invert)) { | 138 if (!viewMatrix.invert(&invert)) { |
139 return false; | 139 return false; |
140 } | 140 } |
141 } | 141 } |
142 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; | 142 const SkMatrix& viewM = viewMatrix.hasPerspective() ? SkMatrix::I() : vi
ewMatrix; |
143 | 143 |
144 SkAutoTUnref<GrDrawBatch> coverBatch( | 144 SkAutoTUnref<GrDrawBatch> coverBatch( |
145 GrRectBatchFactory::CreateNonAAFill(args.fColor, viewM, bounds,
nullptr, | 145 GrRectBatchFactory::CreateNonAAFill(args.fPaint->getColor(), vie
wM, bounds, |
146 &invert)); | 146 nullptr, &invert)); |
147 | 147 |
148 { | 148 { |
149 GrPipelineBuilder pipelineBuilder(*args.fPaint, | 149 GrPipelineBuilder pipelineBuilder(*args.fPaint, |
150 args.fPaint->isAntiAlias() && | 150 args.fPaint->isAntiAlias() && |
151 !args.fDrawContext->hasMixedSample
s()); | 151 !args.fDrawContext->hasMixedSample
s()); |
152 pipelineBuilder.setUserStencil(&kInvertedCoverPass); | 152 pipelineBuilder.setUserStencil(&kInvertedCoverPass); |
153 | 153 |
154 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, coverBatc
h); | 154 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, coverBatc
h); |
155 } | 155 } |
156 } else { | 156 } else { |
157 static constexpr GrUserStencilSettings kCoverPass( | 157 static constexpr GrUserStencilSettings kCoverPass( |
158 GrUserStencilSettings::StaticInit< | 158 GrUserStencilSettings::StaticInit< |
159 0x0000, | 159 0x0000, |
160 GrUserStencilTest::kNotEqual, | 160 GrUserStencilTest::kNotEqual, |
161 0xffff, | 161 0xffff, |
162 GrUserStencilOp::kZero, | 162 GrUserStencilOp::kZero, |
163 GrUserStencilOp::kKeep, | 163 GrUserStencilOp::kKeep, |
164 0xffff>() | 164 0xffff>() |
165 ); | 165 ); |
166 | 166 |
167 SkAutoTUnref<GrDrawBatch> batch( | 167 SkAutoTUnref<GrDrawBatch> batch( |
168 GrDrawPathBatch::Create(viewMatrix, args.fColor, p->getFillType(
), p)); | 168 GrDrawPathBatch::Create(viewMatrix, args.fPaint->getColor(), p->
getFillType(), p)); |
169 | 169 |
170 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias
()); | 170 GrPipelineBuilder pipelineBuilder(*args.fPaint, args.fPaint->isAntiAlias
()); |
171 pipelineBuilder.setUserStencil(&kCoverPass); | 171 pipelineBuilder.setUserStencil(&kCoverPass); |
172 if (args.fAntiAlias) { | 172 if (args.fAntiAlias) { |
173 SkASSERT(args.fDrawContext->isStencilBufferMultisampled()); | 173 SkASSERT(args.fDrawContext->isStencilBufferMultisampled()); |
174 pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag); | 174 pipelineBuilder.enableState(GrPipelineBuilder::kHWAntialias_Flag); |
175 } | 175 } |
176 | 176 |
177 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); | 177 args.fDrawContext->drawBatch(pipelineBuilder, *args.fClip, batch); |
178 } | 178 } |
179 | 179 |
180 return true; | 180 return true; |
181 } | 181 } |
OLD | NEW |