OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
9 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 GrInvariantOutput::ReadInput readInput = GrInvariantOutput::kWill_ReadInput; | 332 GrInvariantOutput::ReadInput readInput = GrInvariantOutput::kWill_ReadInput; |
333 // These could be calculated from the blend equation with template trickery.
. | 333 // These could be calculated from the blend equation with template trickery.
. |
334 if (SkXfermode::kZero_Coeff == dstCoeff && | 334 if (SkXfermode::kZero_Coeff == dstCoeff && |
335 !GrBlendCoeffRefsDst(sk_blend_to_grblend(srcCoeff))) { | 335 !GrBlendCoeffRefsDst(sk_blend_to_grblend(srcCoeff))) { |
336 readInput = GrInvariantOutput::kWillNot_ReadInput; | 336 readInput = GrInvariantOutput::kWillNot_ReadInput; |
337 } | 337 } |
338 inout->setToOther(result.getValidComponents(), result.getColor(), readInput)
; | 338 inout->setToOther(result.getValidComponents(), result.getColor(), readInput)
; |
339 } | 339 } |
340 | 340 |
341 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect); | 341 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect); |
342 GrFragmentProcessor* ModeColorFilterEffect::TestCreate(GrProcessorTestData* d) { | 342 const GrFragmentProcessor* ModeColorFilterEffect::TestCreate(GrProcessorTestData
* d) { |
343 SkXfermode::Mode mode = SkXfermode::kDst_Mode; | 343 SkXfermode::Mode mode = SkXfermode::kDst_Mode; |
344 while (SkXfermode::kDst_Mode == mode) { | 344 while (SkXfermode::kDst_Mode == mode) { |
345 mode = static_cast<SkXfermode::Mode>(d->fRandom->nextRangeU(0, SkXfermod
e::kLastCoeffMode)); | 345 mode = static_cast<SkXfermode::Mode>(d->fRandom->nextRangeU(0, SkXfermod
e::kLastCoeffMode)); |
346 } | 346 } |
347 | 347 |
348 // pick a random premul color | 348 // pick a random premul color |
349 uint8_t alpha = d->fRandom->nextULessThan(256); | 349 uint8_t alpha = d->fRandom->nextULessThan(256); |
350 GrColor color = GrColorPackRGBA(d->fRandom->nextRangeU(0, alpha), | 350 GrColor color = GrColorPackRGBA(d->fRandom->nextRangeU(0, alpha), |
351 d->fRandom->nextRangeU(0, alpha), | 351 d->fRandom->nextRangeU(0, alpha), |
352 d->fRandom->nextRangeU(0, alpha), | 352 d->fRandom->nextRangeU(0, alpha), |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 byte_to_scale(SkColorGetG(mul)), | 461 byte_to_scale(SkColorGetG(mul)), |
462 byte_to_scale(SkColorGetB(mul)), | 462 byte_to_scale(SkColorGetB(mul)), |
463 1); | 463 1); |
464 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), | 464 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), |
465 SkIntToScalar(SkColorGetG(add)), | 465 SkIntToScalar(SkColorGetG(add)), |
466 SkIntToScalar(SkColorGetB(add)), | 466 SkIntToScalar(SkColorGetB(add)), |
467 0); | 467 0); |
468 return SkColorMatrixFilter::Create(matrix); | 468 return SkColorMatrixFilter::Create(matrix); |
469 } | 469 } |
470 | 470 |
OLD | NEW |