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_opts_SSE2.h" | 10 #include "SkXfermode_opts_SSE2.h" |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 bool SkXfermode::asXPFactory(GrXPFactory**) const { | 682 bool SkXfermode::asXPFactory(GrXPFactory**) const { |
683 return false; | 683 return false; |
684 } | 684 } |
685 | 685 |
686 | 686 |
687 #if SK_SUPPORT_GPU | 687 #if SK_SUPPORT_GPU |
688 #include "effects/GrPorterDuffXferProcessor.h" | 688 #include "effects/GrPorterDuffXferProcessor.h" |
689 | 689 |
690 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, | 690 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, |
691 GrFragmentProcessor** fp, | 691 GrFragmentProcessor** fp, |
692 GrXPFactory** xpf, | 692 GrXPFactory** xpf) { |
693 Coeff* src, Coeff* dst) { | 693 Coeff src, dst; |
694 Mode mode; | 694 Mode mode; |
695 if (NULL == xfermode) { | 695 if (NULL == xfermode) { |
696 SkAssertResult(ModeAsCoeff(kSrcOver_Mode, src, dst)); | 696 *xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode); |
697 *xpf = GrPorterDuffXPFactory::Create(*src, *dst); | |
698 return true; | 697 return true; |
699 } else if (xfermode->asMode(&mode) && mode <= kLastCoeffMode) { | 698 } else if (xfermode->asMode(&mode) && mode <= kLastCoeffMode) { |
700 *xpf = GrPorterDuffXPFactory::Create(mode); | 699 *xpf = GrPorterDuffXPFactory::Create(mode); |
701 // TODO: This Line will be removed in follow up cl that handles blending
and thus we won't | |
702 // have to set coeffs here. | |
703 SkAssertResult(ModeAsCoeff(mode, src, dst)); | |
704 return true; | 700 return true; |
705 } else if (xfermode->asCoeff(src, dst)) { | 701 } else if (xfermode->asCoeff(&src, &dst)) { |
706 *xpf = GrPorterDuffXPFactory::Create(*src, *dst); | 702 *xpf = GrPorterDuffXPFactory::Create(src, dst); |
707 return true; | 703 return true; |
708 } else if (xfermode->asXPFactory(xpf)) { | 704 } else if (xfermode->asXPFactory(xpf)) { |
709 *src = SkXfermode::kOne_Coeff; | |
710 *dst = SkXfermode::kZero_Coeff; | |
711 return true; | 705 return true; |
712 } else { | 706 } else { |
713 return xfermode->asFragmentProcessor(fp); | 707 return xfermode->asFragmentProcessor(fp); |
714 } | 708 } |
715 } | 709 } |
716 #else | 710 #else |
717 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, | 711 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, |
718 GrFragmentProcessor** fp, | 712 GrFragmentProcessor** fp, |
719 GrXPFactory** xpf, | 713 GrXPFactory** xpf) { |
720 Coeff* src, Coeff* dst) { | |
721 return false; | 714 return false; |
722 } | 715 } |
723 #endif | 716 #endif |
724 | 717 |
725 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ | 718 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ |
726 // no-op. subclasses should override this | 719 // no-op. subclasses should override this |
727 return dst; | 720 return dst; |
728 } | 721 } |
729 | 722 |
730 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 723 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 } else { | 1952 } else { |
1960 proc16 = rec.fProc16_General; | 1953 proc16 = rec.fProc16_General; |
1961 } | 1954 } |
1962 } | 1955 } |
1963 return proc16; | 1956 return proc16; |
1964 } | 1957 } |
1965 | 1958 |
1966 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1959 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1967 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1960 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1968 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1961 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |