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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 SkBitmap* dst, | 198 SkBitmap* dst, |
199 SkIPoint* offset) const { | 199 SkIPoint* offset) const { |
200 SkBitmap displ = src, color = src; | 200 SkBitmap displ = src, color = src; |
201 const SkImageFilter* colorInput = getColorInput(); | 201 const SkImageFilter* colorInput = getColorInput(); |
202 const SkImageFilter* displInput = getDisplacementInput(); | 202 const SkImageFilter* displInput = getDisplacementInput(); |
203 SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0,
0); | 203 SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0,
0); |
204 if ((colorInput && !colorInput->filterImage(proxy, src, ctx, &color, &colorO
ffset)) || | 204 if ((colorInput && !colorInput->filterImage(proxy, src, ctx, &color, &colorO
ffset)) || |
205 (displInput && !displInput->filterImage(proxy, src, ctx, &displ, &displO
ffset))) { | 205 (displInput && !displInput->filterImage(proxy, src, ctx, &displ, &displO
ffset))) { |
206 return false; | 206 return false; |
207 } | 207 } |
208 if ((displ.colorType() != kN32_SkColorType) || | 208 if ((displ.colorType() != kPMColor_SkColorType) || |
209 (color.colorType() != kN32_SkColorType)) { | 209 (color.colorType() != kPMColor_SkColorType)) { |
210 return false; | 210 return false; |
211 } | 211 } |
212 SkIRect bounds; | 212 SkIRect bounds; |
213 // Since computeDisplacement does bounds checking on color pixel access, we
don't need to pad | 213 // Since computeDisplacement does bounds checking on color pixel access, we
don't need to pad |
214 // the color bitmap to bounds here. | 214 // the color bitmap to bounds here. |
215 if (!this->applyCropRect(ctx, color, colorOffset, &bounds)) { | 215 if (!this->applyCropRect(ctx, color, colorOffset, &bounds)) { |
216 return false; | 216 return false; |
217 } | 217 } |
218 SkIRect displBounds; | 218 SkIRect displBounds; |
219 if (!this->applyCropRect(ctx, proxy, displ, &displOffset, &displBounds, &dis
pl)) { | 219 if (!this->applyCropRect(ctx, proxy, displ, &displOffset, &displBounds, &dis
pl)) { |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 const GrGLCaps&) { | 604 const GrGLCaps&) { |
605 const GrDisplacementMapEffect& displacementMap = | 605 const GrDisplacementMapEffect& displacementMap = |
606 drawEffect.castEffect<GrDisplacementMapEffect>(); | 606 drawEffect.castEffect<GrDisplacementMapEffect>(); |
607 | 607 |
608 EffectKey xKey = displacementMap.xChannelSelector(); | 608 EffectKey xKey = displacementMap.xChannelSelector(); |
609 EffectKey yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBi
ts; | 609 EffectKey yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBi
ts; |
610 | 610 |
611 return xKey | yKey; | 611 return xKey | yKey; |
612 } | 612 } |
613 #endif | 613 #endif |
OLD | NEW |