| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 } | 431 } |
| 432 | 432 |
| 433 SkVector scale = SkVector::Make(fScale, fScale); | 433 SkVector scale = SkVector::Make(fScale, fScale); |
| 434 ctx.ctm().mapVectors(&scale, 1); | 434 ctx.ctm().mapVectors(&scale, 1); |
| 435 | 435 |
| 436 GrPaint paint; | 436 GrPaint paint; |
| 437 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); | 437 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); |
| 438 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), | 438 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), |
| 439 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); | 439 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); |
| 440 | 440 |
| 441 paint.addColorProcessor( | 441 paint.addColorFragmentProcessor( |
| 442 GrDisplacementMapEffect::Create(paint.getProcessorDataManager(), | 442 GrDisplacementMapEffect::Create(paint.getProcessorDataManager(), |
| 443 fXChannelSelector, | 443 fXChannelSelector, |
| 444 fYChannelSelector, | 444 fYChannelSelector, |
| 445 scale, | 445 scale, |
| 446 displacement, | 446 displacement, |
| 447 offsetMatrix, | 447 offsetMatrix, |
| 448 color, | 448 color, |
| 449 colorBM.dimensions()))->unref(); | 449 colorBM.dimensions()))->unref(); |
| 450 SkIRect colorBounds = bounds; | 450 SkIRect colorBounds = bounds; |
| 451 colorBounds.offset(-colorOffset); | 451 colorBounds.offset(-colorOffset); |
| (...skipping 181 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 |