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

Side by Side Diff: src/effects/gradients/SkGradientShader.cpp

Issue 366133002: move SkChecksum and SkEmptyShader to private (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 months 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/core/SkEmptyShader.h ('k') | tests/GradientTest.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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 str->append(" "); 691 str->append(" ");
692 str->append(gTileModeName[fTileMode]); 692 str->append(gTileModeName[fTileMode]);
693 693
694 this->INHERITED::toString(str); 694 this->INHERITED::toString(str);
695 } 695 }
696 #endif 696 #endif
697 697
698 /////////////////////////////////////////////////////////////////////////////// 698 ///////////////////////////////////////////////////////////////////////////////
699 /////////////////////////////////////////////////////////////////////////////// 699 ///////////////////////////////////////////////////////////////////////////////
700 700
701 #include "SkEmptyShader.h"
702
703 // assumes colors is SkColor* and pos is SkScalar* 701 // assumes colors is SkColor* and pos is SkScalar*
704 #define EXPAND_1_COLOR(count) \ 702 #define EXPAND_1_COLOR(count) \
705 SkColor tmp[2]; \ 703 SkColor tmp[2]; \
706 do { \ 704 do { \
707 if (1 == count) { \ 705 if (1 == count) { \
708 tmp[0] = tmp[1] = colors[0]; \ 706 tmp[0] = tmp[1] = colors[0]; \
709 colors = tmp; \ 707 colors = tmp; \
710 pos = NULL; \ 708 pos = NULL; \
711 count = 2; \ 709 count = 2; \
712 } \ 710 } \
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 const SkColor colors[], 781 const SkColor colors[],
784 const SkScalar pos[], 782 const SkScalar pos[],
785 int colorCount, 783 int colorCount,
786 SkShader::TileMode mode, 784 SkShader::TileMode mode,
787 uint32_t flags, 785 uint32_t flags,
788 const SkMatrix* localMatrix) { 786 const SkMatrix* localMatrix) {
789 if (startRadius < 0 || endRadius < 0 || NULL == colors || colorCount < 1) { 787 if (startRadius < 0 || endRadius < 0 || NULL == colors || colorCount < 1) {
790 return NULL; 788 return NULL;
791 } 789 }
792 if (start == end && startRadius == endRadius) { 790 if (start == end && startRadius == endRadius) {
793 return SkNEW(SkEmptyShader); 791 return SkShader::CreateEmptyShader();
794 } 792 }
795 793
796 EXPAND_1_COLOR(colorCount); 794 EXPAND_1_COLOR(colorCount);
797 795
798 bool flipGradient = startRadius > endRadius; 796 bool flipGradient = startRadius > endRadius;
799 797
800 SkGradientShaderBase::Descriptor desc; 798 SkGradientShaderBase::Descriptor desc;
801 799
802 if (!flipGradient) { 800 if (!flipGradient) {
803 desc_init(&desc, colors, pos, colorCount, mode, flags); 801 desc_init(&desc, colors, pos, colorCount, mode, flags);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 (*stops)[i] = stop; 1147 (*stops)[i] = stop;
1150 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1148 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1151 } 1149 }
1152 } 1150 }
1153 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1151 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1154 1152
1155 return outColors; 1153 return outColors;
1156 } 1154 }
1157 1155
1158 #endif 1156 #endif
OLDNEW
« no previous file with comments | « src/core/SkEmptyShader.h ('k') | tests/GradientTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698