wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 1 | /* |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 2 | * Copyright 2015 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 7 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 8 | #include "src/gpu/effects/GrBlendFragmentProcessor.h" |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "src/gpu/GrFragmentProcessor.h" |
| 11 | #include "src/gpu/SkGr.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "src/gpu/glsl/GrGLSLBlend.h" |
| 13 | #include "src/gpu/glsl/GrGLSLFragmentProcessor.h" |
| 14 | #include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h" |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 15 | |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 16 | // Some of the CPU implementations of blend modes differ from the GPU enough that |
| 17 | // we can't use the CPU implementation to implement constantOutputForConstantInput. |
Brian Salomon | 246a3c2 | 2017-02-10 16:16:21 -0500 | [diff] [blame] | 18 | static inline bool does_cpu_blend_impl_match_gpu(SkBlendMode mode) { |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 19 | // The non-separable modes differ too much. So does SoftLight. ColorBurn differs too much on our |
| 20 | // test iOS device, but we just disable it across the board since it might differ on untested |
| 21 | // GPUs. |
Brian Salomon | 246a3c2 | 2017-02-10 16:16:21 -0500 | [diff] [blame] | 22 | return mode <= SkBlendMode::kLastSeparableMode && mode != SkBlendMode::kSoftLight && |
| 23 | mode != SkBlendMode::kColorBurn; |
| 24 | } |
| 25 | |
| 26 | ////////////////////////////////////////////////////////////////////////////// |
| 27 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 28 | class BlendFragmentProcessor : public GrFragmentProcessor { |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 29 | public: |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 30 | static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> src, |
| 31 | std::unique_ptr<GrFragmentProcessor> dst, |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 32 | SkBlendMode mode) { |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 33 | return std::unique_ptr<GrFragmentProcessor>( |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 34 | new BlendFragmentProcessor(std::move(src), std::move(dst), mode)); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 35 | } |
| 36 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 37 | const char* name() const override { return "Blend"; } |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 38 | |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 39 | std::unique_ptr<GrFragmentProcessor> clone() const override; |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 40 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 41 | SkBlendMode getMode() const { return fMode; } |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 42 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 43 | private: |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 44 | BlendFragmentProcessor(std::unique_ptr<GrFragmentProcessor> src, |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 45 | std::unique_ptr<GrFragmentProcessor> dst, |
| 46 | SkBlendMode mode) |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 47 | : INHERITED(kBlendFragmentProcessor_ClassID, OptFlags(src.get(), dst.get(), mode)) |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 48 | , fMode(mode) { |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 49 | this->setIsBlendFunction(); |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 50 | this->registerChild(std::move(src)); |
| 51 | this->registerChild(std::move(dst)); |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 52 | } |
| 53 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 54 | BlendFragmentProcessor(const BlendFragmentProcessor& that) |
John Stiles | 307f8f5 | 2021-08-09 15:36:59 -0400 | [diff] [blame^] | 55 | : INHERITED(that) |
| 56 | , fMode(that.fMode) {} |
Robert Phillips | 1c9686b | 2017-06-30 08:40:28 -0400 | [diff] [blame] | 57 | |
John Stiles | af36652 | 2020-08-13 09:57:34 -0400 | [diff] [blame] | 58 | #if GR_TEST_UTILS |
| 59 | SkString onDumpInfo() const override { |
| 60 | return SkStringPrintf("(fMode=%s)", SkBlendMode_Name(fMode)); |
| 61 | } |
| 62 | #endif |
| 63 | |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 64 | static OptimizationFlags OptFlags(const GrFragmentProcessor* src, |
| 65 | const GrFragmentProcessor* dst, SkBlendMode mode) { |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 66 | OptimizationFlags flags; |
| 67 | switch (mode) { |
| 68 | case SkBlendMode::kClear: |
| 69 | case SkBlendMode::kSrc: |
| 70 | case SkBlendMode::kDst: |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 71 | SkDEBUGFAIL("Shouldn't have created a Blend FP as 'clear', 'src', or 'dst'."); |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 72 | flags = kNone_OptimizationFlags; |
| 73 | break; |
| 74 | |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 75 | // Produces opaque if both src and dst are opaque. These also will modulate the child's |
| 76 | // output by either the input color or alpha. However, if the child is not compatible |
| 77 | // with the coverage as alpha then it may produce a color that is not valid premul. |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 78 | case SkBlendMode::kSrcIn: |
| 79 | case SkBlendMode::kDstIn: |
| 80 | case SkBlendMode::kModulate: |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 81 | if (src && dst) { |
| 82 | flags = ProcessorOptimizationFlags(src) & ProcessorOptimizationFlags(dst) & |
| 83 | kPreservesOpaqueInput_OptimizationFlag; |
| 84 | } else if (src) { |
| 85 | flags = ProcessorOptimizationFlags(src) & |
| 86 | ~kConstantOutputForConstantInput_OptimizationFlag; |
| 87 | } else if (dst) { |
| 88 | flags = ProcessorOptimizationFlags(dst) & |
| 89 | ~kConstantOutputForConstantInput_OptimizationFlag; |
| 90 | } else { |
| 91 | flags = kNone_OptimizationFlags; |
| 92 | } |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 93 | break; |
| 94 | |
| 95 | // Produces zero when both are opaque, indeterminate if one is opaque. |
| 96 | case SkBlendMode::kSrcOut: |
| 97 | case SkBlendMode::kDstOut: |
| 98 | case SkBlendMode::kXor: |
| 99 | flags = kNone_OptimizationFlags; |
| 100 | break; |
| 101 | |
| 102 | // Is opaque if the dst is opaque. |
| 103 | case SkBlendMode::kSrcATop: |
Brian Osman | 8f39137 | 2021-04-29 15:27:34 -0400 | [diff] [blame] | 104 | flags = ProcessorOptimizationFlags(dst) & kPreservesOpaqueInput_OptimizationFlag; |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 105 | break; |
| 106 | |
| 107 | // DstATop is the converse of kSrcATop. Screen is also opaque if the src is a opaque. |
| 108 | case SkBlendMode::kDstATop: |
| 109 | case SkBlendMode::kScreen: |
Brian Osman | 8f39137 | 2021-04-29 15:27:34 -0400 | [diff] [blame] | 110 | flags = ProcessorOptimizationFlags(src) & kPreservesOpaqueInput_OptimizationFlag; |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 111 | break; |
| 112 | |
| 113 | // These modes are all opaque if either src or dst is opaque. All the advanced modes |
| 114 | // compute alpha as src-over. |
| 115 | case SkBlendMode::kSrcOver: |
| 116 | case SkBlendMode::kDstOver: |
| 117 | case SkBlendMode::kPlus: |
| 118 | case SkBlendMode::kOverlay: |
| 119 | case SkBlendMode::kDarken: |
| 120 | case SkBlendMode::kLighten: |
| 121 | case SkBlendMode::kColorDodge: |
| 122 | case SkBlendMode::kColorBurn: |
| 123 | case SkBlendMode::kHardLight: |
| 124 | case SkBlendMode::kSoftLight: |
| 125 | case SkBlendMode::kDifference: |
| 126 | case SkBlendMode::kExclusion: |
| 127 | case SkBlendMode::kMultiply: |
| 128 | case SkBlendMode::kHue: |
| 129 | case SkBlendMode::kSaturation: |
| 130 | case SkBlendMode::kColor: |
| 131 | case SkBlendMode::kLuminosity: |
Brian Osman | 8f39137 | 2021-04-29 15:27:34 -0400 | [diff] [blame] | 132 | flags = (ProcessorOptimizationFlags(src) | ProcessorOptimizationFlags(dst)) & |
| 133 | kPreservesOpaqueInput_OptimizationFlag; |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 134 | break; |
| 135 | } |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 136 | if (does_cpu_blend_impl_match_gpu(mode) && |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 137 | (!src || src->hasConstantOutputForConstantInput()) && |
| 138 | (!dst || dst->hasConstantOutputForConstantInput())) { |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 139 | flags |= kConstantOutputForConstantInput_OptimizationFlag; |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 140 | } |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 141 | return flags; |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 142 | } |
| 143 | |
Brian Salomon | 13b2873 | 2021-08-06 15:33:58 -0400 | [diff] [blame] | 144 | void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const override { |
Brian Salomon | fb7c83a | 2017-07-26 13:57:33 -0400 | [diff] [blame] | 145 | b->add32((int)fMode); |
| 146 | } |
| 147 | |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 148 | bool onIsEqual(const GrFragmentProcessor& other) const override { |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 149 | const BlendFragmentProcessor& cs = other.cast<BlendFragmentProcessor>(); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 150 | return fMode == cs.fMode; |
| 151 | } |
| 152 | |
Brian Osman | 1d5b598 | 2018-10-01 13:41:39 -0400 | [diff] [blame] | 153 | SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override { |
Brian Osman | 12c5d29 | 2020-07-13 16:11:35 -0400 | [diff] [blame] | 154 | const auto* src = this->childProcessor(0); |
| 155 | const auto* dst = this->childProcessor(1); |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 156 | |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 157 | SkPMColor4f srcColor = ConstantOutputForConstantInput(src, input); |
| 158 | SkPMColor4f dstColor = ConstantOutputForConstantInput(dst, input); |
John Stiles | 09dbeff | 2020-06-30 14:07:57 -0400 | [diff] [blame] | 159 | |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 160 | return SkBlendMode_Apply(fMode, srcColor, dstColor); |
Brian Salomon | 587e08f | 2017-01-27 10:59:27 -0500 | [diff] [blame] | 161 | } |
| 162 | |
Brian Salomon | 3176e86 | 2021-08-09 11:23:04 -0400 | [diff] [blame] | 163 | std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override; |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 164 | |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 165 | SkBlendMode fMode; |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 166 | |
Brian Salomon | 0c26a9d | 2017-07-06 10:09:38 -0400 | [diff] [blame] | 167 | GR_DECLARE_FRAGMENT_PROCESSOR_TEST |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 168 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 169 | using INHERITED = GrFragmentProcessor; |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 170 | }; |
| 171 | |
| 172 | ///////////////////////////////////////////////////////////////////// |
| 173 | |
Brian Salomon | 3176e86 | 2021-08-09 11:23:04 -0400 | [diff] [blame] | 174 | class GLBlendFragmentProcessor : public GrFragmentProcessor::ProgramImpl { |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 175 | public: |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 176 | void emitCode(EmitArgs&) override; |
| 177 | |
| 178 | private: |
Brian Salomon | 3176e86 | 2021-08-09 11:23:04 -0400 | [diff] [blame] | 179 | using INHERITED = ProgramImpl; |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 180 | }; |
| 181 | |
| 182 | ///////////////////////////////////////////////////////////////////// |
| 183 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 184 | GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BlendFragmentProcessor); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 185 | |
Hal Canary | 6f6961e | 2017-01-31 13:50:44 -0500 | [diff] [blame] | 186 | #if GR_TEST_UTILS |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 187 | std::unique_ptr<GrFragmentProcessor> BlendFragmentProcessor::TestCreate(GrProcessorTestData* d) { |
John Stiles | 87d0a2f | 2020-08-10 13:12:41 -0400 | [diff] [blame] | 188 | // Create one or two random fragment processors. |
| 189 | std::unique_ptr<GrFragmentProcessor> src(GrProcessorUnitTest::MakeOptionalChildFP(d)); |
| 190 | std::unique_ptr<GrFragmentProcessor> dst(GrProcessorUnitTest::MakeChildFP(d)); |
| 191 | if (d->fRandom->nextBool()) { |
| 192 | std::swap(src, dst); |
| 193 | } |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 194 | |
Brian Salomon | a12c153 | 2017-02-13 12:41:44 -0500 | [diff] [blame] | 195 | SkBlendMode mode; |
| 196 | do { |
| 197 | mode = static_cast<SkBlendMode>(d->fRandom->nextRangeU(0, (int)SkBlendMode::kLastMode)); |
| 198 | } while (SkBlendMode::kClear == mode || SkBlendMode::kSrc == mode || SkBlendMode::kDst == mode); |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 199 | return std::unique_ptr<GrFragmentProcessor>( |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 200 | new BlendFragmentProcessor(std::move(src), std::move(dst), mode)); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 201 | } |
Hal Canary | 6f6961e | 2017-01-31 13:50:44 -0500 | [diff] [blame] | 202 | #endif |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 203 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 204 | std::unique_ptr<GrFragmentProcessor> BlendFragmentProcessor::clone() const { |
| 205 | return std::unique_ptr<GrFragmentProcessor>(new BlendFragmentProcessor(*this)); |
Brian Salomon | fb7c83a | 2017-07-26 13:57:33 -0400 | [diff] [blame] | 206 | } |
| 207 | |
Brian Salomon | 3176e86 | 2021-08-09 11:23:04 -0400 | [diff] [blame] | 208 | std::unique_ptr<GrFragmentProcessor::ProgramImpl> BlendFragmentProcessor::onMakeProgramImpl() const { |
Brian Salomon | 18ab203 | 2021-02-23 10:07:05 -0500 | [diff] [blame] | 209 | return std::make_unique<GLBlendFragmentProcessor>(); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | ///////////////////////////////////////////////////////////////////// |
| 213 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 214 | void GLBlendFragmentProcessor::emitCode(EmitArgs& args) { |
cdalton | 8528541 | 2016-02-18 12:37:07 -0800 | [diff] [blame] | 215 | GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 216 | const BlendFragmentProcessor& cs = args.fFp.cast<BlendFragmentProcessor>(); |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 217 | SkBlendMode mode = cs.getMode(); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 218 | |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 219 | fragBuilder->codeAppendf("// Blend mode: %s\n", SkBlendMode_Name(mode)); |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 220 | |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 221 | // Invoke src/dst with our input color (or substitute input color if no child FP) |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 222 | SkString srcColor = this->invokeChild(0, args); |
| 223 | SkString dstColor = this->invokeChild(1, args); |
Ethan Nicholas | 62ae664 | 2017-07-10 17:43:15 +0000 | [diff] [blame] | 224 | |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 225 | // Blend src and dst colors together. |
John Stiles | 04c6122 | 2021-07-29 19:36:49 -0400 | [diff] [blame] | 226 | fragBuilder->codeAppendf("return %s(%s, %s);", GrGLSLBlend::BlendFuncName(mode), |
John Stiles | 4964300 | 2020-10-19 18:52:40 -0400 | [diff] [blame] | 227 | srcColor.c_str(), dstColor.c_str()); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 228 | } |
| 229 | |
John Stiles | 5c57e88 | 2020-06-30 14:05:03 -0400 | [diff] [blame] | 230 | ////////////////////////////////////////////////////////////////////////////// |
| 231 | |
John Stiles | f743d4e | 2020-07-23 11:35:08 -0400 | [diff] [blame] | 232 | std::unique_ptr<GrFragmentProcessor> GrBlendFragmentProcessor::Make( |
Brian Salomon | aff329b | 2017-08-11 09:40:37 -0400 | [diff] [blame] | 233 | std::unique_ptr<GrFragmentProcessor> src, |
| 234 | std::unique_ptr<GrFragmentProcessor> dst, |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 235 | SkBlendMode mode) { |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 236 | switch (mode) { |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 237 | case SkBlendMode::kClear: |
Brian Salomon | 354147a | 2021-04-14 11:15:05 -0400 | [diff] [blame] | 238 | return GrFragmentProcessor::MakeColor(SK_PMColor4fTRANSPARENT); |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 239 | case SkBlendMode::kSrc: |
Brian Salomon | 8573dab | 2021-07-08 13:58:47 -0400 | [diff] [blame] | 240 | return src; |
Mike Reed | 7d954ad | 2016-10-28 15:42:34 -0400 | [diff] [blame] | 241 | case SkBlendMode::kDst: |
Brian Salomon | 8573dab | 2021-07-08 13:58:47 -0400 | [diff] [blame] | 242 | return dst; |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 243 | default: |
Brian Salomon | 4b6e2f0 | 2021-07-08 14:04:21 -0400 | [diff] [blame] | 244 | return BlendFragmentProcessor::Make(std::move(src), std::move(dst), mode); |
wangyix | 809e5af | 2015-09-09 12:58:32 -0700 | [diff] [blame] | 245 | } |
| 246 | } |