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 "SkArithmeticMode_gpu.h" | 8 #include "SkArithmeticMode_gpu.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 fragBuilder->codeAppendf("%s.rgb = min(%s.rgb, %s.a);", | 51 fragBuilder->codeAppendf("%s.rgb = min(%s.rgb, %s.a);", |
52 outputColor, outputColor, outputColor); | 52 outputColor, outputColor, outputColor); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 class GLArithmeticFP : public GrGLSLFragmentProcessor { | 56 class GLArithmeticFP : public GrGLSLFragmentProcessor { |
57 public: | 57 public: |
58 void emitCode(EmitArgs& args) override { | 58 void emitCode(EmitArgs& args) override { |
59 const GrArithmeticFP& arith = args.fFp.cast<GrArithmeticFP>(); | 59 const GrArithmeticFP& arith = args.fFp.cast<GrArithmeticFP>(); |
60 | 60 |
61 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 61 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
62 SkString dstColor("dstColor"); | 62 SkString dstColor("dstColor"); |
63 this->emitChild(0, nullptr, &dstColor, args); | 63 this->emitChild(0, nullptr, &dstColor, args); |
64 | 64 |
65 fKUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, | 65 fKUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, |
66 kVec4f_GrSLType, kDefault_GrSLP
recision, | 66 kVec4f_GrSLType, kDefault_GrSLP
recision, |
67 "k"); | 67 "k"); |
68 const char* kUni = args.fUniformHandler->getUniformCStr(fKUni); | 68 const char* kUni = args.fUniformHandler->getUniformCStr(fKUni); |
69 | 69 |
70 add_arithmetic_code(fragBuilder, | 70 add_arithmetic_code(fragBuilder, |
71 args.fInputColor, | 71 args.fInputColor, |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 float k1 = d->fRandom->nextF(); | 298 float k1 = d->fRandom->nextF(); |
299 float k2 = d->fRandom->nextF(); | 299 float k2 = d->fRandom->nextF(); |
300 float k3 = d->fRandom->nextF(); | 300 float k3 = d->fRandom->nextF(); |
301 float k4 = d->fRandom->nextF(); | 301 float k4 = d->fRandom->nextF(); |
302 bool enforcePMColor = d->fRandom->nextBool(); | 302 bool enforcePMColor = d->fRandom->nextBool(); |
303 | 303 |
304 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); | 304 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); |
305 } | 305 } |
306 | 306 |
307 #endif | 307 #endif |
OLD | NEW |