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

Side by Side Diff: src/effects/gradients/SkGradientShader.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/SkXfermodeImageFilter.cpp ('k') | tests/ImageFilterTest.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkGradientShaderPriv.h" 8 #include "SkGradientShaderPriv.h"
9 #include "SkLinearGradient.h" 9 #include "SkLinearGradient.h"
10 #include "SkRadialGradient.h" 10 #include "SkRadialGradient.h"
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 info->fGradientFlags = fGradFlags; 697 info->fGradientFlags = fGradFlags;
698 } 698 }
699 } 699 }
700 700
701 #ifndef SK_IGNORE_TO_STRING 701 #ifndef SK_IGNORE_TO_STRING
702 void SkGradientShaderBase::toString(SkString* str) const { 702 void SkGradientShaderBase::toString(SkString* str) const {
703 703
704 str->appendf("%d colors: ", fColorCount); 704 str->appendf("%d colors: ", fColorCount);
705 705
706 for (int i = 0; i < fColorCount; ++i) { 706 for (int i = 0; i < fColorCount; ++i) {
707 str->appendHex(fOrigColors[i]); 707 str->appendHex(fOrigColors[i], 8);
708 if (i < fColorCount-1) { 708 if (i < fColorCount-1) {
709 str->append(", "); 709 str->append(", ");
710 } 710 }
711 } 711 }
712 712
713 if (fColorCount > 2) { 713 if (fColorCount > 2) {
714 str->append(" points: ("); 714 str->append(" points: (");
715 for (int i = 0; i < fColorCount; ++i) { 715 for (int i = 0; i < fColorCount; ++i) {
716 str->appendScalar(SkFixedToScalar(fRecs[i].fPos)); 716 str->appendScalar(SkFixedToScalar(fRecs[i].fPos));
717 if (i < fColorCount-1) { 717 if (i < fColorCount-1) {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 (*stops)[i] = stop; 1182 (*stops)[i] = stop;
1183 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1183 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1184 } 1184 }
1185 } 1185 }
1186 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1186 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1187 1187
1188 return outColors; 1188 return outColors;
1189 } 1189 }
1190 1190
1191 #endif 1191 #endif
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698