| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
const { | 262 void SkDisplacementMapEffect::computeFastBounds(const SkRect& src, SkRect* dst)
const { |
| 263 if (getColorInput()) { | 263 if (getColorInput()) { |
| 264 getColorInput()->computeFastBounds(src, dst); | 264 getColorInput()->computeFastBounds(src, dst); |
| 265 } else { | 265 } else { |
| 266 *dst = src; | 266 *dst = src; |
| 267 } | 267 } |
| 268 dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf); | 268 dst->outset(fScale * SK_ScalarHalf, fScale * SK_ScalarHalf); |
| 269 } | 269 } |
| 270 | 270 |
| 271 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, | 271 bool SkDisplacementMapEffect::onFilterBounds(const SkIRect& src, const SkMatrix&
ctm, |
| 272 SkIRect* dst) const { | 272 SkIRect* dst) const { |
| 273 SkIRect bounds = src; | 273 SkIRect bounds = src; |
| 274 SkVector scale = SkVector::Make(fScale, fScale); | 274 SkVector scale = SkVector::Make(fScale, fScale); |
| 275 ctm.mapVectors(&scale, 1); | 275 ctm.mapVectors(&scale, 1); |
| 276 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), | 276 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), |
| 277 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); | 277 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); |
| 278 if (getColorInput()) { | 278 if (getColorInput()) { |
| 279 return getColorInput()->filterBounds(bounds, ctm, dst); | 279 return getColorInput()->filterBounds(bounds, ctm, dst); |
| 280 } | 280 } |
| 281 *dst = bounds; | 281 *dst = bounds; |
| 282 return true; | 282 return true; |
| 283 } | 283 } |
| 284 | 284 |
| 285 #ifndef SK_IGNORE_TO_STRING | 285 #ifndef SK_IGNORE_TO_STRING |
| 286 void SkDisplacementMapEffect::toString(SkString* str) const { | 286 void SkDisplacementMapEffect::toString(SkString* str) const { |
| 287 str->appendf("SkDisplacementMapEffect: ("); | 287 str->appendf("SkDisplacementMapEffect: ("); |
| 288 this->getCropRect().toString(str); |
| 288 str->appendf("scale: %f ", fScale); | 289 str->appendf("scale: %f ", fScale); |
| 289 str->appendf("displacement: ("); | 290 str->appendf("displacement: ("); |
| 290 if (this->getDisplacementInput()) { | 291 if (this->getDisplacementInput()) { |
| 291 this->getDisplacementInput()->toString(str); | 292 this->getDisplacementInput()->toString(str); |
| 292 } | 293 } |
| 293 str->appendf(") color: ("); | 294 str->appendf(") color: ("); |
| 294 if (this->getColorInput()) { | 295 if (this->getColorInput()) { |
| 295 this->getColorInput()->toString(str); | 296 this->getColorInput()->toString(str); |
| 296 } | 297 } |
| 297 str->appendf("))"); | 298 str->appendf("))"); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 645 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
| 645 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 646 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 646 | 647 |
| 647 uint32_t xKey = displacementMap.xChannelSelector(); | 648 uint32_t xKey = displacementMap.xChannelSelector(); |
| 648 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 649 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 649 | 650 |
| 650 b->add32(xKey | yKey); | 651 b->add32(xKey | yKey); |
| 651 } | 652 } |
| 652 #endif | 653 #endif |
| 653 | 654 |
| OLD | NEW |