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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 ctm.mapVectors(&scale, 1); | 274 ctm.mapVectors(&scale, 1); |
275 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), | 275 bounds.outset(SkScalarCeilToInt(scale.fX * SK_ScalarHalf), |
276 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); | 276 SkScalarCeilToInt(scale.fY * SK_ScalarHalf)); |
277 if (getColorInput()) { | 277 if (getColorInput()) { |
278 return getColorInput()->filterBounds(bounds, ctm, dst); | 278 return getColorInput()->filterBounds(bounds, ctm, dst); |
279 } | 279 } |
280 *dst = bounds; | 280 *dst = bounds; |
281 return true; | 281 return true; |
282 } | 282 } |
283 | 283 |
| 284 #ifndef SK_IGNORE_TO_STRING |
| 285 void SkDisplacementMapEffect::toString(SkString* str) const { |
| 286 str->appendf("SkDisplacementMapEffect: ("); |
| 287 str->appendf("scale: %f ", fScale); |
| 288 str->appendf("displacement: ("); |
| 289 if (this->getDisplacementInput()) { |
| 290 this->getDisplacementInput()->toString(str); |
| 291 } |
| 292 str->appendf(") color: ("); |
| 293 if (this->getColorInput()) { |
| 294 this->getColorInput()->toString(str); |
| 295 } |
| 296 str->appendf("))"); |
| 297 } |
| 298 #endif |
| 299 |
284 /////////////////////////////////////////////////////////////////////////////// | 300 /////////////////////////////////////////////////////////////////////////////// |
285 | 301 |
286 #if SK_SUPPORT_GPU | 302 #if SK_SUPPORT_GPU |
287 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor { | 303 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor { |
288 public: | 304 public: |
289 GrGLDisplacementMapEffect(const GrProcessor&); | 305 GrGLDisplacementMapEffect(const GrProcessor&); |
290 virtual ~GrGLDisplacementMapEffect(); | 306 virtual ~GrGLDisplacementMapEffect(); |
291 | 307 |
292 virtual void emitCode(GrGLFPBuilder*, | 308 virtual void emitCode(GrGLFPBuilder*, |
293 const GrFragmentProcessor&, | 309 const GrFragmentProcessor&, |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 629 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
614 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 630 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
615 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 631 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
616 | 632 |
617 uint32_t xKey = displacementMap.xChannelSelector(); | 633 uint32_t xKey = displacementMap.xChannelSelector(); |
618 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 634 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
619 | 635 |
620 b->add32(xKey | yKey); | 636 b->add32(xKey | yKey); |
621 } | 637 } |
622 #endif | 638 #endif |
| 639 |
OLD | NEW |