| 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 425 |
| 426 paint.addColorProcessor( | 426 paint.addColorProcessor( |
| 427 GrDisplacementMapEffect::Create(fXChannelSelector, | 427 GrDisplacementMapEffect::Create(fXChannelSelector, |
| 428 fYChannelSelector, | 428 fYChannelSelector, |
| 429 scale, | 429 scale, |
| 430 displacement, | 430 displacement, |
| 431 offsetMatrix, | 431 offsetMatrix, |
| 432 color))->unref(); | 432 color))->unref(); |
| 433 SkIRect colorBounds = bounds; | 433 SkIRect colorBounds = bounds; |
| 434 colorBounds.offset(-colorOffset); | 434 colorBounds.offset(-colorOffset); |
| 435 GrContext::AutoMatrix am; | |
| 436 am.setIdentity(context); | |
| 437 SkMatrix matrix; | 435 SkMatrix matrix; |
| 438 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), | 436 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), |
| 439 -SkIntToScalar(colorBounds.y())); | 437 -SkIntToScalar(colorBounds.y())); |
| 440 context->concatMatrix(matrix); | 438 context->drawRect(paint, matrix, SkRect::Make(colorBounds)); |
| 441 context->drawRect(paint, SkRect::Make(colorBounds)); | |
| 442 offset->fX = bounds.left(); | 439 offset->fX = bounds.left(); |
| 443 offset->fY = bounds.top(); | 440 offset->fY = bounds.top(); |
| 444 WrapTexture(dst, bounds.width(), bounds.height(), result); | 441 WrapTexture(dst, bounds.width(), bounds.height(), result); |
| 445 return true; | 442 return true; |
| 446 } | 443 } |
| 447 | 444 |
| 448 /////////////////////////////////////////////////////////////////////////////// | 445 /////////////////////////////////////////////////////////////////////////////// |
| 449 | 446 |
| 450 GrDisplacementMapEffect::GrDisplacementMapEffect( | 447 GrDisplacementMapEffect::GrDisplacementMapEffect( |
| 451 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, | 448 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 613 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
| 617 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 614 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
| 618 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 615 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 619 | 616 |
| 620 uint32_t xKey = displacementMap.xChannelSelector(); | 617 uint32_t xKey = displacementMap.xChannelSelector(); |
| 621 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 618 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 622 | 619 |
| 623 b->add32(xKey | yKey); | 620 b->add32(xKey | yKey); |
| 624 } | 621 } |
| 625 #endif | 622 #endif |
| OLD | NEW |