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

Unified Diff: src/core/SkPath.cpp

Issue 2006143009: Initialize the result in failure conditions of ChopMonoAtY. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Check return values at call-sites rather than ensuring initialization Created 4 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/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index fbda7e8772f6770ee71de6748869f1e049d21a18..73f458f3148722fc239a802cabeaff2e8e757e99 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -2800,7 +2800,9 @@ static int winding_mono_cubic(const SkPoint pts[], SkScalar x, SkScalar y, int*
// compute the actual x(t) value
SkScalar t;
- SkAssertResult(SkCubicClipper::ChopMonoAtY(pts, y, &t));
+ if (!SkCubicClipper::ChopMonoAtY(pts, y, &t)) {
+ return 0;
+ }
SkScalar xt = eval_cubic_pts(pts[0].fX, pts[1].fX, pts[2].fX, pts[3].fX, t);
if (SkScalarNearlyEqual(xt, x)) {
if (x != pts[3].fX || y != pts[3].fY) { // don't test end points; they're start points
@@ -3037,7 +3039,9 @@ static void tangent_cubic(const SkPoint pts[], SkScalar x, SkScalar y,
for (int i = 0; i <= n; ++i) {
SkPoint* c = &dst[i * 3];
SkScalar t;
- SkAssertResult(SkCubicClipper::ChopMonoAtY(c, y, &t));
+ if (!SkCubicClipper::ChopMonoAtY(c, y, &t)) {
+ continue;
+ }
SkScalar xt = eval_cubic_pts(c[0].fX, c[1].fX, c[2].fX, c[3].fX, t);
if (!SkScalarNearlyEqual(x, xt)) {
continue;
« 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