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

Unified Diff: gm/gradients.cpp

Issue 1138263002: Revert of stop calling SkScalarDiv (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/glyph_pos.cpp ('k') | gm/gradients_2pt_conical.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradients.cpp
diff --git a/gm/gradients.cpp b/gm/gradients.cpp
index 4e6aba952100028f1f0194ab6afb453606e32525..eb1409d625720cf230abf07c3846a4d9f9b403bb 100644
--- a/gm/gradients.cpp
+++ b/gm/gradients.cpp
@@ -80,8 +80,8 @@
static SkShader* Make2Conical(const SkPoint pts[2], const GradData& data,
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
- SkScalar radius0 = (pts[1].fX - pts[0].fX) / 10;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 10);
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center0.set(pts[0].fX + radius0, pts[0].fY + radius0);
center1.set(pts[1].fX - radius1, pts[1].fY - radius1);
return SkGradientShader::CreateTwoPointConical(center1, radius1,
@@ -185,8 +185,10 @@
// apply an increasing y perspective as we move to the right
SkMatrix perspective;
perspective.setIdentity();
- perspective.setPerspY(SkIntToScalar(i+1) / 500);
- perspective.setSkewX(SkIntToScalar(i+1) / 10);
+ perspective.setPerspY(SkScalarDiv(SkIntToScalar((unsigned) i+1),
+ SkIntToScalar(500)));
+ perspective.setSkewX(SkScalarDiv(SkIntToScalar((unsigned) i+1),
+ SkIntToScalar(10)));
SkShader* shader = gGradMakers[j](pts, gGradData[i], tm, perspective);
@@ -218,8 +220,8 @@
virtual void onDraw(SkCanvas* canvas) {
SkMatrix perspective;
perspective.setIdentity();
- perspective.setPerspY(0.001f);
- perspective.setSkewX(SkIntToScalar(8) / 25);
+ perspective.setPerspY(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000)));
+ perspective.setSkewX(SkScalarDiv(SkIntToScalar(8), SkIntToScalar(25)));
canvas->concat(perspective);
INHERITED::onDraw(canvas);
}
« no previous file with comments | « gm/glyph_pos.cpp ('k') | gm/gradients_2pt_conical.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698