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

Side by Side Diff: gm/gradients_no_texture.cpp

Issue 1135053002: stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix xpsdevice 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_2pt_conical.cpp ('k') | gm/imagefiltersclipped.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::CreateTwoPointConical( 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 = (pts[1].fX - pts[0].fX) / 10;
63 SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3); 63 SkScalar radius1 = (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);
65 center1.set(pts[1].fX - radius1, pts[1].fY - radius1); 65 center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
66 return SkGradientShader::CreateTwoPointConical(center1, radius1, 66 return SkGradientShader::CreateTwoPointConical(center1, radius1,
67 center0, radius0, 67 center0, radius0,
68 data.fColors, data.fPos, 68 data.fColors, data.fPos,
69 data.fCount, tm); 69 data.fCount, tm);
70 } 70 }
71 71
72 72
73 typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, SkSha der::TileMode tm); 73 typedef SkShader* (*GradMaker)(const SkPoint pts[2], const GradData& data, SkSha der::TileMode tm);
(...skipping 169 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_2pt_conical.cpp ('k') | gm/imagefiltersclipped.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698