OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkDisplacementMapEffect.h" | 8 #include "SkDisplacementMapEffect.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 299 |
300 #if SK_SUPPORT_GPU | 300 #if SK_SUPPORT_GPU |
301 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor { | 301 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor { |
302 public: | 302 public: |
303 GrGLDisplacementMapEffect(const GrBackendProcessorFactory&, | 303 GrGLDisplacementMapEffect(const GrBackendProcessorFactory&, |
304 const GrProcessor&); | 304 const GrProcessor&); |
305 virtual ~GrGLDisplacementMapEffect(); | 305 virtual ~GrGLDisplacementMapEffect(); |
306 | 306 |
307 virtual void emitCode(GrGLFPBuilder*, | 307 virtual void emitCode(GrGLFPBuilder*, |
308 const GrFragmentProcessor&, | 308 const GrFragmentProcessor&, |
309 const GrProcessorKey&, | |
310 const char* outputColor, | 309 const char* outputColor, |
311 const char* inputColor, | 310 const char* inputColor, |
312 const TransformedCoordsArray&, | 311 const TransformedCoordsArray&, |
313 const TextureSamplerArray&) SK_OVERRIDE; | 312 const TextureSamplerArray&) SK_OVERRIDE; |
314 | 313 |
315 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 314 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
316 | 315 |
317 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 316 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; |
318 | 317 |
319 private: | 318 private: |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 : INHERITED(factory) | 532 : INHERITED(factory) |
534 , fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector()) | 533 , fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector()) |
535 , fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector())
{ | 534 , fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector())
{ |
536 } | 535 } |
537 | 536 |
538 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() { | 537 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() { |
539 } | 538 } |
540 | 539 |
541 void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder, | 540 void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder, |
542 const GrFragmentProcessor&, | 541 const GrFragmentProcessor&, |
543 const GrProcessorKey& key, | |
544 const char* outputColor, | 542 const char* outputColor, |
545 const char* inputColor, | 543 const char* inputColor, |
546 const TransformedCoordsArray& coords, | 544 const TransformedCoordsArray& coords, |
547 const TextureSamplerArray& samplers) { | 545 const TextureSamplerArray& samplers) { |
548 sk_ignore_unused_variable(inputColor); | 546 sk_ignore_unused_variable(inputColor); |
549 | 547 |
550 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 548 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
551 kVec2f_GrSLType, "Scale"); | 549 kVec2f_GrSLType, "Scale"); |
552 const char* scaleUni = builder->getUniformCStr(fScaleUni); | 550 const char* scaleUni = builder->getUniformCStr(fScaleUni); |
553 const char* dColor = "dColor"; | 551 const char* dColor = "dColor"; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 628 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
631 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 629 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
632 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 630 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
633 | 631 |
634 uint32_t xKey = displacementMap.xChannelSelector(); | 632 uint32_t xKey = displacementMap.xChannelSelector(); |
635 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 633 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
636 | 634 |
637 b->add32(xKey | yKey); | 635 b->add32(xKey | yKey); |
638 } | 636 } |
639 #endif | 637 #endif |
OLD | NEW |