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

Side by Side Diff: gm/gradients_no_texture.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 | « gm/gradients.cpp ('k') | gm/shadertext.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 2013 Google Inc. 2 * Copyright 2013 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkGradientShader.h" 8 #include "SkGradientShader.h"
9 9
10 using namespace skiagm; 10 using namespace skiagm;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 SkScalarAve(pts[0].fY, pts[1].fY)); 44 SkScalarAve(pts[0].fY, pts[1].fY));
45 return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, dat a.fPos, data.fCount); 45 return SkGradientShader::CreateSweep(center.fX, center.fY, data.fColors, dat a.fPos, data.fCount);
46 } 46 }
47 47
48 static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, SkShade r::TileMode tm) { 48 static SkShader* Make2Radial(const SkPoint pts[2], const GradData& data, SkShade r::TileMode tm) {
49 SkPoint center0, center1; 49 SkPoint center0, center1;
50 center0.set(SkScalarAve(pts[0].fX, pts[1].fX), 50 center0.set(SkScalarAve(pts[0].fX, pts[1].fX),
51 SkScalarAve(pts[0].fY, pts[1].fY)); 51 SkScalarAve(pts[0].fY, pts[1].fY));
52 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5), 52 center1.set(SkScalarInterp(pts[0].fX, pts[1].fX, SkIntToScalar(3)/5),
53 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4)); 53 SkScalarInterp(pts[0].fY, pts[1].fY, SkIntToScalar(1)/4));
54 return SkGradientShader::CreateTwoPointRadial( 54 return SkGradientShader::CreateTwoPointConical(
55 center1, (pts[1].fX - pts[0].fX) / 7, 55 center1, (pts[1].fX - pts[0].fX) / 7,
56 center0, (pts[1].fX - pts[0].fX) / 2, 56 center0, (pts[1].fX - pts[0].fX) / 2,
57 data.fColors, data.fPos, data.fCount, tm); 57 data.fColors, data.fPos, data.fCount, tm);
58 } 58 }
59 59
60 static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data, SkShad er::TileMode tm) { 60 static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data, SkShad er::TileMode tm) {
61 SkPoint center0, center1; 61 SkPoint center0, center1;
62 SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 10); 62 SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 10);
63 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3); 63 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
64 center0.set(pts[0].fX + radius0, pts[0].fY + radius0); 64 center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 } 243 }
244 244
245 private: 245 private:
246 typedef GM INHERITED; 246 typedef GM INHERITED;
247 }; 247 };
248 248
249 /////////////////////////////////////////////////////////////////////////////// 249 ///////////////////////////////////////////////////////////////////////////////
250 250
251 DEF_GM( return SkNEW(GradientsNoTextureGM)); 251 DEF_GM( return SkNEW(GradientsNoTextureGM));
252 DEF_GM( return SkNEW(GradientsManyColorsGM)); 252 DEF_GM( return SkNEW(GradientsManyColorsGM));
OLDNEW
« no previous file with comments | « gm/gradients.cpp ('k') | gm/shadertext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698