| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 // and no displacement offset push any texture coordinates out of bounds OR
if the constant | 510 // and no displacement offset push any texture coordinates out of bounds OR
if the constant |
| 511 // alpha is 0. Since this isn't trivial to compute at this point, let's assu
me the output is | 511 // alpha is 0. Since this isn't trivial to compute at this point, let's assu
me the output is |
| 512 // not of constant color when a displacement effect is applied. | 512 // not of constant color when a displacement effect is applied. |
| 513 inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput); | 513 inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput); |
| 514 } | 514 } |
| 515 | 515 |
| 516 /////////////////////////////////////////////////////////////////////////////// | 516 /////////////////////////////////////////////////////////////////////////////// |
| 517 | 517 |
| 518 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect); | 518 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect); |
| 519 | 519 |
| 520 GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(GrProcessorTestData* d)
{ | 520 const GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(GrProcessorTestDa
ta* d) { |
| 521 int texIdxDispl = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextu
reIdx : | 521 int texIdxDispl = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextu
reIdx : |
| 522 GrProcessorUnitTest::kAlphaTextur
eIdx; | 522 GrProcessorUnitTest::kAlphaTextur
eIdx; |
| 523 int texIdxColor = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextu
reIdx : | 523 int texIdxColor = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextu
reIdx : |
| 524 GrProcessorUnitTest::kAlphaTextur
eIdx; | 524 GrProcessorUnitTest::kAlphaTextur
eIdx; |
| 525 static const int kMaxComponent = 4; | 525 static const int kMaxComponent = 4; |
| 526 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = | 526 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = |
| 527 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( | 527 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( |
| 528 d->fRandom->nextRangeU(1, kMaxComponent)); | 528 d->fRandom->nextRangeU(1, kMaxComponent)); |
| 529 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector = | 529 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector = |
| 530 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( | 530 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 633 const GrGLSLCaps&, 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 |
| 642 | 642 |
| OLD | NEW |