| 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 | 352 |
| 353 // pick a random premul color | 353 // pick a random premul color |
| 354 uint8_t alpha = d->fRandom->nextULessThan(256); | 354 uint8_t alpha = d->fRandom->nextULessThan(256); |
| 355 GrColor color = GrColorPackRGBA(d->fRandom->nextRangeU(0, alpha), | 355 GrColor color = GrColorPackRGBA(d->fRandom->nextRangeU(0, alpha), |
| 356 d->fRandom->nextRangeU(0, alpha), | 356 d->fRandom->nextRangeU(0, alpha), |
| 357 d->fRandom->nextRangeU(0, alpha), | 357 d->fRandom->nextRangeU(0, alpha), |
| 358 alpha); | 358 alpha); |
| 359 return ModeColorFilterEffect::Create(color, mode); | 359 return ModeColorFilterEffect::Create(color, mode); |
| 360 } | 360 } |
| 361 | 361 |
| 362 bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrShaderDataManager*, | 362 bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrProcessorDataManager*
, |
| 363 SkTDArray<GrFragmentProcessor*>* ar
ray) const { | 363 SkTDArray<GrFragmentProcessor*>* ar
ray) const { |
| 364 if (SkXfermode::kDst_Mode != fMode) { | 364 if (SkXfermode::kDst_Mode != fMode) { |
| 365 GrFragmentProcessor* frag = ModeColorFilterEffect::Create(SkColor2GrColo
r(fColor), fMode); | 365 GrFragmentProcessor* frag = ModeColorFilterEffect::Create(SkColor2GrColo
r(fColor), fMode); |
| 366 if (frag) { | 366 if (frag) { |
| 367 if (array) { | 367 if (array) { |
| 368 *array->append() = frag; | 368 *array->append() = frag; |
| 369 } else { | 369 } else { |
| 370 frag->unref(); | 370 frag->unref(); |
| 371 SkDEBUGCODE(frag = NULL;) | 371 SkDEBUGCODE(frag = NULL;) |
| 372 } | 372 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 byte_to_scale(SkColorGetG(mul)), | 466 byte_to_scale(SkColorGetG(mul)), |
| 467 byte_to_scale(SkColorGetB(mul)), | 467 byte_to_scale(SkColorGetB(mul)), |
| 468 1); | 468 1); |
| 469 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), | 469 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), |
| 470 SkIntToScalar(SkColorGetG(add)), | 470 SkIntToScalar(SkColorGetG(add)), |
| 471 SkIntToScalar(SkColorGetB(add)), | 471 SkIntToScalar(SkColorGetB(add)), |
| 472 0); | 472 0); |
| 473 return SkColorMatrixFilter::Create(matrix); | 473 return SkColorMatrixFilter::Create(matrix); |
| 474 } | 474 } |
| 475 | 475 |
| OLD | NEW |