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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 fYChannelSelector, | 442 fYChannelSelector, |
443 scale, | 443 scale, |
444 displacement, | 444 displacement, |
445 offsetMatrix, | 445 offsetMatrix, |
446 color))->unref(); | 446 color))->unref(); |
447 SkIRect colorBounds = bounds; | 447 SkIRect colorBounds = bounds; |
448 colorBounds.offset(-colorOffset); | 448 colorBounds.offset(-colorOffset); |
449 SkMatrix matrix; | 449 SkMatrix matrix; |
450 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), | 450 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), |
451 -SkIntToScalar(colorBounds.y())); | 451 -SkIntToScalar(colorBounds.y())); |
452 context->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, matrix, | 452 context->drawRect(dst->asRenderTarget(), paint, matrix, SkRect::Make(colorBo
unds)); |
453 SkRect::Make(colorBounds)); | |
454 offset->fX = bounds.left(); | 453 offset->fX = bounds.left(); |
455 offset->fY = bounds.top(); | 454 offset->fY = bounds.top(); |
456 WrapTexture(dst, bounds.width(), bounds.height(), result); | 455 WrapTexture(dst, bounds.width(), bounds.height(), result); |
457 return true; | 456 return true; |
458 } | 457 } |
459 | 458 |
460 /////////////////////////////////////////////////////////////////////////////// | 459 /////////////////////////////////////////////////////////////////////////////// |
461 | 460 |
462 GrDisplacementMapEffect::GrDisplacementMapEffect( | 461 GrDisplacementMapEffect::GrDisplacementMapEffect( |
463 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, | 462 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 630 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
632 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 631 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
633 | 632 |
634 uint32_t xKey = displacementMap.xChannelSelector(); | 633 uint32_t xKey = displacementMap.xChannelSelector(); |
635 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 634 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
636 | 635 |
637 b->add32(xKey | yKey); | 636 b->add32(xKey | yKey); |
638 } | 637 } |
639 #endif | 638 #endif |
640 | 639 |
OLD | NEW |