| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; | 377 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; |
| 378 SkVector fScale; | 378 SkVector fScale; |
| 379 | 379 |
| 380 typedef GrFragmentProcessor INHERITED; | 380 typedef GrFragmentProcessor INHERITED; |
| 381 }; | 381 }; |
| 382 | 382 |
| 383 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
const Context& ctx, | 383 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
const Context& ctx, |
| 384 SkBitmap* result, SkIPoint* offset)
const { | 384 SkBitmap* result, SkIPoint* offset)
const { |
| 385 SkBitmap colorBM = src; | 385 SkBitmap colorBM = src; |
| 386 SkIPoint colorOffset = SkIPoint::Make(0, 0); | 386 SkIPoint colorOffset = SkIPoint::Make(0, 0); |
| 387 if (this->getColorInput() && | 387 if (!this->filterInputGPU(1, proxy, src, ctx, &colorBM, &colorOffset)) { |
| 388 !this->getColorInput()->getInputResultGPU(proxy, src, ctx, &colorBM, &co
lorOffset)) { | |
| 389 return false; | 388 return false; |
| 390 } | 389 } |
| 391 SkBitmap displacementBM = src; | 390 SkBitmap displacementBM = src; |
| 392 SkIPoint displacementOffset = SkIPoint::Make(0, 0); | 391 SkIPoint displacementOffset = SkIPoint::Make(0, 0); |
| 393 if (this->getDisplacementInput() && | 392 if (!this->filterInputGPU(0, proxy, src, ctx, &displacementBM, &displacement
Offset)) { |
| 394 !this->getDisplacementInput()->getInputResultGPU(proxy, src, ctx, &displ
acementBM, | |
| 395 &displacementOffset)) { | |
| 396 return false; | 393 return false; |
| 397 } | 394 } |
| 398 SkIRect bounds; | 395 SkIRect bounds; |
| 399 // Since GrDisplacementMapEffect does bounds checking on color pixel access,
we don't need to | 396 // Since GrDisplacementMapEffect does bounds checking on color pixel access,
we don't need to |
| 400 // pad the color bitmap to bounds here. | 397 // pad the color bitmap to bounds here. |
| 401 if (!this->applyCropRect(ctx, colorBM, colorOffset, &bounds)) { | 398 if (!this->applyCropRect(ctx, colorBM, colorOffset, &bounds)) { |
| 402 return false; | 399 return false; |
| 403 } | 400 } |
| 404 SkIRect displBounds; | 401 SkIRect displBounds; |
| 405 if (!this->applyCropRect(ctx, proxy, displacementBM, | 402 if (!this->applyCropRect(ctx, proxy, displacementBM, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 621 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
| 625 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 622 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 626 | 623 |
| 627 uint32_t xKey = displacementMap.xChannelSelector(); | 624 uint32_t xKey = displacementMap.xChannelSelector(); |
| 628 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 625 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 629 | 626 |
| 630 b->add32(xKey | yKey); | 627 b->add32(xKey | yKey); |
| 631 } | 628 } |
| 632 #endif | 629 #endif |
| 633 | 630 |
| OLD | NEW |