OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPixelXorXfermode.h" | 8 #include "SkPixelXorXfermode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 SkPMColor fOpColor; | 164 SkPMColor fOpColor; |
165 | 165 |
166 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 166 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
167 typedef GrFragmentProcessor INHERITED; | 167 typedef GrFragmentProcessor INHERITED; |
168 }; | 168 }; |
169 | 169 |
170 /////////////////////////////////////////////////////////////////////////////// | 170 /////////////////////////////////////////////////////////////////////////////// |
171 | 171 |
172 class GLPixelXorFP : public GrGLSLFragmentProcessor { | 172 class GLPixelXorFP : public GrGLSLFragmentProcessor { |
173 public: | 173 public: |
174 GLPixelXorFP(const PixelXorFP&) {} | |
175 | |
176 ~GLPixelXorFP() override {} | |
177 | |
178 void emitCode(EmitArgs& args) override { | 174 void emitCode(EmitArgs& args) override { |
179 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 175 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
180 SkString dstColor("dstColor"); | 176 SkString dstColor("dstColor"); |
181 this->emitChild(0, nullptr, &dstColor, args); | 177 this->emitChild(0, nullptr, &dstColor, args); |
182 | 178 |
183 fOpColorUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFr
agment_Visibility, | 179 fOpColorUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFr
agment_Visibility, |
184 kVec3f_GrSLType, kHigh_Gr
SLPrecision, | 180 kVec3f_GrSLType, kHigh_Gr
SLPrecision, |
185 "opColor"); | 181 "opColor"); |
186 const char* kOpColorUni = args.fUniformHandler->getUniformCStr(fOpColorU
ni); | 182 const char* kOpColorUni = args.fUniformHandler->getUniformCStr(fOpColorU
ni); |
187 | 183 |
(...skipping 14 matching lines...) Expand all Loading... |
202 | 198 |
203 private: | 199 private: |
204 GrGLSLProgramDataManager::UniformHandle fOpColorUni; | 200 GrGLSLProgramDataManager::UniformHandle fOpColorUni; |
205 | 201 |
206 typedef GrGLSLFragmentProcessor INHERITED; | 202 typedef GrGLSLFragmentProcessor INHERITED; |
207 }; | 203 }; |
208 | 204 |
209 /////////////////////////////////////////////////////////////////////////////// | 205 /////////////////////////////////////////////////////////////////////////////// |
210 | 206 |
211 GrGLSLFragmentProcessor* PixelXorFP::onCreateGLSLInstance() const { | 207 GrGLSLFragmentProcessor* PixelXorFP::onCreateGLSLInstance() const { |
212 return new GLPixelXorFP(*this); | 208 return new GLPixelXorFP; |
213 } | 209 } |
214 | 210 |
215 void PixelXorFP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui
lder* b) const { | 211 void PixelXorFP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui
lder* b) const { |
216 GLPixelXorFP::GenKey(*this, caps, b); | 212 GLPixelXorFP::GenKey(*this, caps, b); |
217 } | 213 } |
218 | 214 |
219 const GrFragmentProcessor* PixelXorFP::TestCreate(GrProcessorTestData* d) { | 215 const GrFragmentProcessor* PixelXorFP::TestCreate(GrProcessorTestData* d) { |
220 SkColor color = d->fRandom->nextU(); | 216 SkColor color = d->fRandom->nextU(); |
221 | 217 |
222 SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChild
FP(d)); | 218 SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChild
FP(d)); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 } | 377 } |
382 | 378 |
383 bool SkPixelXorXfermode::asXPFactory(GrXPFactory** xpf) const { | 379 bool SkPixelXorXfermode::asXPFactory(GrXPFactory** xpf) const { |
384 if (xpf) { | 380 if (xpf) { |
385 *xpf = GrPixelXorXPFactory::Create(fOpColor); | 381 *xpf = GrPixelXorXPFactory::Create(fOpColor); |
386 } | 382 } |
387 return true; | 383 return true; |
388 } | 384 } |
389 | 385 |
390 #endif | 386 #endif |
OLD | NEW |