| 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 "SkDevice.h" | 9 #include "SkDevice.h" |
| 10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); | 438 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); |
| 439 | 439 |
| 440 paint.addColorFragmentProcessor( | 440 paint.addColorFragmentProcessor( |
| 441 GrDisplacementMapEffect::Create(fXChannelSelector, | 441 GrDisplacementMapEffect::Create(fXChannelSelector, |
| 442 fYChannelSelector, | 442 fYChannelSelector, |
| 443 scale, | 443 scale, |
| 444 displacement, | 444 displacement, |
| 445 offsetMatrix, | 445 offsetMatrix, |
| 446 color, | 446 color, |
| 447 colorBM.dimensions()))->unref(); | 447 colorBM.dimensions()))->unref(); |
| 448 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 448 SkIRect colorBounds = bounds; | 449 SkIRect colorBounds = bounds; |
| 449 colorBounds.offset(-colorOffset); | 450 colorBounds.offset(-colorOffset); |
| 450 SkMatrix matrix; | 451 SkMatrix matrix; |
| 451 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), | 452 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), |
| 452 -SkIntToScalar(colorBounds.y())); | 453 -SkIntToScalar(colorBounds.y())); |
| 453 | 454 |
| 454 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTa
rget())); | 455 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTa
rget())); |
| 455 if (!drawContext) { | 456 if (!drawContext) { |
| 456 return false; | 457 return false; |
| 457 } | 458 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 634 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
| 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 635 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 635 | 636 |
| 636 uint32_t xKey = displacementMap.xChannelSelector(); | 637 uint32_t xKey = displacementMap.xChannelSelector(); |
| 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 638 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 638 | 639 |
| 639 b->add32(xKey | yKey); | 640 b->add32(xKey | yKey); |
| 640 } | 641 } |
| 641 #endif | 642 #endif |
| 642 | 643 |
| OLD | NEW |