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

Unified Diff: src/core/SkStroke.cpp

Issue 1160163002: use inline version of eval quad if tangent is not needed (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more toy stroke changes Created 5 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkStroke.cpp
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index a05bfd448fdfdd89a6af314f576060658488ed11..b5725225294c083321be47f35c8081e40a9afb8e 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -676,6 +676,7 @@ void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) {
// compute the perpendicular point and its tangent.
void SkPathStroker::setRayPts(const SkPoint& tPt, SkVector* dxy, SkPoint* onPt,
SkPoint* tangent) const {
+#if 01
SkPoint oldDxy = *dxy;
if (!dxy->setLength(fRadius)) { // consider moving double logic into SkPoint::setLength
double xx = oldDxy.fX;
@@ -684,6 +685,11 @@ void SkPathStroker::setRayPts(const SkPoint& tPt, SkVector* dxy, SkPoint* onPt,
dxy->fX = SkDoubleToScalar(xx * dscale);
dxy->fY = SkDoubleToScalar(yy * dscale);
}
+#else
+ SkScalar scale = fRadius * sk_float_rsqrt(dxy->fX * dxy->fX + dxy->fY * dxy->fY);
+ dxy->fX *= scale;
+ dxy->fY *= scale;
+#endif
SkScalar axisFlip = SkIntToScalar(fStrokeType); // go opposite ways for outer, inner
onPt->fX = tPt.fX + axisFlip * dxy->fY;
onPt->fY = tPt.fY - axisFlip * dxy->fX;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698