Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: src/core/SkXfermode.cpp

Issue 1455273006: Make specialized SrcOver XPFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 649
650 bool SkXfermode::asMode(Mode* mode) const { 650 bool SkXfermode::asMode(Mode* mode) const {
651 return false; 651 return false;
652 } 652 }
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(const GrXPFactory**) const {
660 return false; 660 return false;
661 } 661 }
662 662
663 663
664 #if SK_SUPPORT_GPU 664 #if SK_SUPPORT_GPU
665 #include "effects/GrPorterDuffXferProcessor.h" 665 #include "effects/GrPorterDuffXferProcessor.h"
666 666
667 bool SkXfermode::AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) { 667 bool SkXfermode::AsXPFactory(SkXfermode* xfermode, const GrXPFactory** xpf) {
668 if (nullptr == xfermode) { 668 if (nullptr == xfermode) {
669 if (xpf) { 669 if (xpf) {
670 *xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode); 670 *xpf = GrPorterDuffXPFactory::Create(kSrcOver_Mode);
671 } 671 }
672 return true; 672 return true;
673 } else { 673 } else {
674 return xfermode->asXPFactory(xpf); 674 return xfermode->asXPFactory(xpf);
675 } 675 }
676 } 676 }
677 #else 677 #else
678 bool SkXfermode::AsXPFactory(SkXfermode* xfermode, GrXPFactory** xpf) { 678 bool SkXfermode::AsXPFactory(SkXfermode* xfermode, const GrXPFactory** xpf) {
679 return false; 679 return false;
680 } 680 }
681 #endif 681 #endif
682 682
683 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ 683 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{
684 // no-op. subclasses should override this 684 // no-op. subclasses should override this
685 return dst; 685 return dst;
686 } 686 }
687 687
688 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst, 688 void SkXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp, 925 bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp,
926 const GrFragmentProcessor* dst) co nst { 926 const GrFragmentProcessor* dst) co nst {
927 if (fp) { 927 if (fp) {
928 SkASSERT(dst); 928 SkASSERT(dst);
929 *fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode); 929 *fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode);
930 SkASSERT(*fp || kSrc_Mode == fMode); 930 SkASSERT(*fp || kSrc_Mode == fMode);
931 } 931 }
932 return true; 932 return true;
933 } 933 }
934 934
935 bool SkProcCoeffXfermode::asXPFactory(GrXPFactory** xp) const { 935 bool SkProcCoeffXfermode::asXPFactory(const GrXPFactory** xp) const {
936 if (CANNOT_USE_COEFF != fSrcCoeff) { 936 if (CANNOT_USE_COEFF != fSrcCoeff) {
937 if (xp) { 937 if (xp) {
938 *xp = GrPorterDuffXPFactory::Create(fMode); 938 *xp = GrPorterDuffXPFactory::Create(fMode);
939 SkASSERT(*xp); 939 SkASSERT(*xp);
940 } 940 }
941 return true; 941 return true;
942 } 942 }
943 943
944 if (GrCustomXfermode::IsSupportedMode(fMode)) { 944 if (GrCustomXfermode::IsSupportedMode(fMode)) {
945 if (xp) { 945 if (xp) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 if (!xfer) { 1083 if (!xfer) {
1084 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; 1084 return SkXfermode::kOpaque_SrcColorOpacity == opacityType;
1085 } 1085 }
1086 1086
1087 return xfer->isOpaque(opacityType); 1087 return xfer->isOpaque(opacityType);
1088 } 1088 }
1089 1089
1090 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1090 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1091 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1091 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1092 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1092 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698