| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const | 345 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const |
| 346 { return fXChannelSelector; } | 346 { return fXChannelSelector; } |
| 347 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const | 347 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const |
| 348 { return fYChannelSelector; } | 348 { return fYChannelSelector; } |
| 349 const SkVector& scale() const { return fScale; } | 349 const SkVector& scale() const { return fScale; } |
| 350 | 350 |
| 351 typedef GrGLDisplacementMapEffect GLProcessor; | 351 typedef GrGLDisplacementMapEffect GLProcessor; |
| 352 static const char* Name() { return "DisplacementMap"; } | 352 static const char* Name() { return "DisplacementMap"; } |
| 353 | 353 |
| 354 private: | 354 private: |
| 355 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 355 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 356 | 356 |
| 357 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; | 357 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE; |
| 358 | 358 |
| 359 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, | 359 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, |
| 360 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, | 360 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, |
| 361 const SkVector& scale, | 361 const SkVector& scale, |
| 362 GrTexture* displacement, const SkMatrix& offsetMatri
x, | 362 GrTexture* displacement, const SkMatrix& offsetMatri
x, |
| 363 GrTexture* color); | 363 GrTexture* color); |
| 364 | 364 |
| 365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 this->addCoordTransform(&fDisplacementTransform); | 472 this->addCoordTransform(&fDisplacementTransform); |
| 473 this->addTextureAccess(&fDisplacementAccess); | 473 this->addTextureAccess(&fDisplacementAccess); |
| 474 this->addCoordTransform(&fColorTransform); | 474 this->addCoordTransform(&fColorTransform); |
| 475 this->addTextureAccess(&fColorAccess); | 475 this->addTextureAccess(&fColorAccess); |
| 476 this->setWillNotUseInputColor(); | 476 this->setWillNotUseInputColor(); |
| 477 } | 477 } |
| 478 | 478 |
| 479 GrDisplacementMapEffect::~GrDisplacementMapEffect() { | 479 GrDisplacementMapEffect::~GrDisplacementMapEffect() { |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool GrDisplacementMapEffect::onIsEqual(const GrProcessor& sBase) const { | 482 bool GrDisplacementMapEffect::onIsEqual(const GrFragmentProcessor& sBase) const
{ |
| 483 const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>(); | 483 const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>(); |
| 484 return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture(
) && | 484 return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture(
) && |
| 485 fColorAccess.getTexture() == s.fColorAccess.getTexture() && | 485 fColorAccess.getTexture() == s.fColorAccess.getTexture() && |
| 486 fXChannelSelector == s.fXChannelSelector && | 486 fXChannelSelector == s.fXChannelSelector && |
| 487 fYChannelSelector == s.fYChannelSelector && | 487 fYChannelSelector == s.fYChannelSelector && |
| 488 fScale == s.fScale; | 488 fScale == s.fScale; |
| 489 } | 489 } |
| 490 | 490 |
| 491 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c
onst { | 491 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c
onst { |
| 492 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta
nce(); | 492 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta
nce(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
| 633 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 633 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
| 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 635 | 635 |
| 636 uint32_t xKey = displacementMap.xChannelSelector(); | 636 uint32_t xKey = displacementMap.xChannelSelector(); |
| 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 638 | 638 |
| 639 b->add32(xKey | yKey); | 639 b->add32(xKey | yKey); |
| 640 } | 640 } |
| 641 #endif | 641 #endif |
| OLD | NEW |