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 #include "SkXfermode.h" | 9 #include "SkXfermode.h" |
10 #include "SkXfermode_proccoeff.h" | 10 #include "SkXfermode_proccoeff.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 653 |
654 bool SkXfermode::asFragmentProcessor(const GrFragmentProcessor**, | 654 bool SkXfermode::asFragmentProcessor(const GrFragmentProcessor**, |
655 const GrFragmentProcessor*) const { | 655 const GrFragmentProcessor*) const { |
656 return false; | 656 return false; |
657 } | 657 } |
658 | 658 |
659 bool SkXfermode::asXPFactory(GrXPFactory**) const { | 659 bool SkXfermode::asXPFactory(GrXPFactory**) const { |
660 return false; | 660 return false; |
661 } | 661 } |
662 | 662 |
663 | |
664 #if SK_SUPPORT_GPU | |
665 #include "effects/GrPorterDuffXferProcessor.h" | |
666 | |
667 bool SkXfermode::AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) { | |
668 if (nullptr == xfermode) { | |
669 if (xpf) { | |
670 *xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode); | |
671 } | |
672 return true; | |
673 } else { | |
674 return xfermode->asXPFactory(xpf); | |
675 } | |
676 } | |
677 #else | |
678 bool SkXfermode::AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) { | |
679 return false; | |
680 } | |
681 #endif | |
682 | |
683 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ | 663 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ |
684 // no-op. subclasses should override this | 664 // no-op. subclasses should override this |
685 return dst; | 665 return dst; |
686 } | 666 } |
687 | 667 |
688 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 668 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
689 const SkPMColor* SK_RESTRICT src, int count, | 669 const SkPMColor* SK_RESTRICT src, int count, |
690 const SkAlpha* SK_RESTRICT aa) const { | 670 const SkAlpha* SK_RESTRICT aa) const { |
691 SkASSERT(dst && src && count >= 0); | 671 SkASSERT(dst && src && count >= 0); |
692 | 672 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 } | 893 } |
914 dst[i] = SkToU8(A); | 894 dst[i] = SkToU8(A); |
915 } | 895 } |
916 } | 896 } |
917 } | 897 } |
918 } | 898 } |
919 } | 899 } |
920 | 900 |
921 #if SK_SUPPORT_GPU | 901 #if SK_SUPPORT_GPU |
922 #include "effects/GrCustomXfermode.h" | 902 #include "effects/GrCustomXfermode.h" |
| 903 #include "effects/GrPorterDuffXferProcessor.h" |
923 #include "effects/GrXfermodeFragmentProcessor.h" | 904 #include "effects/GrXfermodeFragmentProcessor.h" |
924 | 905 |
925 bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp, | 906 bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp, |
926 const GrFragmentProcessor* dst) co
nst { | 907 const GrFragmentProcessor* dst) co
nst { |
927 if (fp) { | 908 if (fp) { |
928 SkASSERT(dst); | 909 SkASSERT(dst); |
929 *fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode); | 910 *fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode); |
930 SkASSERT(*fp || kSrc_Mode == fMode); | 911 SkASSERT(*fp || kSrc_Mode == fMode); |
931 } | 912 } |
932 return true; | 913 return true; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 if (!xfer) { | 1064 if (!xfer) { |
1084 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; | 1065 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; |
1085 } | 1066 } |
1086 | 1067 |
1087 return xfer->isOpaque(opacityType); | 1068 return xfer->isOpaque(opacityType); |
1088 } | 1069 } |
1089 | 1070 |
1090 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1071 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1091 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1072 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1092 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1073 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |