Add implicit hairline conic rendering to GPU
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/18258005
git-svn-id: http://skia.googlecode.com/svn/trunk/src@10055 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkGeometry.cpp b/core/SkGeometry.cpp
index cd6aa2e..5e77dd3 100644
--- a/core/SkGeometry.cpp
+++ b/core/SkGeometry.cpp
@@ -394,8 +394,7 @@
//
// t = - (Ax Bx + Ay By) / (Bx ^ 2 + By ^ 2)
//
-int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5])
-{
+float SkFindQuadMaxCurvature(const SkPoint src[3]) {
SkScalar Ax = src[1].fX - src[0].fX;
SkScalar Ay = src[1].fY - src[0].fY;
SkScalar Bx = src[0].fX - src[1].fX - src[1].fX + src[2].fX;
@@ -427,14 +426,16 @@
}
}
#endif
+ return t;
+}
- if (t == 0)
- {
+int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5])
+{
+ SkScalar t = SkFindQuadMaxCurvature(src);
+ if (t == 0) {
memcpy(dst, src, 3 * sizeof(SkPoint));
return 1;
- }
- else
- {
+ } else {
SkChopQuadAt(src, dst, t);
return 2;
}
@@ -1061,8 +1062,7 @@
int count = SkFindCubicMaxCurvature(src, tValues);
- if (dst)
- {
+ if (dst) {
if (count == 0)
memcpy(dst, src, 4 * sizeof(SkPoint));
else
@@ -1185,7 +1185,6 @@
}
return num_crossings;
}
-
////////////////////////////////////////////////////////////////////////////////
/* Find t value for quadratic [a, b, c] = d.