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

Unified Diff: gm/gradients_2pt_conical.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/gradients.cpp ('k') | gm/gradients_no_texture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gradients_2pt_conical.cpp
diff --git a/gm/gradients_2pt_conical.cpp b/gm/gradients_2pt_conical.cpp
index c865d7177f7e10dd467b468eb0db72b794366874..f43356eaf6a15a1c4ad12f734f782845f3fa0b22 100644
--- a/gm/gradients_2pt_conical.cpp
+++ b/gm/gradients_2pt_conical.cpp
@@ -40,8 +40,8 @@
static SkShader* Make2ConicalOutside(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(center0, radius0,
@@ -53,8 +53,8 @@
static SkShader* Make2ConicalOutsideFlip(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,
@@ -145,7 +145,7 @@
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
SkScalar radius0 = 0.f;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ 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(center0, radius0,
@@ -158,7 +158,7 @@
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
SkScalar radius0 = 0.f;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ 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,
@@ -170,8 +170,8 @@
static SkShader* Make2ConicalEdgeX(const SkPoint pts[2], const GradData& data,
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
- SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 7);
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
center0.set(center1.fX + radius1, center1.fY);
@@ -184,8 +184,8 @@
static SkShader* Make2ConicalEdgeY(const SkPoint pts[2], const GradData& data,
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
- SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 7);
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
center0.set(center1.fX, center1.fY + radius1);
@@ -199,7 +199,7 @@
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
SkScalar radius0 = 0.f;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
center0.set(center1.fX + radius1, center1.fY);
@@ -213,7 +213,7 @@
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
SkScalar radius0 = 0.f;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
center0.set(center1.fX, center1.fY + radius1);
@@ -226,8 +226,8 @@
static SkShader* Make2ConicalTouchX(const SkPoint pts[2], const GradData& data,
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
- SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 7);
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
center0.set(center1.fX - radius1 + radius0, center1.fY);
@@ -240,8 +240,8 @@
static SkShader* Make2ConicalTouchY(const SkPoint pts[2], const GradData& data,
SkShader::TileMode tm, const SkMatrix& localMatrix) {
SkPoint center0, center1;
- SkScalar radius0 = (pts[1].fX - pts[0].fX) / 7;
- SkScalar radius1 = (pts[1].fX - pts[0].fX) / 3;
+ SkScalar radius0 = SkScalarDiv(pts[1].fX - pts[0].fX, 7);
+ SkScalar radius1 = SkScalarDiv(pts[1].fX - pts[0].fX, 3);
center1.set(SkScalarAve(pts[0].fX, pts[1].fX),
SkScalarAve(pts[0].fY, pts[1].fY));
center0.set(center1.fX, center1.fY + radius1 - radius0);
« no previous file with comments | « gm/gradients.cpp ('k') | gm/gradients_no_texture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698