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

Side by Side Diff: trunk/src/core/SkStroke.cpp

Issue 12567006: fix handling of stroked cubics when we exhaust our recursion limit. (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/gm/cubicpaths.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkStrokerPriv.h" 8 #include "SkStrokerPriv.h"
9 #include "SkGeometry.h" 9 #include "SkGeometry.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 if (degenerateCD) { 296 if (degenerateCD) {
297 cd = pts[3] - pts[1]; 297 cd = pts[3] - pts[1];
298 degenerateCD = degenerate_vector(cd); 298 degenerateCD = degenerate_vector(cd);
299 } 299 }
300 if (degenerateAB || degenerateCD) { 300 if (degenerateAB || degenerateCD) {
301 goto DRAW_LINE; 301 goto DRAW_LINE;
302 } 302 }
303 SkAssertResult(set_normal_unitnormal(cd, fRadius, normalCD, unitNormalCD)); 303 SkAssertResult(set_normal_unitnormal(cd, fRadius, normalCD, unitNormalCD));
304 bool degenerateBC = !set_normal_unitnormal(pts[1], pts[2], fRadius, 304 bool degenerateBC = !set_normal_unitnormal(pts[1], pts[2], fRadius,
305 &normalBC, &unitNormalBC); 305 &normalBC, &unitNormalBC);
306 306 #ifndef SK_IGNORE_CUBIC_STROKE_FIX
307 if (subDivide <= 0) {
308 if (degenerateBC) {
309 goto DRAW_LINE;
310 } else {
311 goto DRAW_CUBIC;
312 }
313 }
314 #endif
307 if (degenerateBC || normals_too_curvy(unitNormalAB, unitNormalBC) || 315 if (degenerateBC || normals_too_curvy(unitNormalAB, unitNormalBC) ||
308 normals_too_curvy(unitNormalBC, *unitNormalCD)) { 316 normals_too_curvy(unitNormalBC, *unitNormalCD)) {
317 #ifdef SK_IGNORE_CUBIC_STROKE_FIX
309 // subdivide if we can 318 // subdivide if we can
310 if (--subDivide < 0) { 319 if (--subDivide < 0) {
311 goto DRAW_LINE; 320 goto DRAW_LINE;
312 } 321 }
322 #endif
313 SkPoint tmp[7]; 323 SkPoint tmp[7];
314 SkVector norm, unit, dummy, unitDummy; 324 SkVector norm, unit, dummy, unitDummy;
315 325
316 SkChopCubicAtHalf(pts, tmp); 326 SkChopCubicAtHalf(pts, tmp);
317 this->cubic_to(&tmp[0], normalAB, unitNormalAB, &norm, &unit, 327 this->cubic_to(&tmp[0], normalAB, unitNormalAB, &norm, &unit,
318 subDivide); 328 subDivide);
319 // we use dummys since we already have a valid (and more accurate) 329 // we use dummys since we already have a valid (and more accurate)
320 // normals for CD 330 // normals for CD
321 this->cubic_to(&tmp[3], norm, unit, &dummy, &unitDummy, subDivide); 331 this->cubic_to(&tmp[3], norm, unit, &dummy, &unitDummy, subDivide);
322 } else { 332 } else {
333 #ifndef SK_IGNORE_CUBIC_STROKE_FIX
334 DRAW_CUBIC:
335 #endif
323 SkVector normalB, normalC; 336 SkVector normalB, normalC;
324 337
325 // need normals to inset/outset the off-curve pts B and C 338 // need normals to inset/outset the off-curve pts B and C
326 339
327 SkVector unitBC = pts[2] - pts[1]; 340 SkVector unitBC = pts[2] - pts[1];
328 unitBC.normalize(); 341 unitBC.normalize();
329 unitBC.rotateCCW(); 342 unitBC.rotateCCW();
330 343
331 normalB = unitNormalAB + unitBC; 344 normalB = unitNormalAB + unitBC;
332 normalC = *unitNormalCD + unitBC; 345 normalC = *unitNormalCD + unitBC;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 default: 764 default:
752 break; 765 break;
753 } 766 }
754 767
755 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { 768 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) {
756 r = rect; 769 r = rect;
757 r.inset(radius, radius); 770 r.inset(radius, radius);
758 dst->addRect(r, reverse_direction(dir)); 771 dst->addRect(r, reverse_direction(dir));
759 } 772 }
760 } 773 }
OLDNEW
« no previous file with comments | « trunk/gm/cubicpaths.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698