Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 789163006: Add toString methods to SkImageFilter-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make sure leading 0's aren't stripped off colors Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkComposeImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/effects/SkComposeImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698