OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
9 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 84 } |
85 | 85 |
86 /////////////////////////////////////////////////////////////////////////////// | 86 /////////////////////////////////////////////////////////////////////////////// |
87 #if SK_SUPPORT_GPU | 87 #if SK_SUPPORT_GPU |
88 #include "GrBlend.h" | 88 #include "GrBlend.h" |
89 #include "GrInvariantOutput.h" | 89 #include "GrInvariantOutput.h" |
90 #include "effects/GrXfermodeFragmentProcessor.h" | 90 #include "effects/GrXfermodeFragmentProcessor.h" |
91 #include "effects/GrConstColorProcessor.h" | 91 #include "effects/GrConstColorProcessor.h" |
92 #include "SkGr.h" | 92 #include "SkGr.h" |
93 | 93 |
94 const GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*) co
nst { | 94 sk_sp<GrFragmentProcessor> SkModeColorFilter::asFragmentProcessor(GrContext*) co
nst { |
95 if (SkXfermode::kDst_Mode == fMode) { | 95 if (SkXfermode::kDst_Mode == fMode) { |
96 return nullptr; | 96 return nullptr; |
97 } | 97 } |
98 | 98 |
99 SkAutoTUnref<const GrFragmentProcessor> constFP( | 99 sk_sp<GrFragmentProcessor> constFP( |
100 GrConstColorProcessor::Create(SkColorToPremulGrColor(fColor), | 100 GrConstColorProcessor::Make(SkColorToPremulGrColor(fColor), |
101 GrConstColorProcessor::kIgnore_InputMode
)); | 101 GrConstColorProcessor::kIgnore_InputMode)); |
102 const GrFragmentProcessor* fp = | 102 sk_sp<GrFragmentProcessor> fp( |
103 GrXfermodeFragmentProcessor::CreateFromSrcProcessor(constFP, fMode); | 103 GrXfermodeFragmentProcessor::MakeFromSrcProcessor(std::move(constFP), fM
ode)); |
104 if (!fp) { | 104 if (!fp) { |
105 return nullptr; | 105 return nullptr; |
106 } | 106 } |
107 #ifdef SK_DEBUG | 107 #ifdef SK_DEBUG |
108 // With a solid color input this should always be able to compute the blende
d color | 108 // With a solid color input this should always be able to compute the blende
d color |
109 // (at least for coeff modes) | 109 // (at least for coeff modes) |
110 if (fMode <= SkXfermode::kLastCoeffMode) { | 110 if (fMode <= SkXfermode::kLastCoeffMode) { |
111 static SkRandom gRand; | 111 static SkRandom gRand; |
112 GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColorComponen
tFlags, | 112 GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColorComponen
tFlags, |
113 false); | 113 false); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 | 183 |
184 switch (mode) { | 184 switch (mode) { |
185 case SkXfermode::kSrc_Mode: | 185 case SkXfermode::kSrc_Mode: |
186 return sk_make_sp<Src_SkModeColorFilter>(color); | 186 return sk_make_sp<Src_SkModeColorFilter>(color); |
187 case SkXfermode::kSrcOver_Mode: | 187 case SkXfermode::kSrcOver_Mode: |
188 return sk_make_sp<SrcOver_SkModeColorFilter>(color); | 188 return sk_make_sp<SrcOver_SkModeColorFilter>(color); |
189 default: | 189 default: |
190 return SkModeColorFilter::Make(color, mode); | 190 return SkModeColorFilter::Make(color, mode); |
191 } | 191 } |
192 } | 192 } |
OLD | NEW |