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 "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 void SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMat
rix& ctm, | 275 void SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMat
rix& ctm, |
276 SkIRect* dst, MapDirection) const { | 276 SkIRect* dst, MapDirection) const { |
277 *dst = src; | 277 *dst = src; |
278 SkVector scale = SkVector::Make(fScale, fScale); | 278 SkVector scale = SkVector::Make(fScale, fScale); |
279 ctm.mapVectors(&scale, 1); | 279 ctm.mapVectors(&scale, 1); |
280 dst->outset(SkScalarCeilToInt(SkScalarAbs(scale.fX) * SK_ScalarHalf), | 280 dst->outset(SkScalarCeilToInt(SkScalarAbs(scale.fX) * SK_ScalarHalf), |
281 SkScalarCeilToInt(SkScalarAbs(scale.fY) * SK_ScalarHalf)); | 281 SkScalarCeilToInt(SkScalarAbs(scale.fY) * SK_ScalarHalf)); |
282 } | 282 } |
283 | 283 |
284 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, | 284 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, |
285 SkIRect* dst) const { | 285 SkIRect* dst, MapDirection directio
n) const { |
286 SkIRect bounds; | 286 // Recurse only into color input. |
287 this->onFilterNodeBounds(src, ctm, &bounds, kReverse_MapDirection); | |
288 if (this->getColorInput()) { | 287 if (this->getColorInput()) { |
289 return this->getColorInput()->filterBounds(bounds, ctm, dst); | 288 return this->getColorInput()->filterBounds(src, ctm, dst, direction); |
290 } | 289 } |
291 *dst = bounds; | 290 *dst = src; |
292 return true; | 291 return true; |
293 } | 292 } |
294 | 293 |
295 #ifndef SK_IGNORE_TO_STRING | 294 #ifndef SK_IGNORE_TO_STRING |
296 void SkDisplacementMapEffect::toString(SkString* str) const { | 295 void SkDisplacementMapEffect::toString(SkString* str) const { |
297 str->appendf("SkDisplacementMapEffect: ("); | 296 str->appendf("SkDisplacementMapEffect: ("); |
298 str->appendf("scale: %f ", fScale); | 297 str->appendf("scale: %f ", fScale); |
299 str->appendf("displacement: ("); | 298 str->appendf("displacement: ("); |
300 if (this->getDisplacementInput()) { | 299 if (this->getDisplacementInput()) { |
301 this->getDisplacementInput()->toString(str); | 300 this->getDisplacementInput()->toString(str); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 640 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
642 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 641 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
643 | 642 |
644 uint32_t xKey = displacementMap.xChannelSelector(); | 643 uint32_t xKey = displacementMap.xChannelSelector(); |
645 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 644 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
646 | 645 |
647 b->add32(xKey | yKey); | 646 b->add32(xKey | yKey); |
648 } | 647 } |
649 #endif | 648 #endif |
650 | 649 |
OLD | NEW |