From 2e1b99e61ff572a45ac1238e940d090ca166b40f Mon Sep 17 00:00:00 2001 From: "caryclark@google.com" Date: Fri, 8 Nov 2013 18:05:02 +0000 Subject: [PATCH] optimize floating pt, save a few instructions git-svn-id: http://skia.googlecode.com/svn/trunk@12199 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPath.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 873f433364..e6d606c1b1 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -1017,10 +1017,12 @@ static void add_corner_quads(SkPath* path, const SkRRect& rrect, SkScalar ry = radii.fY; // The mid point of the quadratic arc approximation is half way between the two // control points. - SkScalar midPtX = rx - rx * (SK_Scalar1 + SK_ScalarTanPIOver8) / 2; - SkScalar midPtY = ry - ry * (SK_Scalar1 + SK_ScalarTanPIOver8) / 2; - SkScalar offPtX = rx - rx * SK_ScalarTanPIOver8; - SkScalar offPtY = ry - ry * SK_ScalarTanPIOver8; + const SkScalar mid = 1 - (SK_Scalar1 + SK_ScalarTanPIOver8) / 2; + SkScalar midPtX = rx * mid; + SkScalar midPtY = ry * mid; + const SkScalar control = 1 - SK_ScalarTanPIOver8; + SkScalar offPtX = rx * control; + SkScalar offPtY = ry * control; static const int kCornerPts = 5; SkScalar xOff[kCornerPts]; SkScalar yOff[kCornerPts];