| 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 "SkFlattenableBuffers.h" | 9 #include "SkFlattenableBuffers.h" |
| 10 #include "SkUnPreMultiply.h" | 10 #include "SkUnPreMultiply.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 buffer.writeInt((int) fXChannelSelector); | 176 buffer.writeInt((int) fXChannelSelector); |
| 177 buffer.writeInt((int) fYChannelSelector); | 177 buffer.writeInt((int) fYChannelSelector); |
| 178 buffer.writeScalar(fScale); | 178 buffer.writeScalar(fScale); |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, | 181 bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy, |
| 182 const SkBitmap& src, | 182 const SkBitmap& src, |
| 183 const SkMatrix& ctm, | 183 const SkMatrix& ctm, |
| 184 SkBitmap* dst, | 184 SkBitmap* dst, |
| 185 SkIPoint* offset) { | 185 SkIPoint* offset) { |
| 186 SkBitmap displ, color = src; | 186 SkBitmap displ = src, color = src; |
| 187 SkImageFilter* colorInput = getColorInput(); | 187 SkImageFilter* colorInput = getColorInput(); |
| 188 SkImageFilter* displacementInput = getDisplacementInput(); | 188 SkImageFilter* displacementInput = getDisplacementInput(); |
| 189 SkASSERT(NULL != displacementInput); | |
| 190 if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, offset)
) || | 189 if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, offset)
) || |
| 191 !displacementInput || !displacementInput->filterImage(proxy, src, ctm, &
displ, offset)) { | 190 (displacementInput && !displacementInput->filterImage(proxy, src, ctm, &
displ, offset))) { |
| 192 return false; | 191 return false; |
| 193 } | 192 } |
| 194 if ((displ.config() != SkBitmap::kARGB_8888_Config) || | 193 if ((displ.config() != SkBitmap::kARGB_8888_Config) || |
| 195 (color.config() != SkBitmap::kARGB_8888_Config)) { | 194 (color.config() != SkBitmap::kARGB_8888_Config)) { |
| 196 return false; | 195 return false; |
| 197 } | 196 } |
| 198 | 197 |
| 199 SkAutoLockPixels alp_displacement(displ), alp_color(color); | 198 SkAutoLockPixels alp_displacement(displ), alp_color(color); |
| 200 if (!displ.getPixels() || !color.getPixels()) { | 199 if (!displ.getPixels() || !color.getPixels()) { |
| 201 return false; | 200 return false; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 const GrGLCaps&) { | 539 const GrGLCaps&) { |
| 541 const GrDisplacementMapEffect& displacementMap = | 540 const GrDisplacementMapEffect& displacementMap = |
| 542 drawEffect.castEffect<GrDisplacementMapEffect>(); | 541 drawEffect.castEffect<GrDisplacementMapEffect>(); |
| 543 | 542 |
| 544 EffectKey xKey = displacementMap.xChannelSelector(); | 543 EffectKey xKey = displacementMap.xChannelSelector(); |
| 545 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe
ct::kKeyBits; | 544 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe
ct::kKeyBits; |
| 546 | 545 |
| 547 return xKey | yKey; | 546 return xKey | yKey; |
| 548 } | 547 } |
| 549 #endif | 548 #endif |
| OLD | NEW |