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 455043002: use conics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments Created 6 years 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 | « src/core/SkGeometry.h ('k') | src/core/SkPath.cpp » ('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 71e22ab10472b0a8460fba951d85d0933197cc51..ac02afc6334644487cc55cb88aa0c6757203e7ab 100644
--- a/src/core/SkGeometry.cpp
+++ b/src/core/SkGeometry.cpp
@@ -1535,3 +1535,23 @@ bool SkConic::findMaxCurvature(SkScalar* t) const {
// TODO: Implement me
return false;
}
+
+SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w,
+ const SkMatrix& matrix) {
+ if (!matrix.hasPerspective()) {
+ return w;
+ }
+
+ SkP3D src[3], dst[3];
+
+ ratquad_mapTo3D(pts, w, src);
+
+ matrix.mapHomogeneousPoints(&dst[0].fX, &src[0].fX, 3);
+
+ // w' = sqrt(w1*w1/w0*w2)
+ SkScalar w0 = dst[0].fZ;
+ SkScalar w1 = dst[1].fZ;
+ SkScalar w2 = dst[2].fZ;
+ w = SkScalarSqrt((w1 * w1) / (w0 * w2));
+ return w;
+}
« no previous file with comments | « src/core/SkGeometry.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698