OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |