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