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 | |
10 #include "SkXfermode.h" | 9 #include "SkXfermode.h" |
11 #include "SkXfermode_opts_SSE2.h" | 10 #include "SkXfermode_opts_SSE2.h" |
12 #include "SkXfermode_proccoeff.h" | 11 #include "SkXfermode_proccoeff.h" |
13 #include "SkColorPriv.h" | 12 #include "SkColorPriv.h" |
14 #include "SkLazyPtr.h" | 13 #include "SkLazyPtr.h" |
15 #include "SkMathPriv.h" | 14 #include "SkMathPriv.h" |
16 #include "SkReadBuffer.h" | 15 #include "SkReadBuffer.h" |
17 #include "SkString.h" | 16 #include "SkString.h" |
18 #include "SkUtilsArm.h" | 17 #include "SkUtilsArm.h" |
19 #include "SkWriteBuffer.h" | 18 #include "SkWriteBuffer.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 } | 672 } |
674 | 673 |
675 bool SkXfermode::asMode(Mode* mode) const { | 674 bool SkXfermode::asMode(Mode* mode) const { |
676 return false; | 675 return false; |
677 } | 676 } |
678 | 677 |
679 bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrTexture*) const { | 678 bool SkXfermode::asFragmentProcessor(GrFragmentProcessor**, GrTexture*) const { |
680 return false; | 679 return false; |
681 } | 680 } |
682 | 681 |
683 bool SkXfermode::asFragmentProcessorOrCoeff(SkXfermode* xfermode, GrFragmentProc essor** fp, | 682 bool SkXfermode::asXPFactory(GrXPFactory**) const { |
684 Coeff* src, Coeff* dst, GrTexture* b ackground) { | 683 return false; |
684 } | |
685 | |
686 | |
687 #if SK_SUPPORT_GPU | |
688 #include "effects/GrPorterDuffXferProcessor.h" | |
689 | |
690 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, | |
691 GrFragmentProcessor** fp, | |
692 GrXPFactory** xpf, | |
693 Coeff* src, Coeff* dst) { | |
685 if (NULL == xfermode) { | 694 if (NULL == xfermode) { |
686 return ModeAsCoeff(kSrcOver_Mode, src, dst); | 695 SkAssertResult(ModeAsCoeff(kSrcOver_Mode, src, dst)); |
696 *xpf = GrPorterDuffXPFactory::Create(*src, *dst); | |
697 return true; | |
687 } else if (xfermode->asCoeff(src, dst)) { | 698 } else if (xfermode->asCoeff(src, dst)) { |
699 *xpf = GrPorterDuffXPFactory::Create(*src, *dst); | |
700 return true; | |
701 } else if (xfermode->asXPFactory(xpf)) { | |
702 *src = SkXfermode::kOne_Coeff; | |
703 *src = SkXfermode::kZero_Coeff; | |
bsalomon
2014/12/02 15:36:32
Should this be dst?
Is it possible to stop having
egdaniel
2014/12/02 18:09:51
Yeah should be dst. All these src and dst things g
| |
688 return true; | 704 return true; |
689 } else { | 705 } else { |
690 return xfermode->asFragmentProcessor(fp, background); | 706 return xfermode->asFragmentProcessor(fp); |
691 } | 707 } |
692 } | 708 } |
709 #else | |
710 bool SkXfermode::AsFragmentProcessorOrXPFactory(SkXfermode* xfermode, | |
711 GrFragmentProcessor** fp, | |
712 GrXPFactory** xpf, | |
713 Coeff* src, Coeff* dst, | |
714 GrTexture* background) { | |
715 return false; | |
716 } | |
717 #endif | |
693 | 718 |
694 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ | 719 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ |
695 // no-op. subclasses should override this | 720 // no-op. subclasses should override this |
696 return dst; | 721 return dst; |
697 } | 722 } |
698 | 723 |
699 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, | 724 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, |
700 const SkPMColor* SK_RESTRICT src, int count, | 725 const SkPMColor* SK_RESTRICT src, int count, |
701 const SkAlpha* SK_RESTRICT aa) const { | 726 const SkAlpha* SK_RESTRICT aa) const { |
702 SkASSERT(dst && src && count >= 0); | 727 SkASSERT(dst && src && count >= 0); |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1953 } else { | 1978 } else { |
1954 proc16 = rec.fProc16_General; | 1979 proc16 = rec.fProc16_General; |
1955 } | 1980 } |
1956 } | 1981 } |
1957 return proc16; | 1982 return proc16; |
1958 } | 1983 } |
1959 | 1984 |
1960 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1985 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1961 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1986 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1987 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |