| 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 displ.getBounds(&displBounds); | 222 displ.getBounds(&displBounds); |
| 223 displBounds.offset(displOffset); | 223 displBounds.offset(displOffset); |
| 224 if (!this->applyCropRect(&displBounds, ctm)) { | 224 if (!this->applyCropRect(&displBounds, ctm)) { |
| 225 return false; | 225 return false; |
| 226 } | 226 } |
| 227 if (!bounds.intersect(displBounds)) { | 227 if (!bounds.intersect(displBounds)) { |
| 228 return false; | 228 return false; |
| 229 } | 229 } |
| 230 | 230 |
| 231 dst->setConfig(color.config(), bounds.width(), bounds.height()); | 231 dst->setConfig(color.config(), bounds.width(), bounds.height()); |
| 232 dst->allocPixels(); | 232 if (!dst->allocPixels()) { |
| 233 if (!dst->getPixels()) { | |
| 234 return false; | 233 return false; |
| 235 } | 234 } |
| 236 | 235 |
| 237 SkVector scale = SkVector::Make(fScale, fScale); | 236 SkVector scale = SkVector::Make(fScale, fScale); |
| 238 ctm.mapVectors(&scale, 1); | 237 ctm.mapVectors(&scale, 1); |
| 239 SkIRect colorBounds = bounds; | 238 SkIRect colorBounds = bounds; |
| 240 colorBounds.offset(-colorOffset); | 239 colorBounds.offset(-colorOffset); |
| 241 | 240 |
| 242 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst, | 241 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst, |
| 243 &displ, colorOffset - displOffset, &color, colorBounds); | 242 &displ, colorOffset - displOffset, &color, colorBounds); |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 const GrGLCaps&) { | 581 const GrGLCaps&) { |
| 583 const GrDisplacementMapEffect& displacementMap = | 582 const GrDisplacementMapEffect& displacementMap = |
| 584 drawEffect.castEffect<GrDisplacementMapEffect>(); | 583 drawEffect.castEffect<GrDisplacementMapEffect>(); |
| 585 | 584 |
| 586 EffectKey xKey = displacementMap.xChannelSelector(); | 585 EffectKey xKey = displacementMap.xChannelSelector(); |
| 587 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe
ct::kKeyBits; | 586 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe
ct::kKeyBits; |
| 588 | 587 |
| 589 return xKey | yKey; | 588 return xKey | yKey; |
| 590 } | 589 } |
| 591 #endif | 590 #endif |
| OLD | NEW |