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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, |
72 dstColor.c_str(), | 72 dstColor.c_str(), |
73 args.fOutputColor, | 73 args.fOutputColor, |
74 kUni, | 74 kUni, |
75 arith.enforcePMColor()); | 75 arith.enforcePMColor()); |
76 } | 76 } |
77 | 77 |
78 static void GenKey(const GrProcessor& proc, const GrGLSLCaps& caps, GrProces
sorKeyBuilder* b) { | 78 static void GenKey(const GrProcessor& proc, const GrGLSLCaps&, GrProcessorKe
yBuilder* b) { |
79 const GrArithmeticFP& arith = proc.cast<GrArithmeticFP>(); | 79 const GrArithmeticFP& arith = proc.cast<GrArithmeticFP>(); |
80 uint32_t key = arith.enforcePMColor() ? 1 : 0; | 80 uint32_t key = arith.enforcePMColor() ? 1 : 0; |
81 b->add32(key); | 81 b->add32(key); |
82 } | 82 } |
83 | 83 |
84 protected: | 84 protected: |
85 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& pro
c) override { | 85 void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& pro
c) override { |
86 const GrArithmeticFP& arith = proc.cast<GrArithmeticFP>(); | 86 const GrArithmeticFP& arith = proc.cast<GrArithmeticFP>(); |
87 pdman.set4f(fKUni, arith.k1(), arith.k2(), arith.k3(), arith.k4()); | 87 pdman.set4f(fKUni, arith.k1(), arith.k2(), arith.k3(), arith.k4()); |
88 } | 88 } |
(...skipping 209 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 |