aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-17 16:44:46 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-17 16:44:46 +0000
commit8f4d2306fa866a26f9448048ff63f692b2ba43aa (patch)
tree7a48d817cb5220f87e81781320b002eead2495a0 /src/core
parenta34b638b909f58dd7c66546a0f49923112f7f785 (diff)
remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats
To keep the CL (slightly) managable, this does not make any changes to existing macros (e.g. SkScalarMul). Just tackling #ifdef constructs this time around. BUG= R=bsalomon@google.com, caryclark@google.com Review URL: https://codereview.chromium.org/117053002 git-svn-id: http://skia.googlecode.com/svn/trunk@12712 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCanvas.cpp18
-rw-r--r--src/core/SkCubicClipper.cpp8
-rw-r--r--src/core/SkEdge.cpp30
-rw-r--r--src/core/SkEdge.h8
-rw-r--r--src/core/SkFDot6.h9
-rw-r--r--src/core/SkFlattenableBuffers.cpp3
-rw-r--r--src/core/SkGeometry.cpp129
-rw-r--r--src/core/SkLineClipper.cpp14
-rw-r--r--src/core/SkMath.cpp10
-rw-r--r--src/core/SkMatrix.cpp209
-rw-r--r--src/core/SkPaint.cpp18
-rw-r--r--src/core/SkPathMeasure.cpp5
-rw-r--r--src/core/SkPicture.cpp4
-rw-r--r--src/core/SkRect.cpp30
-rw-r--r--src/core/SkScan.cpp8
-rw-r--r--src/core/SkScan.h22
-rw-r--r--src/core/SkScan_AntiPath.cpp7
-rw-r--r--src/core/SkScan_Antihair.cpp10
-rw-r--r--src/core/SkScan_Hairline.cpp2
-rw-r--r--src/core/SkStrokerPriv.cpp6
20 files changed, 82 insertions, 468 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index feeba758fa..dfaf65dd98 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1457,13 +1457,6 @@ bool SkCanvas::quickReject(const SkPath& path) const {
}
static inline int pinIntForScalar(int x) {
-#ifdef SK_SCALAR_IS_FIXED
- if (x < SK_MinS16) {
- x = SK_MinS16;
- } else if (x > SK_MaxS16) {
- x = SK_MaxS16;
- }
-#endif
return x;
}
@@ -1487,15 +1480,8 @@ bool SkCanvas::getClipBounds(SkRect* bounds) const {
// adjust it outwards in case we are antialiasing
const int inset = 1;
- // SkRect::iset() will correctly assert if we pass a value out of range
- // (when SkScalar==fixed), so we pin to legal values. This does not
- // really returnt the correct answer, but its the best we can do given
- // that we've promised to return SkRect (even though we support devices
- // that can be larger than 32K in width or height).
- r.iset(pinIntForScalar(ibounds.fLeft - inset),
- pinIntForScalar(ibounds.fTop - inset),
- pinIntForScalar(ibounds.fRight + inset),
- pinIntForScalar(ibounds.fBottom + inset));
+ r.iset(ibounds.fLeft - inset, ibounds.fTop - inset,
+ ibounds.fRight + inset, ibounds.fBottom + inset);
inverse.mapRect(bounds, r);
}
return true;
diff --git a/src/core/SkCubicClipper.cpp b/src/core/SkCubicClipper.cpp
index aed681b9f3..81ef18de7a 100644
--- a/src/core/SkCubicClipper.cpp
+++ b/src/core/SkCubicClipper.cpp
@@ -31,11 +31,7 @@ static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) {
// Initial guess.
// TODO(turk): Check for zero denominator? Shouldn't happen unless the curve
// is not only monotonic but degenerate.
-#ifdef SK_SCALAR_IS_FLOAT
SkScalar t1 = ycrv[0] / (ycrv[0] - ycrv[3]);
-#else // !SK_SCALAR_IS_FLOAT
- SkScalar t1 = SkDivBits(ycrv[0], ycrv[0] - ycrv[3], 16);
-#endif // !SK_SCALAR_IS_FLOAT
// Newton's iterations.
const SkScalar tol = SK_Scalar1 / 16384; // This leaves 2 fixed noise bits.
@@ -53,11 +49,7 @@ static bool chopMonoCubicAtY(SkPoint pts[4], SkScalar y, SkScalar* t) {
SkScalar y0123 = SkScalarInterp(y012, y123, t0);
SkScalar yder = (y123 - y012) * 3;
// TODO(turk): check for yder==0: horizontal.
-#ifdef SK_SCALAR_IS_FLOAT
t1 -= y0123 / yder;
-#else // !SK_SCALAR_IS_FLOAT
- t1 -= SkDivBits(y0123, yder, 16);
-#endif // !SK_SCALAR_IS_FLOAT
converged = SkScalarAbs(t1 - t0) <= tol; // NaN-safe
++iters;
} while (!converged && (iters < maxiters));
diff --git a/src/core/SkEdge.cpp b/src/core/SkEdge.cpp
index 8904ca727b..9ce255843f 100644
--- a/src/core/SkEdge.cpp
+++ b/src/core/SkEdge.cpp
@@ -36,19 +36,11 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, const SkIRect* clip,
SkFDot6 x0, y0, x1, y1;
{
-#ifdef SK_SCALAR_IS_FLOAT
float scale = float(1 << (shift + 6));
x0 = int(p0.fX * scale);
y0 = int(p0.fY * scale);
x1 = int(p1.fX * scale);
y1 = int(p1.fY * scale);
-#else
- shift = 10 - shift;
- x0 = p0.fX >> shift;
- y0 = p0.fY >> shift;
- x1 = p1.fX >> shift;
- y1 = p1.fY >> shift;
-#endif
}
int winding = 1;
@@ -179,7 +171,6 @@ int SkQuadraticEdge::setQuadratic(const SkPoint pts[3], int shift)
SkFDot6 x0, y0, x1, y1, x2, y2;
{
-#ifdef SK_SCALAR_IS_FLOAT
float scale = float(1 << (shift + 6));
x0 = int(pts[0].fX * scale);
y0 = int(pts[0].fY * scale);
@@ -187,15 +178,6 @@ int SkQuadraticEdge::setQuadratic(const SkPoint pts[3], int shift)
y1 = int(pts[1].fY * scale);
x2 = int(pts[2].fX * scale);
y2 = int(pts[2].fY * scale);
-#else
- shift = 10 - shift;
- x0 = pts[0].fX >> shift;
- y0 = pts[0].fY >> shift;
- x1 = pts[1].fX >> shift;
- y1 = pts[1].fY >> shift;
- x2 = pts[2].fX >> shift;
- y2 = pts[2].fY >> shift;
-#endif
}
int winding = 1;
@@ -339,7 +321,6 @@ int SkCubicEdge::setCubic(const SkPoint pts[4], const SkIRect* clip, int shift)
SkFDot6 x0, y0, x1, y1, x2, y2, x3, y3;
{
-#ifdef SK_SCALAR_IS_FLOAT
float scale = float(1 << (shift + 6));
x0 = int(pts[0].fX * scale);
y0 = int(pts[0].fY * scale);
@@ -349,17 +330,6 @@ int SkCubicEdge::setCubic(const SkPoint pts[4], const SkIRect* clip, int shift)
y2 = int(pts[2].fY * scale);
x3 = int(pts[3].fX * scale);
y3 = int(pts[3].fY * scale);
-#else
- shift = 10 - shift;
- x0 = pts[0].fX >> shift;
- y0 = pts[0].fY >> shift;
- x1 = pts[1].fX >> shift;
- y1 = pts[1].fY >> shift;
- x2 = pts[2].fX >> shift;
- y2 = pts[2].fY >> shift;
- x3 = pts[3].fX >> shift;
- y3 = pts[3].fY >> shift;
-#endif
}
int winding = 1;
diff --git a/src/core/SkEdge.h b/src/core/SkEdge.h
index ea7c84f78d..091223631f 100644
--- a/src/core/SkEdge.h
+++ b/src/core/SkEdge.h
@@ -89,19 +89,11 @@ int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, int shift) {
SkFDot6 x0, y0, x1, y1;
{
-#ifdef SK_SCALAR_IS_FLOAT
float scale = float(1 << (shift + 6));
x0 = int(p0.fX * scale);
y0 = int(p0.fY * scale);
x1 = int(p1.fX * scale);
y1 = int(p1.fY * scale);
-#else
- shift = 10 - shift;
- x0 = p0.fX >> shift;
- y0 = p0.fY >> shift;
- x1 = p1.fX >> shift;
- y1 = p1.fY >> shift;
-#endif
}
int winding = 1;
diff --git a/src/core/SkFDot6.h b/src/core/SkFDot6.h
index afb369e9b2..5a0ec57f59 100644
--- a/src/core/SkFDot6.h
+++ b/src/core/SkFDot6.h
@@ -39,13 +39,8 @@ inline SkFixed SkFDot6ToFixed(SkFDot6 x) {
return x << 10;
}
-#ifdef SK_SCALAR_IS_FLOAT
- #define SkScalarToFDot6(x) (SkFDot6)((x) * 64)
- #define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f)
-#else
- #define SkScalarToFDot6(x) ((x) >> 10)
- #define SkFDot6ToScalar(x) ((x) << 10)
-#endif
+#define SkScalarToFDot6(x) (SkFDot6)((x) * 64)
+#define SkFDot6ToScalar(x) ((SkScalar)(x) * 0.015625f)
inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) {
SkASSERT(b != 0);
diff --git a/src/core/SkFlattenableBuffers.cpp b/src/core/SkFlattenableBuffers.cpp
index 9da4dd9ee4..fc38529ef7 100644
--- a/src/core/SkFlattenableBuffers.cpp
+++ b/src/core/SkFlattenableBuffers.cpp
@@ -24,9 +24,8 @@ SkFlattenableReadBuffer::SkFlattenableReadBuffer() {
// Set default values. These should be explicitly set by our client
// via setFlags() if the buffer came from serialization.
fFlags = 0;
-#ifdef SK_SCALAR_IS_FLOAT
+ // TODO: remove this flag, since we're always floats (now)
fFlags |= kScalarIsFloat_Flag;
-#endif
if (8 == sizeof(void*)) {
fFlags |= kPtrIs64Bit_Flag;
}
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index f07ca2a101..6295202764 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -68,32 +68,18 @@ bool SkXRayCrossesLine(const SkXRay& pt, const SkPoint pts[2], bool* ambiguous)
involving integer multiplies by 2 or 3, but fewer calls to SkScalarMul.
May also introduce overflow of fixed when we compute our setup.
*/
-#ifdef SK_SCALAR_IS_FIXED
- #define DIRECT_EVAL_OF_POLYNOMIALS
-#endif
+// #define DIRECT_EVAL_OF_POLYNOMIALS
////////////////////////////////////////////////////////////////////////
-#ifdef SK_SCALAR_IS_FIXED
- static int is_not_monotonic(int a, int b, int c, int d)
- {
- return (((a - b) | (b - c) | (c - d)) & ((b - a) | (c - b) | (d - c))) >> 31;
- }
-
- static int is_not_monotonic(int a, int b, int c)
- {
- return (((a - b) | (b - c)) & ((b - a) | (c - b))) >> 31;
- }
-#else
- static int is_not_monotonic(float a, float b, float c)
- {
- float ab = a - b;
- float bc = b - c;
- if (ab < 0)
- bc = -bc;
- return ab == 0 || bc < 0;
+static int is_not_monotonic(float a, float b, float c) {
+ float ab = a - b;
+ float bc = b - c;
+ if (ab < 0) {
+ bc = -bc;
}
-#endif
+ return ab == 0 || bc < 0;
+}
////////////////////////////////////////////////////////////////////////
@@ -141,23 +127,11 @@ int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2])
SkScalar* r = roots;
-#ifdef SK_SCALAR_IS_FLOAT
float R = B*B - 4*A*C;
if (R < 0 || SkScalarIsNaN(R)) { // complex roots
return 0;
}
R = sk_float_sqrt(R);
-#else
- Sk64 RR, tmp;
-
- RR.setMul(B,B);
- tmp.setMul(A,C);
- tmp.shiftLeft(2);
- RR.sub(tmp);
- if (RR.isNeg())
- return 0;
- SkFixed R = RR.getSqrt();
-#endif
SkScalar Q = (B < 0) ? -(B-R)/2 : -(B+R)/2;
r += valid_unit_divide(Q, A, r);
@@ -172,25 +146,8 @@ int SkFindUnitQuadRoots(SkScalar A, SkScalar B, SkScalar C, SkScalar roots[2])
return (int)(r - roots);
}
-#ifdef SK_SCALAR_IS_FIXED
-/** Trim A/B/C down so that they are all <= 32bits
- and then call SkFindUnitQuadRoots()
-*/
-static int Sk64FindFixedQuadRoots(const Sk64& A, const Sk64& B, const Sk64& C, SkFixed roots[2])
-{
- int na = A.shiftToMake32();
- int nb = B.shiftToMake32();
- int nc = C.shiftToMake32();
-
- int shift = SkMax32(na, SkMax32(nb, nc));
- SkASSERT(shift >= 0);
-
- return SkFindUnitQuadRoots(A.getShiftRight(shift), B.getShiftRight(shift), C.getShiftRight(shift), roots);
-}
-#endif
-
-/////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
static SkScalar eval_quad(const SkScalar src[], SkScalar t)
{
@@ -297,11 +254,7 @@ int SkFindQuadExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar tValue[1])
/* At + B == 0
t = -B / A
*/
-#ifdef SK_SCALAR_IS_FIXED
- return is_not_monotonic(a, b, c) && valid_unit_divide(a - b, a - b - b + c, tValue);
-#else
return valid_unit_divide(a - b, a - b - b + c, tValue);
-#endif
}
static inline void flatten_double_quad_extrema(SkScalar coords[14])
@@ -401,31 +354,7 @@ float SkFindQuadMaxCurvature(const SkPoint src[3]) {
SkScalar By = src[0].fY - src[1].fY - src[1].fY + src[2].fY;
SkScalar t = 0; // 0 means don't chop
-#ifdef SK_SCALAR_IS_FLOAT
(void)valid_unit_divide(-(Ax * Bx + Ay * By), Bx * Bx + By * By, &t);
-#else
- // !!! should I use SkFloat here? seems like it
- Sk64 numer, denom, tmp;
-
- numer.setMul(Ax, -Bx);
- tmp.setMul(Ay, -By);
- numer.add(tmp);
-
- if (numer.isPos()) // do nothing if numer <= 0
- {
- denom.setMul(Bx, Bx);
- tmp.setMul(By, By);
- denom.add(tmp);
- SkASSERT(!denom.isNeg());
- if (numer < denom)
- {
- t = numer.getFixedDiv(denom);
- SkASSERT(t >= 0 && t <= SK_Fixed1); // assert that we're numerically stable (ha!)
- if ((unsigned)t >= SK_Fixed1) // runtime check for numerical stability
- t = 0; // ignore the chop
- }
- }
-#endif
return t;
}
@@ -441,11 +370,7 @@ int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5])
}
}
-#ifdef SK_SCALAR_IS_FLOAT
- #define SK_ScalarTwoThirds (0.666666666f)
-#else
- #define SK_ScalarTwoThirds ((SkFixed)(43691))
-#endif
+#define SK_ScalarTwoThirds (0.666666666f)
void SkConvertQuadToCubic(const SkPoint src[3], SkPoint dst[4]) {
const SkScalar scale = SK_ScalarTwoThirds;
@@ -553,11 +478,6 @@ void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint* loc, SkVector* tan
*/
int SkFindCubicExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar d, SkScalar tValues[2])
{
-#ifdef SK_SCALAR_IS_FIXED
- if (!is_not_monotonic(a, b, c, d))
- return 0;
-#endif
-
// we divide A,B,C by 3 to simplify
SkScalar A = d - a + 3*(b - c);
SkScalar B = 2*(a - b - b + c);
@@ -747,29 +667,8 @@ int SkFindCubicInflections(const SkPoint src[4], SkScalar tValues[])
SkScalar By = src[2].fY - 2 * src[1].fY + src[0].fY;
SkScalar Cx = src[3].fX + 3 * (src[1].fX - src[2].fX) - src[0].fX;
SkScalar Cy = src[3].fY + 3 * (src[1].fY - src[2].fY) - src[0].fY;
- int count;
-
-#ifdef SK_SCALAR_IS_FLOAT
- count = SkFindUnitQuadRoots(Bx*Cy - By*Cx, Ax*Cy - Ay*Cx, Ax*By - Ay*Bx, tValues);
-#else
- Sk64 A, B, C, tmp;
-
- A.setMul(Bx, Cy);
- tmp.setMul(By, Cx);
- A.sub(tmp);
-
- B.setMul(Ax, Cy);
- tmp.setMul(Ay, Cx);
- B.sub(tmp);
- C.setMul(Ax, By);
- tmp.setMul(Ay, Bx);
- C.sub(tmp);
-
- count = Sk64FindFixedQuadRoots(A, B, C, tValues);
-#endif
-
- return count;
+ return SkFindUnitQuadRoots(Bx*Cy - By*Cx, Ax*Cy - Ay*Cx, Ax*By - Ay*Bx, tValues);
}
int SkChopCubicAtInflections(const SkPoint src[], SkPoint dst[10])
@@ -891,10 +790,6 @@ static void test_collaps_duplicates() {
}
#endif
-#if defined _WIN32 && _MSC_VER >= 1300 && defined SK_SCALAR_IS_FIXED // disable warning : unreachable code if building fixed point for windows desktop
-#pragma warning ( disable : 4702 )
-#endif
-
static SkScalar SkScalarCubeRoot(SkScalar x) {
return sk_float_pow(x, 0.3333333f);
}
diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp
index 911cd974da..634de0d1e7 100644
--- a/src/core/SkLineClipper.cpp
+++ b/src/core/SkLineClipper.cpp
@@ -28,7 +28,6 @@ static SkScalar sect_with_horizontal(const SkPoint src[2], SkScalar Y) {
if (SkScalarNearlyZero(dy)) {
return SkScalarAve(src[0].fX, src[1].fX);
} else {
-#ifdef SK_SCALAR_IS_FLOAT
// need the extra precision so we don't compute a value that exceeds
// our original limits
double X0 = src[0].fX;
@@ -41,10 +40,6 @@ static SkScalar sect_with_horizontal(const SkPoint src[2], SkScalar Y) {
// when the doubles were added and subtracted, so we have to pin the
// answer :(
return (float)pin_unsorted(result, X0, X1);
-#else
- return src[0].fX + SkScalarMulDiv(Y - src[0].fY, src[1].fX - src[0].fX,
- dy);
-#endif
}
}
@@ -54,7 +49,6 @@ static SkScalar sect_with_vertical(const SkPoint src[2], SkScalar X) {
if (SkScalarNearlyZero(dx)) {
return SkScalarAve(src[0].fY, src[1].fY);
} else {
-#ifdef SK_SCALAR_IS_FLOAT
// need the extra precision so we don't compute a value that exceeds
// our original limits
double X0 = src[0].fX;
@@ -63,10 +57,6 @@ static SkScalar sect_with_vertical(const SkPoint src[2], SkScalar X) {
double Y1 = src[1].fY;
double result = Y0 + ((double)X - X0) * (Y1 - Y0) / (X1 - X0);
return (float)result;
-#else
- return src[0].fY + SkScalarMulDiv(X - src[0].fX, src[1].fY - src[0].fY,
- dx);
-#endif
}
}
@@ -167,7 +157,6 @@ static bool is_between_unsorted(SkScalar value,
}
#endif
-#ifdef SK_SCALAR_IS_FLOAT
#ifdef SK_DEBUG
// This is an example of why we need to pin the result computed in
// sect_with_horizontal. If we didn't explicitly pin, is_between_unsorted would
@@ -182,11 +171,9 @@ static void sect_with_horizontal_test_for_pin_results() {
SkASSERT(is_between_unsorted(x, pts[0].fX, pts[1].fX));
}
#endif
-#endif
int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip,
SkPoint lines[]) {
-#ifdef SK_SCALAR_IS_FLOAT
#ifdef SK_DEBUG
{
static bool gOnce;
@@ -196,7 +183,6 @@ int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip,
}
}
#endif
-#endif
int index0, index1;
diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp
index 2693e5c13c..f1ba3a3a0c 100644
--- a/src/core/SkMath.cpp
+++ b/src/core/SkMath.cpp
@@ -12,11 +12,9 @@
#include "Sk64.h"
#include "SkScalar.h"
-#ifdef SK_SCALAR_IS_FLOAT
- const uint32_t gIEEENotANumber = 0x7FFFFFFF;
- const uint32_t gIEEEInfinity = 0x7F800000;
- const uint32_t gIEEENegativeInfinity = 0xFF800000;
-#endif
+const uint32_t gIEEENotANumber = 0x7FFFFFFF;
+const uint32_t gIEEEInfinity = 0x7F800000;
+const uint32_t gIEEENegativeInfinity = 0xFF800000;
#define sub_shift(zeros, x, n) \
zeros -= n; \
@@ -376,7 +374,6 @@ SkFixed SkFixedMean(SkFixed a, SkFixed b) {
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SCALAR_IS_FLOAT
float SkScalarSinCos(float radians, float* cosValue) {
float sinValue = sk_float_sin(radians);
@@ -392,7 +389,6 @@ float SkScalarSinCos(float radians, float* cosValue) {
}
return sinValue;
}
-#endif
#define INTERP_SINTABLE
#define BUILD_TABLE_AT_RUNTIMEx
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index fd6290fdd6..4493fababb 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -11,15 +11,11 @@
#include "SkOnce.h"
#include "SkString.h"
-#ifdef SK_SCALAR_IS_FLOAT
- #define kMatrix22Elem SK_Scalar1
+#define kMatrix22Elem SK_Scalar1
- static inline float SkDoubleToFloat(double x) {
- return static_cast<float>(x);
- }
-#else
- #define kMatrix22Elem SK_Fract1
-#endif
+static inline float SkDoubleToFloat(double x) {
+ return static_cast<float>(x);
+}
/* [scale-x skew-x trans-x] [X] [X']
[skew-y scale-y trans-y] * [Y] = [Y']
@@ -45,13 +41,7 @@ enum {
kRectStaysRect_Shift
};
-#ifdef SK_SCALAR_IS_FLOAT
- static const int32_t kScalar1Int = 0x3f800000;
-#else
- #define scalarAsInt(x) (x)
- static const int32_t kScalar1Int = (1 << 16);
- static const int32_t kPersp1Int = (1 << 30);
-#endif
+static const int32_t kScalar1Int = 0x3f800000;
uint8_t SkMatrix::computePerspectiveTypeMask() const {
// Benchmarking suggests that replacing this set of SkScalarAs2sCompliment
@@ -133,8 +123,6 @@ uint8_t SkMatrix::computeTypeMask() const {
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SCALAR_IS_FLOAT
-
bool operator==(const SkMatrix& a, const SkMatrix& b) {
const SkScalar* SK_RESTRICT ma = a.fMat;
const SkScalar* SK_RESTRICT mb = b.fMat;
@@ -144,8 +132,6 @@ bool operator==(const SkMatrix& a, const SkMatrix& b) {
ma[6] == mb[6] && ma[7] == mb[7] && ma[8] == mb[8];
}
-#endif
-
///////////////////////////////////////////////////////////////////////////////
// helper function to determine if upper-left 2x2 of matrix is degenerate
@@ -612,71 +598,22 @@ bool SkMatrix::setRectToRect(const SkRect& src, const SkRect& dst,
///////////////////////////////////////////////////////////////////////////////
-#ifdef SK_SCALAR_IS_FLOAT
- static inline int fixmuladdmul(float a, float b, float c, float d,
- float* result) {
- *result = SkDoubleToFloat((double)a * b + (double)c * d);
- return true;
- }
-
- static inline bool rowcol3(const float row[], const float col[],
+static inline int fixmuladdmul(float a, float b, float c, float d,
float* result) {
- *result = row[0] * col[0] + row[1] * col[3] + row[2] * col[6];
- return true;
- }
-
- static inline int negifaddoverflows(float& result, float a, float b) {
- result = a + b;
- return 0;
- }
-#else
- static inline bool fixmuladdmul(SkFixed a, SkFixed b, SkFixed c, SkFixed d,
- SkFixed* result) {
- Sk64 tmp1, tmp2;
- tmp1.setMul(a, b);
- tmp2.setMul(c, d);
- tmp1.add(tmp2);
- if (tmp1.isFixed()) {
- *result = tmp1.getFixed();
- return true;
- }
- return false;
- }
-
- static inline SkFixed fracmuladdmul(SkFixed a, SkFract b, SkFixed c,
- SkFract d) {
- Sk64 tmp1, tmp2;
- tmp1.setMul(a, b);
- tmp2.setMul(c, d);
- tmp1.add(tmp2);
- return tmp1.getFract();
- }
-
- static inline bool rowcol3(const SkFixed row[], const SkFixed col[],
- SkFixed* result) {
- Sk64 tmp1, tmp2;
-
- tmp1.setMul(row[0], col[0]); // N * fixed
- tmp2.setMul(row[1], col[3]); // N * fixed
- tmp1.add(tmp2);
-
- tmp2.setMul(row[2], col[6]); // N * fract
- tmp2.roundRight(14); // make it fixed
- tmp1.add(tmp2);
+ *result = SkDoubleToFloat((double)a * b + (double)c * d);
+ return true;
+}
- if (tmp1.isFixed()) {
- *result = tmp1.getFixed();
- return true;
- }
- return false;
- }
+static inline bool rowcol3(const float row[], const float col[],
+ float* result) {
+ *result = row[0] * col[0] + row[1] * col[3] + row[2] * col[6];
+ return true;
+}
- static inline int negifaddoverflows(SkFixed& result, SkFixed a, SkFixed b) {
- SkFixed c = a + b;
- result = c;
- return (c ^ a) & (c ^ b);
- }
-#endif
+static inline int negifaddoverflows(float& result, float a, float b) {
+ result = a + b;
+ return 0;
+}
static void normalize_perspective(SkScalar mat[9]) {
if (SkScalarAbs(mat[SkMatrix::kMPersp2]) > kMatrix22Elem) {
@@ -793,88 +730,38 @@ bool SkMatrix::postConcat(const SkMatrix& mat) {
precision may be most important (here and matrix concat). Hence to avoid
bitmap blitting artifacts when walking the inverse, we use doubles for
the intermediate math, even though we know that is more expensive.
- The fixed counter part is us using Sk64 for temp calculations.
*/
-#ifdef SK_SCALAR_IS_FLOAT
- typedef double SkDetScalar;
- #define SkPerspMul(a, b) SkScalarMul(a, b)
- #define SkScalarMulShift(a, b, s) SkDoubleToFloat((a) * (b))
- static double sk_inv_determinant(const float mat[9], int isPerspective,
- int* /* (only used in Fixed case) */) {
- double det;
-
- if (isPerspective) {
- det = mat[SkMatrix::kMScaleX] * ((double)mat[SkMatrix::kMScaleY] * mat[SkMatrix::kMPersp2] - (double)mat[SkMatrix::kMTransY] * mat[SkMatrix::kMPersp1]) +
- mat[SkMatrix::kMSkewX] * ((double)mat[SkMatrix::kMTransY] * mat[SkMatrix::kMPersp0] - (double)mat[SkMatrix::kMSkewY] * mat[SkMatrix::kMPersp2]) +
- mat[SkMatrix::kMTransX] * ((double)mat[SkMatrix::kMSkewY] * mat[SkMatrix::kMPersp1] - (double)mat[SkMatrix::kMScaleY] * mat[SkMatrix::kMPersp0]);
- } else {
- det = (double)mat[SkMatrix::kMScaleX] * mat[SkMatrix::kMScaleY] - (double)mat[SkMatrix::kMSkewX] * mat[SkMatrix::kMSkewY];
- }
-
- // Since the determinant is on the order of the cube of the matrix members,
- // compare to the cube of the default nearly-zero constant (although an
- // estimate of the condition number would be better if it wasn't so expensive).
- if (SkScalarNearlyZero((float)det, SK_ScalarNearlyZero * SK_ScalarNearlyZero * SK_ScalarNearlyZero)) {
- return 0;
- }
- return 1.0 / det;
- }
- // we declar a,b,c,d to all be doubles, because we want to perform
- // double-precision muls and subtract, even though the original values are
- // from the matrix, which are floats.
- static float inline mul_diff_scale(double a, double b, double c, double d,
- double scale) {
- return SkDoubleToFloat((a * b - c * d) * scale);
+typedef double SkDetScalar;
+#define SkPerspMul(a, b) SkScalarMul(a, b)
+#define SkScalarMulShift(a, b, s) SkDoubleToFloat((a) * (b))
+static double sk_inv_determinant(const float mat[9], int isPerspective,
+ int* /* (only used in Fixed case) */) {
+ double det;
+
+ if (isPerspective) {
+ det = mat[SkMatrix::kMScaleX] * ((double)mat[SkMatrix::kMScaleY] * mat[SkMatrix::kMPersp2] - (double)mat[SkMatrix::kMTransY] * mat[SkMatrix::kMPersp1]) +
+ mat[SkMatrix::kMSkewX] * ((double)mat[SkMatrix::kMTransY] * mat[SkMatrix::kMPersp0] - (double)mat[SkMatrix::kMSkewY] * mat[SkMatrix::kMPersp2]) +
+ mat[SkMatrix::kMTransX] * ((double)mat[SkMatrix::kMSkewY] * mat[SkMatrix::kMPersp1] - (double)mat[SkMatrix::kMScaleY] * mat[SkMatrix::kMPersp0]);
+ } else {
+ det = (double)mat[SkMatrix::kMScaleX] * mat[SkMatrix::kMScaleY] - (double)mat[SkMatrix::kMSkewX] * mat[SkMatrix::kMSkewY];
}
-#else
- typedef SkFixed SkDetScalar;
- #define SkPerspMul(a, b) SkFractMul(a, b)
- #define SkScalarMulShift(a, b, s) SkMulShift(a, b, s)
- static void set_muladdmul(Sk64* dst, int32_t a, int32_t b, int32_t c,
- int32_t d) {
- Sk64 tmp;
- dst->setMul(a, b);
- tmp.setMul(c, d);
- dst->add(tmp);
- }
-
- static SkFixed sk_inv_determinant(const SkFixed mat[9], int isPerspective,
- int* shift) {
- Sk64 tmp1, tmp2;
-
- if (isPerspective) {
- tmp1.setMul(mat[SkMatrix::kMScaleX], fracmuladdmul(mat[SkMatrix::kMScaleY], mat[SkMatrix::kMPersp2], -mat[SkMatrix::kMTransY], mat[SkMatrix::kMPersp1]));
- tmp2.setMul(mat[SkMatrix::kMSkewX], fracmuladdmul(mat[SkMatrix::kMTransY], mat[SkMatrix::kMPersp0], -mat[SkMatrix::kMSkewY], mat[SkMatrix::kMPersp2]));
- tmp1.add(tmp2);
- tmp2.setMul(mat[SkMatrix::kMTransX], fracmuladdmul(mat[SkMatrix::kMSkewY], mat[SkMatrix::kMPersp1], -mat[SkMatrix::kMScaleY], mat[SkMatrix::kMPersp0]));
- tmp1.add(tmp2);
- } else {
- tmp1.setMul(mat[SkMatrix::kMScaleX], mat[SkMatrix::kMScaleY]);
- tmp2.setMul(mat[SkMatrix::kMSkewX], mat[SkMatrix::kMSkewY]);
- tmp1.sub(tmp2);
- }
-
- int s = tmp1.getClzAbs();
- *shift = s;
-
- SkFixed denom;
- if (s <= 32) {
- denom = tmp1.getShiftRight(33 - s);
- } else {
- denom = (int32_t)tmp1.fLo << (s - 33);
- }
- if (denom == 0) {
- return 0;
- }
- /** This could perhaps be a special fractdiv function, since both of its
- arguments are known to have bit 31 clear and bit 30 set (when they
- are made positive), thus eliminating the need for calling clz()
- */
- return SkFractDiv(SK_Fract1, denom);
+ // Since the determinant is on the order of the cube of the matrix members,
+ // compare to the cube of the default nearly-zero constant (although an
+ // estimate of the condition number would be better if it wasn't so expensive).
+ if (SkScalarNearlyZero((float)det, SK_ScalarNearlyZero * SK_ScalarNearlyZero * SK_ScalarNearlyZero)) {
+ return 0;
}
-#endif
+ return 1.0 / det;
+}
+// we declar a,b,c,d to all be doubles, because we want to perform
+// double-precision muls and subtract, even though the original values are
+// from the matrix, which are floats.
+static float inline mul_diff_scale(double a, double b, double c, double d,
+ double scale) {
+ return SkDoubleToFloat((a * b - c * d) * scale);
+}
void SkMatrix::SetAffineIdentity(SkScalar affine[6]) {
affine[kAScaleX] = SK_Scalar1;
@@ -1955,14 +1842,8 @@ void SkMatrix::dump() const {
void SkMatrix::toString(SkString* str) const {
str->appendf("[%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f][%8.4f %8.4f %8.4f]",
-#ifdef SK_SCALAR_IS_FLOAT
fMat[0], fMat[1], fMat[2], fMat[3], fMat[4], fMat[5],
fMat[6], fMat[7], fMat[8]);
-#else
- SkFixedToFloat(fMat[0]), SkFixedToFloat(fMat[1]), SkFixedToFloat(fMat[2]),
- SkFixedToFloat(fMat[3]), SkFixedToFloat(fMat[4]), SkFixedToFloat(fMat[5]),
- SkFractToFloat(fMat[6]), SkFractToFloat(fMat[7]), SkFractToFloat(fMat[8]));
-#endif
}
#endif
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 91a76e151f..94ffa8d31b 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1010,16 +1010,9 @@ static void set_bounds(const SkGlyph& g, SkRect* bounds) {
// we don't overflow along the way
typedef int64_t Sk48Dot16;
-#ifdef SK_SCALAR_IS_FLOAT
- static inline float Sk48Dot16ToScalar(Sk48Dot16 x) {
- return (float) (x * 1.5258789e-5); // x * (1 / 65536.0f)
- }
-#else
- static inline SkFixed Sk48Dot16ToScalar(Sk48Dot16 x) {
- // just return the low 32bits
- return static_cast<SkFixed>(x);
- }
-#endif
+static inline float Sk48Dot16ToScalar(Sk48Dot16 x) {
+ return (float) (x * 1.5258789e-5); // x * (1 / 65536.0f)
+}
static void join_bounds_x(const SkGlyph& g, SkRect* bounds, Sk48Dot16 dx) {
SkScalar sx = Sk48Dot16ToScalar(dx);
@@ -1556,13 +1549,8 @@ static bool tooBigForLCD(const SkScalerContext::Rec& rec) {
* typically returns the same looking resuts for tiny changes in the matrix.
*/
static SkScalar sk_relax(SkScalar x) {
-#ifdef SK_SCALAR_IS_FLOAT
int n = sk_float_round2int(x * 1024);
return n / 1024.0f;
-#else
- // round to the nearest 10 fractional bits
- return (x + (1 << 5)) & ~(1024 - 1);
-#endif
}
void SkScalerContext::MakeRec(const SkPaint& paint,
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index c519f93dce..48f7571c07 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -23,12 +23,7 @@ enum {
static inline SkScalar tValue2Scalar(int t) {
SkASSERT((unsigned)t <= kMaxTValue);
-
-#ifdef SK_SCALAR_IS_FLOAT
return t * 3.05185e-5f; // t / 32767
-#else
- return (t + (t >> 14)) << 1;
-#endif
}
SkScalar SkPathMeasure::Segment::getScalarT() const {
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 2b9b9e934c..15eb137525 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -338,9 +338,9 @@ void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const {
info.fWidth = fWidth;
info.fHeight = fHeight;
info.fFlags = SkPictInfo::kCrossProcess_Flag;
-#ifdef SK_SCALAR_IS_FLOAT
+ // TODO: remove this flag, since we're always float (now)
info.fFlags |= SkPictInfo::kScalarIsFloat_Flag;
-#endif
+
if (8 == sizeof(void*)) {
info.fFlags |= SkPictInfo::kPtrIs64Bit_Flag;
}
diff --git a/src/core/SkRect.cpp b/src/core/SkRect.cpp
index 97de0a6a4a..bb51ede757 100644
--- a/src/core/SkRect.cpp
+++ b/src/core/SkRect.cpp
@@ -55,21 +55,6 @@ void SkRect::toQuad(SkPoint quad[4]) const {
quad[3].set(fLeft, fBottom);
}
-#ifdef SK_SCALAR_IS_FLOAT
- #define SkFLOATCODE(code) code
-#else
- #define SkFLOATCODE(code)
-#endif
-
-// For float compares (at least on x86, by removing the else from the min/max
-// computation, we get MAXSS and MINSS instructions, and no branches.
-// Fixed point has no such opportunity (afaik), so we leave the else in that case
-#ifdef SK_SCALAR_IS_FLOAT
- #define MINMAX_ELSE
-#else
- #define MINMAX_ELSE else
-#endif
-
bool SkRect::setBoundsCheck(const SkPoint pts[], int count) {
SkASSERT((pts && count > 0) || count == 0);
@@ -85,17 +70,22 @@ bool SkRect::setBoundsCheck(const SkPoint pts[], int count) {
// If all of the points are finite, accum should stay 0. If we encounter
// a NaN or infinity, then accum should become NaN.
- SkFLOATCODE(float accum = 0;)
- SkFLOATCODE(accum *= l; accum *= t;)
+ float accum = 0;
+ accum *= l; accum *= t;
for (int i = 1; i < count; i++) {
SkScalar x = pts[i].fX;
SkScalar y = pts[i].fY;
- SkFLOATCODE(accum *= x; accum *= y;)
+ accum *= x; accum *= y;
+
+ // we use if instead of if/else, so we can generate min/max
+ // float instructions (at least on SSE)
+ if (x < l) l = x;
+ if (x > r) r = x;
- if (x < l) l = x; MINMAX_ELSE if (x > r) r = x;
- if (y < t) t = y; MINMAX_ELSE if (y > b) b = y;
+ if (y < t) t = y;
+ if (y > b) b = y;
}
SkASSERT(!accum || !SkScalarIsFinite(accum));
diff --git a/src/core/SkScan.cpp b/src/core/SkScan.cpp
index 44968bd9ec..b21dd6bf9c 100644
--- a/src/core/SkScan.cpp
+++ b/src/core/SkScan.cpp
@@ -53,8 +53,6 @@ void SkScan::FillXRect(const SkXRect& xr, const SkRegion* clip,
SkScan::FillIRect(r, clip, blitter);
}
-#ifdef SK_SCALAR_IS_FLOAT
-
void SkScan::FillRect(const SkRect& r, const SkRegion* clip,
SkBlitter* blitter) {
SkIRect ir;
@@ -63,8 +61,6 @@ void SkScan::FillRect(const SkRect& r, const SkRegion* clip,
SkScan::FillIRect(ir, clip, blitter);
}
-#endif
-
///////////////////////////////////////////////////////////////////////////////
void SkScan::FillIRect(const SkIRect& r, const SkRasterClip& clip,
@@ -97,8 +93,6 @@ void SkScan::FillXRect(const SkXRect& xr, const SkRasterClip& clip,
FillXRect(xr, &wrapper.getRgn(), wrapper.getBlitter());
}
-#ifdef SK_SCALAR_IS_FLOAT
-
void SkScan::FillRect(const SkRect& r, const SkRasterClip& clip,
SkBlitter* blitter) {
if (clip.isEmpty() || r.isEmpty()) {
@@ -113,5 +107,3 @@ void SkScan::FillRect(const SkRect& r, const SkRasterClip& clip,
SkAAClipBlitterWrapper wrapper(clip, blitter);
FillRect(r, &wrapper.getRgn(), wrapper.getBlitter());
}
-
-#endif
diff --git a/src/core/SkScan.h b/src/core/SkScan.h
index 5989435d29..0780e332a3 100644
--- a/src/core/SkScan.h
+++ b/src/core/SkScan.h
@@ -31,19 +31,8 @@ public:
static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*);
static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*);
-#ifdef SK_SCALAR_IS_FIXED
- static void FillRect(const SkRect& rect, const SkRasterClip& clip,
- SkBlitter* blitter) {
- SkScan::FillXRect(*(const SkXRect*)&rect, clip, blitter);
- }
- static void AntiFillRect(const SkRect& rect, const SkRasterClip& clip,
- SkBlitter* blitter) {
- SkScan::AntiFillXRect(*(const SkXRect*)&rect, clip, blitter);
- }
-#else
static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*);
static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*);
-#endif
static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*);
static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*);
static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*);
@@ -67,19 +56,8 @@ private:
static void FillIRect(const SkIRect&, const SkRegion* clip, SkBlitter*);
static void FillXRect(const SkXRect&, const SkRegion* clip, SkBlitter*);
-#ifdef SK_SCALAR_IS_FIXED
- static void FillRect(const SkRect& rect, const SkRegion* clip,
- SkBlitter* blitter) {
- SkScan::FillXRect(*(const SkXRect*)&rect, clip, blitter);
- }
- static void AntiFillRect(const SkRect& rect, const SkRegion* clip,
- SkBlitter* blitter) {
- SkScan::AntiFillXRect(*(const SkXRect*)&rect, clip, blitter);
- }
-#else
static void FillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
static void AntiFillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
-#endif
static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*);
static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*);
static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*,
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 0d2152c7c1..e5c67a958a 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -589,13 +589,8 @@ static int rect_overflows_short_shift(SkIRect rect, int shift) {
}
static bool safeRoundOut(const SkRect& src, SkIRect* dst, int32_t maxInt) {
-#ifdef SK_SCALAR_IS_FIXED
- // the max-int (shifted) is exactly what we want to compare against, to know
- // if we can survive shifting our fixed-point coordinates
- const SkFixed maxScalar = maxInt;
-#else
const SkScalar maxScalar = SkIntToScalar(maxInt);
-#endif
+
if (fitsInsideLimit(src, maxScalar)) {
src.roundOut(dst);
return true;
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp
index a6a0869f22..175f085f91 100644
--- a/src/core/SkScan_Antihair.cpp
+++ b/src/core/SkScan_Antihair.cpp
@@ -602,7 +602,6 @@ void SkScan::AntiHairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
SkPoint pts[2] = { pt0, pt1 };
-#ifdef SK_SCALAR_IS_FLOAT
// We have to pre-clip the line to fit in a SkFixed, so we just chop
// the line. TODO find a way to actually draw beyond that range.
{
@@ -613,7 +612,6 @@ void SkScan::AntiHairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
return;
}
}
-#endif
if (clip) {
SkRect clipBounds;
@@ -828,8 +826,6 @@ void SkScan::AntiFillXRect(const SkXRect& xr, const SkRasterClip& clip,
}
}
-#ifdef SK_SCALAR_IS_FLOAT
-
/* This guy takes a float-rect, but with the key improvement that it has
already been clipped, so we know that it is safe to convert it into a
XRect (fixedpoint), as it won't overflow.
@@ -888,8 +884,6 @@ void SkScan::AntiFillRect(const SkRect& r, const SkRasterClip& clip,
}
}
-#endif // SK_SCALAR_IS_FLOAT
-
///////////////////////////////////////////////////////////////////////////////
#define SkAlphaMulRound(a, b) SkMulDiv255Round(a, b)
@@ -902,11 +896,7 @@ static void fillcheckrect(int L, int T, int R, int B, SkBlitter* blitter) {
}
static inline FDot8 SkScalarToFDot8(SkScalar x) {
-#ifdef SK_SCALAR_IS_FLOAT
return (int)(x * 256);
-#else
- return x >> 8;
-#endif
}
static inline int FDot8Floor(FDot8 x) {
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index f440d32613..3b0f152a4f 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -47,7 +47,6 @@ void SkScan::HairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
SkIRect clipR, ptsR;
SkPoint pts[2] = { pt0, pt1 };
-#ifdef SK_SCALAR_IS_FLOAT
// We have to pre-clip the line to fit in a SkFixed, so we just chop
// the line. TODO find a way to actually draw beyond that range.
{
@@ -58,7 +57,6 @@ void SkScan::HairLineRgn(const SkPoint& pt0, const SkPoint& pt1,
return;
}
}
-#endif
if (clip) {
// Perform a clip in scalar space, so we catch huge values which might
diff --git a/src/core/SkStrokerPriv.cpp b/src/core/SkStrokerPriv.cpp
index 269ebd3dbd..ad9c0c4d6f 100644
--- a/src/core/SkStrokerPriv.cpp
+++ b/src/core/SkStrokerPriv.cpp
@@ -153,11 +153,7 @@ static void RoundJoiner(SkPath* outer, SkPath* inner, const SkVector& beforeUnit
}
}
-#ifdef SK_SCALAR_IS_FLOAT
- #define kOneOverSqrt2 (0.707106781f)
-#else
- #define kOneOverSqrt2 (46341)
-#endif
+#define kOneOverSqrt2 (0.707106781f)
static void MiterJoiner(SkPath* outer, SkPath* inner, const SkVector& beforeUnitNormal,
const SkPoint& pivot, const SkVector& afterUnitNormal,