diff options
author | Mike Reed <reed@google.com> | 2017-02-04 11:04:26 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-06 15:12:41 +0000 |
commit | a99b6ceff92183b424634f2e7276b9ea1d59e69d (patch) | |
tree | 64c99a642565c74e7aac703f07b8669825c90d40 /src/utils | |
parent | adacaef799455013bf00b85a43237ac8d9471ade (diff) |
start removing uses of SkScalarMul
BUG=skia:6197
Change-Id: Ic444c7ee4ca547f483dc8232dcacd6d4ba87d913
Reviewed-on: https://skia-review.googlesource.com/8041
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkCamera.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkDashPath.cpp | 14 | ||||
-rw-r--r-- | src/utils/SkTextBox.cpp | 4 |
3 files changed, 12 insertions, 14 deletions
diff --git a/src/utils/SkCamera.cpp b/src/utils/SkCamera.cpp index c8c462a5f7..23ab396c98 100644 --- a/src/utils/SkCamera.cpp +++ b/src/utils/SkCamera.cpp @@ -83,11 +83,11 @@ void SkPatch3D::transform(const SkMatrix3D& m, SkPatch3D* dst) const { } SkScalar SkPatch3D::dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const { - SkScalar cx = SkScalarMul(fU.fY, fV.fZ) - SkScalarMul(fU.fZ, fV.fY); - SkScalar cy = SkScalarMul(fU.fZ, fV.fX) - SkScalarMul(fU.fX, fV.fY); - SkScalar cz = SkScalarMul(fU.fX, fV.fY) - SkScalarMul(fU.fY, fV.fX); + SkScalar cx = fU.fY * fV.fZ - fU.fZ * fV.fY; + SkScalar cy = fU.fZ * fV.fX - fU.fX * fV.fY; + SkScalar cz = fU.fX * fV.fY - fU.fY * fV.fX; - return SkScalarMul(cx, dx) + SkScalarMul(cy, dy) + SkScalarMul(cz, dz); + return cx * dx + cy * dy + cz * dz; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp index c0cdcc195d..4b5e58ef4f 100644 --- a/src/utils/SkDashPath.cpp +++ b/src/utils/SkDashPath.cpp @@ -77,7 +77,7 @@ static void outset_for_stroke(SkRect* rect, const SkStrokeRec& rec) { radius = SK_Scalar1; // hairlines } if (SkPaint::kMiter_Join == rec.getJoin()) { - radius = SkScalarMul(radius, rec.getMiter()); + radius *= rec.getMiter(); } rect->outset(radius, radius); } @@ -173,9 +173,7 @@ public: // resulting segments = pathLen * intervalCount / intervalLen // resulting points = 4 * segments - SkScalar ptCount = SkScalarMulDiv(pathLength, - SkIntToScalar(intervalCount), - intervalLength); + SkScalar ptCount = pathLength * intervalCount / (float)intervalLength; ptCount = SkTMin(ptCount, SkDashPath::kMaxDashCount); int n = SkScalarCeilToInt(ptCount) << 2; dst->incReserve(n); @@ -192,10 +190,10 @@ public: d1 = fPathLength; } - SkScalar x0 = fPts[0].fX + SkScalarMul(fTangent.fX, d0); - SkScalar x1 = fPts[0].fX + SkScalarMul(fTangent.fX, d1); - SkScalar y0 = fPts[0].fY + SkScalarMul(fTangent.fY, d0); - SkScalar y1 = fPts[0].fY + SkScalarMul(fTangent.fY, d1); + SkScalar x0 = fPts[0].fX + fTangent.fX * d0; + SkScalar x1 = fPts[0].fX + fTangent.fX * d1; + SkScalar y0 = fPts[0].fY + fTangent.fY * d0; + SkScalar y1 = fPts[0].fY + fTangent.fY * d1; SkPoint pts[4]; pts[0].set(x0 + fNormal.fX, y0 + fNormal.fY); // moveTo diff --git a/src/utils/SkTextBox.cpp b/src/utils/SkTextBox.cpp index bc2e2217d9..9b26a9f00b 100644 --- a/src/utils/SkTextBox.cpp +++ b/src/utils/SkTextBox.cpp @@ -192,7 +192,7 @@ SkScalar SkTextBox::visit(Visitor& visitor, const char text[], size_t len, x += fBox.fLeft; fontHeight = paint.getFontMetrics(&metrics); - scaledSpacing = SkScalarMul(fontHeight, fSpacingMul) + fSpacingAdd; + scaledSpacing = fontHeight * fSpacingMul + fSpacingAdd; height = fBox.height(); // compute Y position for first line @@ -271,7 +271,7 @@ int SkTextBox::countLines() const { } SkScalar SkTextBox::getTextHeight() const { - SkScalar spacing = SkScalarMul(fPaint->getTextSize(), fSpacingMul) + fSpacingAdd; + SkScalar spacing = fPaint->getTextSize() * fSpacingMul + fSpacingAdd; return this->countLines() * spacing; } |