SkScalarMul is deprecated
BUG=skia:
Change-Id: I88ecfe9d4c72506f6b1a0e0dfadd2a5c171a6cb6
Reviewed-on: https://skia-review.googlesource.com/8353
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/gpu/GrDistanceFieldGenFromVector.cpp b/src/gpu/GrDistanceFieldGenFromVector.cpp
index 4a509e6..8867ab1 100644
--- a/src/gpu/GrDistanceFieldGenFromVector.cpp
+++ b/src/gpu/GrDistanceFieldGenFromVector.cpp
@@ -141,7 +141,7 @@
///////////////////////////////////////////////////////////////////////////////
static const double kClose = (SK_Scalar1 / 16.0);
-static const double kCloseSqd = SkScalarMul(kClose, kClose);
+static const double kCloseSqd = kClose * kClose;
static const double kNearlyZero = (SK_Scalar1 / (1 << 18));
static const double kTangentTolerance = (SK_Scalar1 / (1 << 11));
static const float kConicTolerance = 0.25f;
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index aac2838..867407d 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -441,8 +441,9 @@
detABSqd = SkScalarSquare(detABSqd);
SkScalar detDCSqd = dc.cross(da);
detDCSqd = SkScalarSquare(detDCSqd);
- if (SkScalarMul(detABSqd, invDALengthSqd) < toleranceSqd &&
- SkScalarMul(detDCSqd, invDALengthSqd) < toleranceSqd) {
+ if (detABSqd * invDALengthSqd < toleranceSqd &&
+ detDCSqd * invDALengthSqd < toleranceSqd)
+ {
doQuads = true;
}
}
@@ -499,9 +500,9 @@
SkScalar z0 = -ab.dot(p[0]);
dc.setOrthog(dc);
SkScalar z1 = -dc.dot(p[3]);
- cAvg.fX = SkScalarMul(ab.fY, z1) - SkScalarMul(z0, dc.fY);
- cAvg.fY = SkScalarMul(z0, dc.fX) - SkScalarMul(ab.fX, z1);
- SkScalar z = SkScalarMul(ab.fX, dc.fY) - SkScalarMul(ab.fY, dc.fX);
+ cAvg.fX = ab.fY * z1 - z0 * dc.fY;
+ cAvg.fY = z0 * dc.fX - ab.fX * z1;
+ SkScalar z = ab.fX * dc.fY - ab.fY * dc.fX;
z = SkScalarInvert(z);
cAvg.fX *= z;
cAvg.fY *= z;
@@ -512,7 +513,7 @@
// the distances and tolerance can't be negative.
// (d0 + d1)^2 > toleranceSqd
// d0Sqd + 2*d0*d1 + d1Sqd > toleranceSqd
- SkScalar d0d1 = SkScalarSqrt(SkScalarMul(d0Sqd, d1Sqd));
+ SkScalar d0d1 = SkScalarSqrt(d0Sqd * d1Sqd);
subdivide = 2 * d0d1 + d0Sqd + d1Sqd > toleranceSqd;
}
}
diff --git a/src/gpu/ops/GrAAConvexPathRenderer.cpp b/src/gpu/ops/GrAAConvexPathRenderer.cpp
index d239732..5d09706 100644
--- a/src/gpu/ops/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAAConvexPathRenderer.cpp
@@ -183,7 +183,7 @@
};
static const SkScalar kClose = (SK_Scalar1 / 16);
-static const SkScalar kCloseSqd = SkScalarMul(kClose, kClose);
+static const SkScalar kCloseSqd = kClose * kClose;
static void update_degenerate_test(DegenerateTestData* data, const SkPoint& pt) {
switch (data->fStage) {
@@ -218,8 +218,8 @@
}
// check whether m reverses the orientation
SkASSERT(!m.hasPerspective());
- SkScalar det2x2 = SkScalarMul(m.get(SkMatrix::kMScaleX), m.get(SkMatrix::kMScaleY)) -
- SkScalarMul(m.get(SkMatrix::kMSkewX), m.get(SkMatrix::kMSkewY));
+ SkScalar det2x2 = m.get(SkMatrix::kMScaleX) * m.get(SkMatrix::kMScaleY) -
+ m.get(SkMatrix::kMSkewX) * m.get(SkMatrix::kMSkewY);
if (det2x2 < 0) {
*dir = SkPathPriv::OppositeFirstDirection(*dir);
}
diff --git a/src/gpu/ops/GrAAConvexTessellator.cpp b/src/gpu/ops/GrAAConvexTessellator.cpp
index b9c44ff..3ee34e2 100644
--- a/src/gpu/ops/GrAAConvexTessellator.cpp
+++ b/src/gpu/ops/GrAAConvexTessellator.cpp
@@ -19,7 +19,7 @@
// The tolerance for fusing vertices and eliminating colinear lines (It is in device space).
static const SkScalar kClose = (SK_Scalar1 / 16);
-static const SkScalar kCloseSqd = SkScalarMul(kClose, kClose);
+static const SkScalar kCloseSqd = kClose * kClose;
// tesselation tolerance values, in device space pixels
static const SkScalar kQuadTolerance = 0.2f;
@@ -503,9 +503,9 @@
int prev = numPts - 1;
int lastPerpIdx = -1, firstPerpIdx = -1;
- const SkScalar outsetSq = SkScalarMul(outset, outset);
- SkScalar miterLimitSq = SkScalarMul(outset, fMiterLimit);
- miterLimitSq = SkScalarMul(miterLimitSq, miterLimitSq);
+ const SkScalar outsetSq = outset * outset;
+ SkScalar miterLimitSq = outset * fMiterLimit;
+ miterLimitSq = miterLimitSq * miterLimitSq;
for (int cur = 0; cur < numPts; ++cur) {
int originalIdx = previousRing.index(cur);
// For each vertex of the original polygon we add at least two points to the
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index f17b218..09f6c04 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -175,7 +175,7 @@
static int is_degen_quad_or_conic(const SkPoint p[3], SkScalar* dsqd) {
static const SkScalar gDegenerateToLineTol = GrPathUtils::kDefaultTolerance;
static const SkScalar gDegenerateToLineTolSqd =
- SkScalarMul(gDegenerateToLineTol, gDegenerateToLineTol);
+ gDegenerateToLineTol * gDegenerateToLineTol;
if (p[0].distanceToSqd(p[1]) < gDegenerateToLineTolSqd ||
p[1].distanceToSqd(p[2]) < gDegenerateToLineTolSqd) {
@@ -212,7 +212,7 @@
// maybe different when do this using gpu (geo or tess shaders)
static const SkScalar gSubdivTol = 175 * SK_Scalar1;
- if (dsqd <= SkScalarMul(gSubdivTol, gSubdivTol)) {
+ if (dsqd <= gSubdivTol * gSubdivTol) {
return 0;
} else {
static const int kMaxSub = 4;
@@ -431,15 +431,14 @@
SkScalar lineAW = -normA.dot(ptA);
SkScalar lineBW = -normB.dot(ptB);
- SkScalar wInv = SkScalarMul(normA.fX, normB.fY) -
- SkScalarMul(normA.fY, normB.fX);
+ SkScalar wInv = normA.fX * normB.fY - normA.fY * normB.fX;
wInv = SkScalarInvert(wInv);
- result->fX = SkScalarMul(normA.fY, lineBW) - SkScalarMul(lineAW, normB.fY);
- result->fX = SkScalarMul(result->fX, wInv);
+ result->fX = normA.fY * lineBW - lineAW * normB.fY;
+ result->fX *= wInv;
- result->fY = SkScalarMul(lineAW, normB.fX) - SkScalarMul(normA.fX, lineBW);
- result->fY = SkScalarMul(result->fY, wInv);
+ result->fY = lineAW * normB.fX - normA.fX * lineBW;
+ result->fY *= wInv;
}
static void set_uv_quad(const SkPoint qpts[3], BezierVertex verts[kQuadNumVertices]) {
diff --git a/src/gpu/ops/GrAAStrokeRectOp.cpp b/src/gpu/ops/GrAAStrokeRectOp.cpp
index c30be77..25f5071 100644
--- a/src/gpu/ops/GrAAStrokeRectOp.cpp
+++ b/src/gpu/ops/GrAAStrokeRectOp.cpp
@@ -58,8 +58,8 @@
const SkScalar dx = devStrokeSize.fX;
const SkScalar dy = devStrokeSize.fY;
- const SkScalar rx = SkScalarMul(dx, SK_ScalarHalf);
- const SkScalar ry = SkScalarMul(dy, SK_ScalarHalf);
+ const SkScalar rx = SkScalarHalf(dx);
+ const SkScalar ry = SkScalarHalf(dy);
*devOutside = devRect;
*devOutsideAssist = devRect;
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 5ac71d8..b4d3812 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -298,7 +298,7 @@
const SkPath& path,
SkScalar srcSpaceTol,
bool isIndexed) const {
- SkScalar srcSpaceTolSqd = SkScalarMul(srcSpaceTol, srcSpaceTol);
+ SkScalar srcSpaceTolSqd = srcSpaceTol * srcSpaceTol;
uint16_t indexOffsetU16 = (uint16_t)indexOffset;
uint16_t vertexOffsetU16 = (uint16_t)vertexOffset;
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 5c3b8b9..ab28ae7 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -351,7 +351,7 @@
kStdFakeBoldInterpKeys,
kStdFakeBoldInterpValues,
kStdFakeBoldInterpLength);
- SkScalar extra = SkScalarMul(fFont.getTextSize(), fakeBoldScale);
+ SkScalar extra = fFont.getTextSize() * fakeBoldScale;
SkStrokeRec strokeRec(SkStrokeRec::kFill_InitStyle);
strokeRec.setStrokeStyle(stroke.needToApply() ? stroke.getWidth() + extra : extra,