| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 return false; | 420 return false; |
| 421 } | 421 } |
| 422 SkAutoTUnref<GrTexture> dst(ast.detach()); | 422 SkAutoTUnref<GrTexture> dst(ast.detach()); |
| 423 | 423 |
| 424 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); | 424 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); |
| 425 | 425 |
| 426 SkVector scale = SkVector::Make(fScale, fScale); | 426 SkVector scale = SkVector::Make(fScale, fScale); |
| 427 ctx.ctm().mapVectors(&scale, 1); | 427 ctx.ctm().mapVectors(&scale, 1); |
| 428 | 428 |
| 429 GrPaint paint; | 429 GrPaint paint; |
| 430 SkMatrix offsetMatrix = GrEffect::MakeDivByTextureWHMatrix(displacement); | 430 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); |
| 431 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), | 431 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), |
| 432 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); | 432 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); |
| 433 | 433 |
| 434 paint.addColorEffect( | 434 paint.addColorEffect( |
| 435 GrDisplacementMapEffect::Create(fXChannelSelector, | 435 GrDisplacementMapEffect::Create(fXChannelSelector, |
| 436 fYChannelSelector, | 436 fYChannelSelector, |
| 437 scale, | 437 scale, |
| 438 displacement, | 438 displacement, |
| 439 offsetMatrix, | 439 offsetMatrix, |
| 440 color))->unref(); | 440 color))->unref(); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 const GrGLCaps&, GrEffectKeyBuilder* b) { | 635 const GrGLCaps&, GrEffectKeyBuilder* b) { |
| 636 const GrDisplacementMapEffect& displacementMap = | 636 const GrDisplacementMapEffect& displacementMap = |
| 637 drawEffect.castEffect<GrDisplacementMapEffect>(); | 637 drawEffect.castEffect<GrDisplacementMapEffect>(); |
| 638 | 638 |
| 639 uint32_t xKey = displacementMap.xChannelSelector(); | 639 uint32_t xKey = displacementMap.xChannelSelector(); |
| 640 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 640 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 641 | 641 |
| 642 b->add32(xKey | yKey); | 642 b->add32(xKey | yKey); |
| 643 } | 643 } |
| 644 #endif | 644 #endif |
| OLD | NEW |