OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 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 "effects/GrCoverageSetOpXP.h" | 9 #include "effects/GrCoverageSetOpXP.h" |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (invertCoverage) { | 209 if (invertCoverage) { |
210 static GrCoverageSetOpXPFactory gRevDiffCDXPFI(regionOp, invertC
overage); | 210 static GrCoverageSetOpXPFactory gRevDiffCDXPFI(regionOp, invertC
overage); |
211 return SkRef(&gRevDiffCDXPFI); | 211 return SkRef(&gRevDiffCDXPFI); |
212 } else { | 212 } else { |
213 static GrCoverageSetOpXPFactory gRevDiffCDXPF(regionOp, invertCo
verage); | 213 static GrCoverageSetOpXPFactory gRevDiffCDXPF(regionOp, invertCo
verage); |
214 return SkRef(&gRevDiffCDXPF); | 214 return SkRef(&gRevDiffCDXPF); |
215 } | 215 } |
216 break; | 216 break; |
217 } | 217 } |
218 default: | 218 default: |
219 return NULL; | 219 return nullptr; |
220 } | 220 } |
221 } | 221 } |
222 | 222 |
223 GrXferProcessor* | 223 GrXferProcessor* |
224 GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps, | 224 GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrCaps& caps, |
225 const GrProcOptInfo& colorPOI, | 225 const GrProcOptInfo& colorPOI, |
226 const GrProcOptInfo& covPOI, | 226 const GrProcOptInfo& covPOI, |
227 bool hasMixedSamples, | 227 bool hasMixedSamples, |
228 const DstTexture* dst) const { | 228 const DstTexture* dst) const { |
229 // We don't support inverting coverage with mixed samples. We don't expect t
o ever want this in | 229 // We don't support inverting coverage with mixed samples. We don't expect t
o ever want this in |
230 // the future, however we could at some point make this work using an invert
ed coverage | 230 // the future, however we could at some point make this work using an invert
ed coverage |
231 // modulation table. Note that an inverted table still won't work if there a
re coverage procs. | 231 // modulation table. Note that an inverted table still won't work if there a
re coverage procs. |
232 if (fInvertCoverage && hasMixedSamples) { | 232 if (fInvertCoverage && hasMixedSamples) { |
233 SkASSERT(false); | 233 SkASSERT(false); |
234 return NULL; | 234 return nullptr; |
235 } | 235 } |
236 | 236 |
237 return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage); | 237 return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage); |
238 } | 238 } |
239 | 239 |
240 void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col
orPOI, | 240 void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col
orPOI, |
241 InvariantBlendedColor* b
lendedColor) const { | 241 InvariantBlendedColor* b
lendedColor) const { |
242 blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp; | 242 blendedColor->fWillBlendWithDst = SkRegion::kReplace_Op != fRegionOp; |
243 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; | 243 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; |
244 } | 244 } |
245 | 245 |
246 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); | 246 GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); |
247 | 247 |
248 GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) { | 248 GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) { |
249 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa
stOp + 1)); | 249 SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLa
stOp + 1)); |
250 bool invertCoverage = d->fRandom->nextBool(); | 250 bool invertCoverage = d->fRandom->nextBool(); |
251 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); | 251 return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); |
252 } | 252 } |
253 | 253 |
OLD | NEW |