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

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

Issue 1117423003: remove redundant/deprecated TwoPointRadial gradiet -- use TwoPointConical (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/device/xps/SkXPSDevice.cpp ('k') | src/effects/gradients/SkTwoPointRadialGradient.h » ('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"
11 #include "SkTwoPointRadialGradient.h"
12 #include "SkTwoPointConicalGradient.h" 11 #include "SkTwoPointConicalGradient.h"
13 #include "SkSweepGradient.h" 12 #include "SkSweepGradient.h"
14 13
15 void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const { 14 void SkGradientShaderBase::Descriptor::flatten(SkWriteBuffer& buffer) const {
16 buffer.writeColorArray(fColors, fCount); 15 buffer.writeColorArray(fColors, fCount);
17 if (fPos) { 16 if (fPos) {
18 buffer.writeBool(true); 17 buffer.writeBool(true);
19 buffer.writeScalarArray(fPos, fCount); 18 buffer.writeScalarArray(fPos, fCount);
20 } else { 19 } else {
21 buffer.writeBool(false); 20 buffer.writeBool(false);
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 if (!valid_grad(colors, pos, colorCount, mode)) { 794 if (!valid_grad(colors, pos, colorCount, mode)) {
796 return NULL; 795 return NULL;
797 } 796 }
798 EXPAND_1_COLOR(colorCount); 797 EXPAND_1_COLOR(colorCount);
799 798
800 SkGradientShaderBase::Descriptor desc; 799 SkGradientShaderBase::Descriptor desc;
801 desc_init(&desc, colors, pos, colorCount, mode, flags, localMatrix); 800 desc_init(&desc, colors, pos, colorCount, mode, flags, localMatrix);
802 return SkNEW_ARGS(SkRadialGradient, (center, radius, desc)); 801 return SkNEW_ARGS(SkRadialGradient, (center, radius, desc));
803 } 802 }
804 803
805 SkShader* SkGradientShader::CreateTwoPointRadial(const SkPoint& start,
806 SkScalar startRadius,
807 const SkPoint& end,
808 SkScalar endRadius,
809 const SkColor colors[],
810 const SkScalar pos[],
811 int colorCount,
812 SkShader::TileMode mode,
813 uint32_t flags,
814 const SkMatrix* localMatrix) {
815 if (startRadius < 0 || endRadius < 0) {
816 return NULL;
817 }
818 if (!valid_grad(colors, pos, colorCount, mode)) {
819 return NULL;
820 }
821 EXPAND_1_COLOR(colorCount);
822
823 SkGradientShaderBase::Descriptor desc;
824 desc_init(&desc, colors, pos, colorCount, mode, flags, localMatrix);
825 return SkNEW_ARGS(SkTwoPointRadialGradient,
826 (start, startRadius, end, endRadius, desc));
827 }
828
829 SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start, 804 SkShader* SkGradientShader::CreateTwoPointConical(const SkPoint& start,
830 SkScalar startRadius, 805 SkScalar startRadius,
831 const SkPoint& end, 806 const SkPoint& end,
832 SkScalar endRadius, 807 SkScalar endRadius,
833 const SkColor colors[], 808 const SkColor colors[],
834 const SkScalar pos[], 809 const SkScalar pos[],
835 int colorCount, 810 int colorCount,
836 SkShader::TileMode mode, 811 SkShader::TileMode mode,
837 uint32_t flags, 812 uint32_t flags,
838 const SkMatrix* localMatrix) { 813 const SkMatrix* localMatrix) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 865
891 SkGradientShaderBase::Descriptor desc; 866 SkGradientShaderBase::Descriptor desc;
892 desc_init(&desc, colors, pos, colorCount, SkShader::kClamp_TileMode, flags, localMatrix); 867 desc_init(&desc, colors, pos, colorCount, SkShader::kClamp_TileMode, flags, localMatrix);
893 return SkNEW_ARGS(SkSweepGradient, (cx, cy, desc)); 868 return SkNEW_ARGS(SkSweepGradient, (cx, cy, desc));
894 } 869 }
895 870
896 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkGradientShader) 871 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkGradientShader)
897 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLinearGradient) 872 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLinearGradient)
898 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRadialGradient) 873 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRadialGradient)
899 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSweepGradient) 874 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSweepGradient)
900 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTwoPointRadialGradient)
901 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTwoPointConicalGradient) 875 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTwoPointConicalGradient)
902 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 876 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
903 877
904 /////////////////////////////////////////////////////////////////////////////// 878 ///////////////////////////////////////////////////////////////////////////////
905 879
906 #if SK_SUPPORT_GPU 880 #if SK_SUPPORT_GPU
907 881
908 #include "effects/GrTextureStripAtlas.h" 882 #include "effects/GrTextureStripAtlas.h"
909 #include "GrInvariantOutput.h" 883 #include "GrInvariantOutput.h"
910 #include "gl/builders/GrGLProgramBuilder.h" 884 #include "gl/builders/GrGLProgramBuilder.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 (*stops)[i] = stop; 1177 (*stops)[i] = stop;
1204 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f; 1178 stop = i < outColors - 1 ? stop + random->nextUScalar1() * (1.f - st op) : 1.f;
1205 } 1179 }
1206 } 1180 }
1207 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount)); 1181 *tm = static_cast<SkShader::TileMode>(random->nextULessThan(SkShader::kTileM odeCount));
1208 1182
1209 return outColors; 1183 return outColors;
1210 } 1184 }
1211 1185
1212 #endif 1186 #endif
OLDNEW
« no previous file with comments | « src/device/xps/SkXPSDevice.cpp ('k') | src/effects/gradients/SkTwoPointRadialGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698