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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
const { | 265 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
const { |
266 if (this->getColorInput()) { | 266 if (this->getColorInput()) { |
267 this->getColorInput()->computeFastBounds(src, dst); | 267 this->getColorInput()->computeFastBounds(src, dst); |
268 } else { | 268 } else { |
269 *dst = src; | 269 *dst = src; |
270 } | 270 } |
271 dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf); | 271 dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf); |
272 } | 272 } |
273 | 273 |
| 274 void SkDisplacementMapEffect::onFilterNodeBounds(const SkIRect& src, const SkMat
rix& ctm, |
| 275 SkIRect* dst, MapDirection) const { |
| 276 *dst = src; |
| 277 SkVector scale = SkVector::Make(fScale, fScale); |
| 278 ctm.mapVectors(&scale, 1); |
| 279 dst->outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), |
| 280 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); |
| 281 } |
| 282 |
274 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, | 283 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, |
275 SkIRect* dst) const { | 284 SkIRect* dst) const { |
276 SkIRect bounds = src; | 285 SkIRect bounds; |
277 SkVector scale = SkVector::Make(fScale, fScale); | 286 this->onFilterNodeBounds(src, ctm, &bounds, kReverse_MapDirection); |
278 ctm.mapVectors(&scale, 1); | |
279 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), | |
280 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); | |
281 if (this->getColorInput()) { | 287 if (this->getColorInput()) { |
282 return this->getColorInput()->filterBounds(bounds, ctm, dst); | 288 return this->getColorInput()->filterBounds(bounds, ctm, dst); |
283 } | 289 } |
284 *dst = bounds; | 290 *dst = bounds; |
285 return true; | 291 return true; |
286 } | 292 } |
287 | 293 |
288 #ifndef SK_IGNORE_TO_STRING | 294 #ifndef SK_IGNORE_TO_STRING |
289 void SkDisplacementMapEffect::toString(SkString* str) const { | 295 void SkDisplacementMapEffect::toString(SkString* str) const { |
290 str->appendf("SkDisplacementMapEffect: ("); | 296 str->appendf("SkDisplacementMapEffect: ("); |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 641 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
636 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 642 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
637 | 643 |
638 uint32_t xKey = displacementMap.xChannelSelector(); | 644 uint32_t xKey = displacementMap.xChannelSelector(); |
639 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 645 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
640 | 646 |
641 b->add32(xKey | yKey); | 647 b->add32(xKey | yKey); |
642 } | 648 } |
643 #endif | 649 #endif |
644 | 650 |
OLD | NEW |