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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 GrFragmentProcessor& 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 fXChannelSelector == s.fXChannelSelector && |
485 fColorAccess.getTexture() == s.fColorAccess.getTexture() && | |
486 fXChannelSelector == s.fXChannelSelector && | |
487 fYChannelSelector == s.fYChannelSelector && | 485 fYChannelSelector == s.fYChannelSelector && |
488 fScale == s.fScale; | 486 fScale == s.fScale; |
489 } | 487 } |
490 | 488 |
491 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c
onst { | 489 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c
onst { |
492 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta
nce(); | 490 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta
nce(); |
493 } | 491 } |
494 | 492 |
495 void GrDisplacementMapEffect::onComputeInvariantOutput(InvariantOutput* inout) c
onst { | 493 void GrDisplacementMapEffect::onComputeInvariantOutput(InvariantOutput* inout) c
onst { |
496 // Any displacement offset bringing a pixel out of bounds will output a colo
r of (0,0,0,0), | 494 // Any displacement offset bringing a pixel out of bounds will output a colo
r of (0,0,0,0), |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 630 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
633 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 631 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 632 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
635 | 633 |
636 uint32_t xKey = displacementMap.xChannelSelector(); | 634 uint32_t xKey = displacementMap.xChannelSelector(); |
637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 635 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
638 | 636 |
639 b->add32(xKey | yKey); | 637 b->add32(xKey | yKey); |
640 } | 638 } |
641 #endif | 639 #endif |
OLD | NEW |