| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 colorBounds.offset(-colorOffset); | 239 colorBounds.offset(-colorOffset); |
| 240 | 240 |
| 241 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst, | 241 computeDisplacement(fXChannelSelector, fYChannelSelector, scale, dst, |
| 242 &displ, colorOffset - displOffset, &color, colorBounds); | 242 &displ, colorOffset - displOffset, &color, colorBounds); |
| 243 | 243 |
| 244 offset->fX = bounds.left(); | 244 offset->fX = bounds.left(); |
| 245 offset->fY = bounds.top(); | 245 offset->fY = bounds.top(); |
| 246 return true; | 246 return true; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
const { |
| 250 if (getColorInput()) { |
| 251 getColorInput()->computeFastBounds(src, dst); |
| 252 } else { |
| 253 *dst = src; |
| 254 } |
| 255 } |
| 256 |
| 249 /////////////////////////////////////////////////////////////////////////////// | 257 /////////////////////////////////////////////////////////////////////////////// |
| 250 | 258 |
| 251 #if SK_SUPPORT_GPU | 259 #if SK_SUPPORT_GPU |
| 252 class GrGLDisplacementMapEffect : public GrGLEffect { | 260 class GrGLDisplacementMapEffect : public GrGLEffect { |
| 253 public: | 261 public: |
| 254 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory, | 262 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory, |
| 255 const GrDrawEffect& drawEffect); | 263 const GrDrawEffect& drawEffect); |
| 256 virtual ~GrGLDisplacementMapEffect(); | 264 virtual ~GrGLDisplacementMapEffect(); |
| 257 | 265 |
| 258 virtual void emitCode(GrGLShaderBuilder*, | 266 virtual void emitCode(GrGLShaderBuilder*, |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 const GrGLCaps&) { | 589 const GrGLCaps&) { |
| 582 const GrDisplacementMapEffect& displacementMap = | 590 const GrDisplacementMapEffect& displacementMap = |
| 583 drawEffect.castEffect<GrDisplacementMapEffect>(); | 591 drawEffect.castEffect<GrDisplacementMapEffect>(); |
| 584 | 592 |
| 585 EffectKey xKey = displacementMap.xChannelSelector(); | 593 EffectKey xKey = displacementMap.xChannelSelector(); |
| 586 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe
ct::kKeyBits; | 594 EffectKey yKey = displacementMap.yChannelSelector() << SkDisplacementMapEffe
ct::kKeyBits; |
| 587 | 595 |
| 588 return xKey | yKey; | 596 return xKey | yKey; |
| 589 } | 597 } |
| 590 #endif | 598 #endif |
| OLD | NEW |