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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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*, |
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 { |
| 373 frag->unref(); |
| 374 SkDEBUGCODE(frag = NULL;) |
372 } | 375 } |
373 return true; | 376 return true; |
374 } | 377 } |
375 } | 378 } |
376 return false; | 379 return false; |
377 } | 380 } |
378 | 381 |
379 #endif | 382 #endif |
380 | 383 |
381 /////////////////////////////////////////////////////////////////////////////// | 384 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 byte_to_scale(SkColorGetG(mul)), | 469 byte_to_scale(SkColorGetG(mul)), |
467 byte_to_scale(SkColorGetB(mul)), | 470 byte_to_scale(SkColorGetB(mul)), |
468 1); | 471 1); |
469 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), | 472 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), |
470 SkIntToScalar(SkColorGetG(add)), | 473 SkIntToScalar(SkColorGetG(add)), |
471 SkIntToScalar(SkColorGetB(add)), | 474 SkIntToScalar(SkColorGetB(add)), |
472 0); | 475 0); |
473 return SkColorMatrixFilter::Create(matrix); | 476 return SkColorMatrixFilter::Create(matrix); |
474 } | 477 } |
475 | 478 |
OLD | NEW |