OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 9 |
10 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 /////////////////////////////////////////////////////////////////////////////// | 666 /////////////////////////////////////////////////////////////////////////////// |
667 | 667 |
668 bool SkXfermode::asCoeff(Coeff* src, Coeff* dst) const { | 668 bool SkXfermode::asCoeff(Coeff* src, Coeff* dst) const { |
669 return false; | 669 return false; |
670 } | 670 } |
671 | 671 |
672 bool SkXfermode::asMode(Mode* mode) const { | 672 bool SkXfermode::asMode(Mode* mode) const { |
673 return false; | 673 return false; |
674 } | 674 } |
675 | 675 |
676 bool SkXfermode::asNewEffectOrCoeff(GrEffectRef**, Coeff* src, Coeff* dst, GrTex
ture*) const { | 676 bool SkXfermode::asNewEffect(GrEffectRef** effect, GrTexture* background) const
{ |
677 return this->asCoeff(src, dst); | 677 return false; |
678 } | 678 } |
679 | 679 |
680 bool SkXfermode::AsNewEffectOrCoeff(SkXfermode* xfermode, | 680 bool SkXfermode::AsNewEffectOrCoeff(SkXfermode* xfermode, |
681 GrEffectRef** effect, | 681 GrEffectRef** effect, |
682 Coeff* src, | 682 Coeff* src, |
683 Coeff* dst, | 683 Coeff* dst, |
684 GrTexture* background) { | 684 GrTexture* background) { |
685 if (NULL == xfermode) { | 685 if (NULL == xfermode) { |
686 return ModeAsCoeff(kSrcOver_Mode, src, dst); | 686 return ModeAsCoeff(kSrcOver_Mode, src, dst); |
| 687 } else if (xfermode->asCoeff(src, dst)) { |
| 688 return true; |
687 } else { | 689 } else { |
688 return xfermode->asNewEffectOrCoeff(effect, src, dst, background); | 690 return xfermode->asNewEffect(effect, background); |
689 } | 691 } |
690 } | 692 } |
691 | 693 |
692 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ | 694 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ |
693 // no-op. subclasses should override this | 695 // no-op. subclasses should override this |
694 return dst; | 696 return dst; |
695 } | 697 } |
696 | 698 |
697 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 699 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
698 const SkPMColor* SK_RESTRICT src, int count, | 700 const SkPMColor* SK_RESTRICT src, int count, |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 if (sc) { | 1358 if (sc) { |
1357 *sc = fSrcCoeff; | 1359 *sc = fSrcCoeff; |
1358 } | 1360 } |
1359 if (dc) { | 1361 if (dc) { |
1360 *dc = fDstCoeff; | 1362 *dc = fDstCoeff; |
1361 } | 1363 } |
1362 return true; | 1364 return true; |
1363 } | 1365 } |
1364 | 1366 |
1365 #if SK_SUPPORT_GPU | 1367 #if SK_SUPPORT_GPU |
1366 bool SkProcCoeffXfermode::asNewEffectOrCoeff(GrEffectRef** effect, | 1368 bool SkProcCoeffXfermode::asNewEffect(GrEffectRef** effect, |
1367 Coeff* src, | 1369 GrTexture* background) const { |
1368 Coeff* dst, | |
1369 GrTexture* background) const { | |
1370 if (this->asCoeff(src, dst)) { | |
1371 return true; | |
1372 } | |
1373 if (XferEffect::IsSupportedMode(fMode)) { | 1370 if (XferEffect::IsSupportedMode(fMode)) { |
1374 if (NULL != effect) { | 1371 if (NULL != effect) { |
1375 *effect = XferEffect::Create(fMode, background); | 1372 *effect = XferEffect::Create(fMode, background); |
1376 SkASSERT(NULL != *effect); | 1373 SkASSERT(NULL != *effect); |
1377 } | 1374 } |
1378 return true; | 1375 return true; |
1379 } | 1376 } |
1380 return false; | 1377 return false; |
1381 } | 1378 } |
1382 #endif | 1379 #endif |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1947 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1951 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1948 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1952 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) | 1949 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) |
1953 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) | 1950 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) |
1954 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) | 1951 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) |
1955 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) | 1952 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) |
1956 #if !SK_ARM_NEON_IS_NONE | 1953 #if !SK_ARM_NEON_IS_NONE |
1957 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) | 1954 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) |
1958 #endif | 1955 #endif |
1959 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1956 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |