Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/core/SkGeometry.cpp

Issue 18258005: Add implicit hairline conic rendering to GPU (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkGeometry.h ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGeometry.cpp
diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp
index a12f961948c77b6695ce2e250fa66d94e3eef96c..633cc9eff000c125cb63f52467fa3885dab81825 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -394,8 +394,7 @@ int SkChopQuadAtXExtrema(const SkPoint src[3], SkPoint dst[5])
//
// 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 @@ int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5])
}
}
#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 SkChopCubicAtMaxCurvature(const SkPoint src[4], SkPoint dst[13], SkScalar tV
int count = SkFindCubicMaxCurvature(src, tValues);
- if (dst)
- {
+ if (dst) {
if (count == 0)
memcpy(dst, src, 4 * sizeof(SkPoint));
else
@@ -1185,7 +1185,6 @@ int SkNumXRayCrossingsForCubic(const SkXRay& pt, const SkPoint cubic[4], bool* a
}
return num_crossings;
}
-
////////////////////////////////////////////////////////////////////////////////
/* Find t value for quadratic [a, b, c] = d.
« no previous file with comments | « include/core/SkGeometry.h ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698