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

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

Issue 1334293003: Create fragment processor for performing input color blend with child processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 3 months 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 | « src/core/SkComposeShader.cpp ('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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 { color_modeproc, CANNOT_USE_COEFF, CANNOT_USE_COEFF }, 644 { color_modeproc, CANNOT_USE_COEFF, CANNOT_USE_COEFF },
645 { luminosity_modeproc, CANNOT_USE_COEFF, CANNOT_USE_COEFF }, 645 { luminosity_modeproc, CANNOT_USE_COEFF, CANNOT_USE_COEFF },
646 }; 646 };
647 647
648 /////////////////////////////////////////////////////////////////////////////// 648 ///////////////////////////////////////////////////////////////////////////////
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(GrFragmentProcessor**, GrProcessorDataManag er*, 654 bool SkXfermode::asFragmentProcessor(const GrFragmentProcessor**, GrProcessorDat aManager*,
655 GrTexture*) 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 663
664 #if SK_SUPPORT_GPU 664 #if SK_SUPPORT_GPU
665 #include "effects/GrPorterDuffXferProcessor.h" 665 #include "effects/GrPorterDuffXferProcessor.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 913 }
914 dst[i] = SkToU8(A); 914 dst[i] = SkToU8(A);
915 } 915 }
916 } 916 }
917 } 917 }
918 } 918 }
919 } 919 }
920 920
921 #if SK_SUPPORT_GPU 921 #if SK_SUPPORT_GPU
922 #include "effects/GrCustomXfermode.h" 922 #include "effects/GrCustomXfermode.h"
923 #include "effects/GrXfermodeFragmentProcessor.h"
923 924
924 bool SkProcCoeffXfermode::asFragmentProcessor(GrFragmentProcessor** fp, 925 bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp,
925 GrProcessorDataManager* procDataMa nager, 926 GrProcessorDataManager* procDataMa nager,
926 GrTexture* background) const { 927 const GrFragmentProcessor* dst) co nst {
927 if (GrCustomXfermode::IsSupportedMode(fMode)) { 928 if (fp) {
928 if (fp) { 929 SkASSERT(dst);
929 SkASSERT(procDataManager); 930 SkASSERT(procDataManager);
930 *fp = GrCustomXfermode::CreateFP(procDataManager, fMode, background) ; 931 *fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode);
931 SkASSERT(*fp); 932 SkASSERT(*fp || kSrc_Mode == fMode);
932 }
933 return true;
934 } 933 }
935 return false; 934 return true;
936 } 935 }
937 936
938 bool SkProcCoeffXfermode::asXPFactory(GrXPFactory** xp) const { 937 bool SkProcCoeffXfermode::asXPFactory(GrXPFactory** xp) const {
939 if (CANNOT_USE_COEFF != fSrcCoeff) { 938 if (CANNOT_USE_COEFF != fSrcCoeff) {
940 if (xp) { 939 if (xp) {
941 *xp = GrPorterDuffXPFactory::Create(fMode); 940 *xp = GrPorterDuffXPFactory::Create(fMode);
942 SkASSERT(*xp); 941 SkASSERT(*xp);
943 } 942 }
944 return true; 943 return true;
945 } 944 }
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 if (!xfer) { 1085 if (!xfer) {
1087 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; 1086 return SkXfermode::kOpaque_SrcColorOpacity == opacityType;
1088 } 1087 }
1089 1088
1090 return xfer->isOpaque(opacityType); 1089 return xfer->isOpaque(opacityType);
1091 } 1090 }
1092 1091
1093 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1092 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1094 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1093 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1095 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1094 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkComposeShader.cpp ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698