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

Side by Side Diff: gm/shadertext.cpp

Issue 1114243005: remove (redundant) twopointradial shader (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 | « gm/gradients_no_texture.cpp ('k') | gm/twopointradial.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 2011 Google Inc. 2 * Copyright 2011 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 "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 data.fPos, data.fCount, tm); 57 data.fPos, data.fCount, tm);
58 } 58 }
59 59
60 static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data, SkShader: :TileMode) { 60 static SkShader* MakeSweep(const SkPoint pts[2], const GradData& data, SkShader: :TileMode) {
61 SkPoint center; 61 SkPoint center;
62 center.set(SkScalarAve(pts[0].fX, pts[1].fX), 62 center.set(SkScalarAve(pts[0].fX, pts[1].fX),
63 SkScalarAve(pts[0].fY, pts[1].fY)); 63 SkScalarAve(pts[0].fY, pts[1].fY));
64 return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, dat a.fPos, data.fCount); 64 return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, dat a.fPos, data.fCount);
65 } 65 }
66 66
67 static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, SkShade r::TileMode tm) { 67 static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data, SkShad er::TileMode tm) {
68 SkPoint center0, center1; 68 SkPoint center0, center1;
69 center0.set(SkScalarAve(pts[0].fX, pts[1].fX), 69 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
70 SkScalarAve(pts[0].fY, pts[1].fY)); 70 SkScalarAve(pts[0].fY, pts[1].fY));
71 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), 71 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
72 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); 72 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
73 return SkGradientShader::CreateTwoPointRadial( 73 return SkGradientShader::CreateTwoPointConical(
74 center1, (pts[1].fX - pts[0].fX) / 7, 74 center1, (pts[1].fX - pts[0].fX) / 7,
75 center0, (pts[1].fX - pts[0].fX) / 2, 75 center0, (pts[1].fX - pts[0].fX) / 2,
76 data.fColors, data.fPos, data.fCount, tm); 76 data.fColors, data.fPos, data.fCount, tm);
77 } 77 }
78 78
79 typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, SkSha der::TileMode tm); 79 typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, SkSha der::TileMode tm);
80 80
81 static const GradMaker gGradMakers[] = { 81 static const GradMaker gGradMakers[] = {
82 MakeLinear, MakeRadial, MakeSweep, Make2Radial 82 MakeLinear, MakeRadial, MakeSweep, Make2Conical
83 }; 83 };
84 84
85 /////////////////////////////////////////////////////////////////////////////// 85 ///////////////////////////////////////////////////////////////////////////////
86 86
87 class ShaderTextGM : public GM { 87 class ShaderTextGM : public GM {
88 public: 88 public:
89 ShaderTextGM() { 89 ShaderTextGM() {
90 this->setBGColor(0xFFDDDDDD); 90 this->setBGColor(0xFFDDDDDD);
91 } 91 }
92 92
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 private: 183 private:
184 typedef GM INHERITED; 184 typedef GM INHERITED;
185 }; 185 };
186 186
187 /////////////////////////////////////////////////////////////////////////////// 187 ///////////////////////////////////////////////////////////////////////////////
188 188
189 static GM* MyFactory(void*) { return new ShaderTextGM; } 189 static GM* MyFactory(void*) { return new ShaderTextGM; }
190 static GMRegistry reg(MyFactory); 190 static GMRegistry reg(MyFactory);
191 } 191 }
OLDNEW
« no previous file with comments | « gm/gradients_no_texture.cpp ('k') | gm/twopointradial.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698