| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 buffer.writeInt((int) fYChannelSelector); | 205 buffer.writeInt((int) fYChannelSelector); |
| 206 buffer.writeScalar(fScale); | 206 buffer.writeScalar(fScale); |
| 207 } | 207 } |
| 208 | 208 |
| 209 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, | 209 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, |
| 210 const SkBitmap& src, | 210 const SkBitmap& src, |
| 211 const Context& ctx, | 211 const Context& ctx, |
| 212 SkBitmap* dst, | 212 SkBitmap* dst, |
| 213 SkIPoint* offset) const { | 213 SkIPoint* offset) const { |
| 214 SkBitmap displ = src, color = src; | 214 SkBitmap displ = src, color = src; |
| 215 const SkImageFilter* colorInput = this->getColorInput(); | |
| 216 const SkImageFilter* displInput = this->getDisplacementInput(); | |
| 217 SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0,
0); | 215 SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0,
0); |
| 218 if ((colorInput && !colorInput->filterImage(proxy, src, ctx, &color, &colorO
ffset)) || | 216 if (!this->filterInput(1, proxy, src, ctx, &color, &colorOffset) || |
| 219 (displInput && !displInput->filterImage(proxy, src, ctx, &displ, &displO
ffset))) { | 217 !this->filterInput(0, proxy, src, ctx, &displ, &displOffset)) { |
| 220 return false; | 218 return false; |
| 221 } | 219 } |
| 222 if ((displ.colorType() != kN32_SkColorType) || | 220 if ((displ.colorType() != kN32_SkColorType) || |
| 223 (color.colorType() != kN32_SkColorType)) { | 221 (color.colorType() != kN32_SkColorType)) { |
| 224 return false; | 222 return false; |
| 225 } | 223 } |
| 226 SkIRect bounds; | 224 SkIRect bounds; |
| 227 // Since computeDisplacement does bounds checking on color pixel access, we
don't need to pad | 225 // Since computeDisplacement does bounds checking on color pixel access, we
don't need to pad |
| 228 // the color bitmap to bounds here. | 226 // the color bitmap to bounds here. |
| 229 if (!this->applyCropRect(ctx, color, colorOffset, &bounds)) { | 227 if (!this->applyCropRect(ctx, color, colorOffset, &bounds)) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 625 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
| 628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 626 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 629 | 627 |
| 630 uint32_t xKey = displacementMap.xChannelSelector(); | 628 uint32_t xKey = displacementMap.xChannelSelector(); |
| 631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 629 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 632 | 630 |
| 633 b->add32(xKey | yKey); | 631 b->add32(xKey | yKey); |
| 634 } | 632 } |
| 635 #endif | 633 #endif |
| 636 | 634 |
| OLD | NEW |