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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 private: | 88 private: |
89 GrGLProgramDataManager::UniformHandle fKUni; | 89 GrGLProgramDataManager::UniformHandle fKUni; |
90 bool fEnforcePMColor; | 90 bool fEnforcePMColor; |
91 | 91 |
92 typedef GrGLFragmentProcessor INHERITED; | 92 typedef GrGLFragmentProcessor INHERITED; |
93 }; | 93 }; |
94 | 94 |
95 /////////////////////////////////////////////////////////////////////////////// | 95 /////////////////////////////////////////////////////////////////////////////// |
96 | 96 |
97 GrArithmeticFP::GrArithmeticFP(GrProcessorDataManager*, float k1, float k2, floa
t k3, float k4, | 97 GrArithmeticFP::GrArithmeticFP(float k1, float k2, float k3, float k4, bool enfo
rcePMColor, |
98 bool enforcePMColor, const GrFragmentProcessor* d
st) | 98 const GrFragmentProcessor* dst) |
99 : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) { | 99 : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) { |
100 this->initClassID<GrArithmeticFP>(); | 100 this->initClassID<GrArithmeticFP>(); |
101 | 101 |
102 SkASSERT(dst); | 102 SkASSERT(dst); |
103 SkDEBUGCODE(int dstIndex = )this->registerChildProcessor(dst); | 103 SkDEBUGCODE(int dstIndex = )this->registerChildProcessor(dst); |
104 SkASSERT(0 == dstIndex); | 104 SkASSERT(0 == dstIndex); |
105 } | 105 } |
106 | 106 |
107 void GrArithmeticFP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB
uilder* b) const { | 107 void GrArithmeticFP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB
uilder* b) const { |
108 GLArithmeticFP::GenKey(*this, caps, b); | 108 GLArithmeticFP::GenKey(*this, caps, b); |
(...skipping 20 matching lines...) Expand all Loading... |
129 /////////////////////////////////////////////////////////////////////////////// | 129 /////////////////////////////////////////////////////////////////////////////// |
130 | 130 |
131 const GrFragmentProcessor* GrArithmeticFP::TestCreate(GrProcessorTestData* d) { | 131 const GrFragmentProcessor* GrArithmeticFP::TestCreate(GrProcessorTestData* d) { |
132 float k1 = d->fRandom->nextF(); | 132 float k1 = d->fRandom->nextF(); |
133 float k2 = d->fRandom->nextF(); | 133 float k2 = d->fRandom->nextF(); |
134 float k3 = d->fRandom->nextF(); | 134 float k3 = d->fRandom->nextF(); |
135 float k4 = d->fRandom->nextF(); | 135 float k4 = d->fRandom->nextF(); |
136 bool enforcePMColor = d->fRandom->nextBool(); | 136 bool enforcePMColor = d->fRandom->nextBool(); |
137 | 137 |
138 SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChild
FP(d)); | 138 SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChild
FP(d)); |
139 return new GrArithmeticFP(d->fProcDataManager, k1, k2, k3, k4, enforcePMColo
r, dst); | 139 return new GrArithmeticFP(k1, k2, k3, k4, enforcePMColor, dst); |
140 } | 140 } |
141 | 141 |
142 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP); | 142 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP); |
143 | 143 |
144 /////////////////////////////////////////////////////////////////////////////// | 144 /////////////////////////////////////////////////////////////////////////////// |
145 // Xfer Processor | 145 // Xfer Processor |
146 /////////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////////// |
147 | 147 |
148 class ArithmeticXP : public GrXferProcessor { | 148 class ArithmeticXP : public GrXferProcessor { |
149 public: | 149 public: |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 float k1 = d->fRandom->nextF(); | 291 float k1 = d->fRandom->nextF(); |
292 float k2 = d->fRandom->nextF(); | 292 float k2 = d->fRandom->nextF(); |
293 float k3 = d->fRandom->nextF(); | 293 float k3 = d->fRandom->nextF(); |
294 float k4 = d->fRandom->nextF(); | 294 float k4 = d->fRandom->nextF(); |
295 bool enforcePMColor = d->fRandom->nextBool(); | 295 bool enforcePMColor = d->fRandom->nextBool(); |
296 | 296 |
297 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); | 297 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); |
298 } | 298 } |
299 | 299 |
300 #endif | 300 #endif |
OLD | NEW |