OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "effects/GrCustomXfermode.h" | 8 #include "effects/GrCustomXfermode.h" |
9 | 9 |
10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Apply coverage by multiplying it into the src color before blending.
Mixed samples will | 153 // Apply coverage by multiplying it into the src color before blending.
Mixed samples will |
154 // "just work" automatically. (See onGetOptimizations()) | 154 // "just work" automatically. (See onGetOptimizations()) |
155 if (xp.readsCoverage()) { | 155 if (xp.readsCoverage()) { |
156 fsBuilder->codeAppendf("%s = %s * %s;", | 156 fsBuilder->codeAppendf("%s = %s * %s;", |
157 args.fOutputPrimary, args.fInputCoverage, arg
s.fInputColor); | 157 args.fOutputPrimary, args.fInputCoverage, arg
s.fInputColor); |
158 } else { | 158 } else { |
159 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputC
olor); | 159 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputC
olor); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 void emitBlendCodeForDstRead(GrGLXPBuilder* pb, const char* srcColor, const
char* dstColor, | 163 void emitBlendCodeForDstRead(GrGLSLXPBuilder* pb, const char* srcColor, cons
t char* dstColor, |
164 const char* outColor, const GrXferProcessor& pr
oc) override { | 164 const char* outColor, const GrXferProcessor& pr
oc) override { |
165 const CustomXP& xp = proc.cast<CustomXP>(); | 165 const CustomXP& xp = proc.cast<CustomXP>(); |
166 SkASSERT(!xp.hasHWBlendEquation()); | 166 SkASSERT(!xp.hasHWBlendEquation()); |
167 | 167 |
168 GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); | 168 GrGLXPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder(); |
169 GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode
()); | 169 GrGLSLBlend::AppendMode(fsBuilder, srcColor, dstColor, outColor, xp.mode
()); |
170 } | 170 } |
171 | 171 |
172 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over
ride {} | 172 void onSetData(const GrGLSLProgramDataManager&, const GrXferProcessor&) over
ride {} |
173 | 173 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 /////////////////////////////////////////////////////////////////////////////// | 394 /////////////////////////////////////////////////////////////////////////////// |
395 | 395 |
396 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { | 396 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) { |
397 if (!GrCustomXfermode::IsSupportedMode(mode)) { | 397 if (!GrCustomXfermode::IsSupportedMode(mode)) { |
398 return nullptr; | 398 return nullptr; |
399 } else { | 399 } else { |
400 return new CustomXPFactory(mode); | 400 return new CustomXPFactory(mode); |
401 } | 401 } |
402 } | 402 } |
OLD | NEW |