| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 437 } |
| 438 | 438 |
| 439 SkVector scale = SkVector::Make(fScale, fScale); | 439 SkVector scale = SkVector::Make(fScale, fScale); |
| 440 ctx.ctm().mapVectors(&scale, 1); | 440 ctx.ctm().mapVectors(&scale, 1); |
| 441 | 441 |
| 442 GrPaint paint; | 442 GrPaint paint; |
| 443 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); | 443 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); |
| 444 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), | 444 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), |
| 445 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); | 445 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); |
| 446 | 446 |
| 447 paint.addColorFragmentProcessor( | 447 paint.addColorProcessor( |
| 448 GrDisplacementMapEffect::Create(paint.getProcessorDataManager(), | 448 GrDisplacementMapEffect::Create(paint.getProcessorDataManager(), |
| 449 fXChannelSelector, | 449 fXChannelSelector, |
| 450 fYChannelSelector, | 450 fYChannelSelector, |
| 451 scale, | 451 scale, |
| 452 displacement, | 452 displacement, |
| 453 offsetMatrix, | 453 offsetMatrix, |
| 454 color, | 454 color, |
| 455 colorBM.dimensions()))->unref(); | 455 colorBM.dimensions()))->unref(); |
| 456 SkIRect colorBounds = bounds; | 456 SkIRect colorBounds = bounds; |
| 457 colorBounds.offset(-colorOffset); | 457 colorBounds.offset(-colorOffset); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 639 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
| 640 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 640 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 641 | 641 |
| 642 uint32_t xKey = displacementMap.xChannelSelector(); | 642 uint32_t xKey = displacementMap.xChannelSelector(); |
| 643 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 643 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 644 | 644 |
| 645 b->add32(xKey | yKey); | 645 b->add32(xKey | yKey); |
| 646 } | 646 } |
| 647 #endif | 647 #endif |
| 648 | 648 |
| OLD | NEW |