| 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 "SkFlattenableBuffers.h" | 9 #include "SkFlattenableBuffers.h" |
| 10 #include "SkUnPreMultiply.h" | 10 #include "SkUnPreMultiply.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // and no displacement offset push any texture coordinates out of bounds OR
if the constant | 359 // and no displacement offset push any texture coordinates out of bounds OR
if the constant |
| 360 // alpha is 0. Since this isn't trivial to compute at this point, let's assu
me the output is | 360 // alpha is 0. Since this isn't trivial to compute at this point, let's assu
me the output is |
| 361 // not of constant color when a displacement effect is applied. | 361 // not of constant color when a displacement effect is applied. |
| 362 *validFlags = 0; | 362 *validFlags = 0; |
| 363 } | 363 } |
| 364 | 364 |
| 365 /////////////////////////////////////////////////////////////////////////////// | 365 /////////////////////////////////////////////////////////////////////////////// |
| 366 | 366 |
| 367 GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect); | 367 GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect); |
| 368 | 368 |
| 369 GrEffectRef* GrDisplacementMapEffect::TestCreate(SkMWCRandom* random, | 369 GrEffectRef* GrDisplacementMapEffect::TestCreate(SkRandom* random, |
| 370 GrContext*, | 370 GrContext*, |
| 371 const GrDrawTargetCaps&, | 371 const GrDrawTargetCaps&, |
| 372 GrTexture* textures[]) { | 372 GrTexture* textures[]) { |
| 373 int texIdxDispl = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 373 int texIdxDispl = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
| 374 GrEffectUnitTest::kAlphaTextureIdx; | 374 GrEffectUnitTest::kAlphaTextureIdx; |
| 375 int texIdxColor = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : | 375 int texIdxColor = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : |
| 376 GrEffectUnitTest::kAlphaTextureIdx; | 376 GrEffectUnitTest::kAlphaTextureIdx; |
| 377 static const int kMaxComponent = 4; | 377 static const int kMaxComponent = 4; |
| 378 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = | 378 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = |
| 379 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( | 379 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 colorTex); | 526 colorTex); |
| 527 | 527 |
| 528 colorKey <<= GrGLEffectMatrix::kKeyBits; | 528 colorKey <<= GrGLEffectMatrix::kKeyBits; |
| 529 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits); | 529 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits); |
| 530 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits + | 530 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits + |
| 531 SkDisplacementMapEff
ect::kKeyBits); | 531 SkDisplacementMapEff
ect::kKeyBits); |
| 532 | 532 |
| 533 return xKey | yKey | displKey | colorKey; | 533 return xKey | yKey | displKey | colorKey; |
| 534 } | 534 } |
| 535 #endif | 535 #endif |
| OLD | NEW |