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

Side by Side Diff: src/core/SkEdgeClipper.cpp

Issue 14607012: need to clamp all of the cubic points after a chop, in case our finite precision (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2009 The Android Open Source Project 3 * Copyright 2009 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkEdgeClipper.h" 10 #include "SkEdgeClipper.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 SkScalar t; 281 SkScalar t;
282 if (chopMonoCubicAtY(pts, clip.fTop, &t)) { 282 if (chopMonoCubicAtY(pts, clip.fTop, &t)) {
283 SkPoint tmp[7]; 283 SkPoint tmp[7];
284 SkChopCubicAt(pts, tmp, t); 284 SkChopCubicAt(pts, tmp, t);
285 285
286 // tmp[3, 4].fY should all be to the below clip.fTop, and 286 // tmp[3, 4].fY should all be to the below clip.fTop, and
287 // still be monotonic in Y. Since we can't trust the numerics of 287 // still be monotonic in Y. Since we can't trust the numerics of
288 // the chopper, we force those conditions now 288 // the chopper, we force those conditions now
289 tmp[3].fY = clip.fTop; 289 tmp[3].fY = clip.fTop;
290 clamp_ge(tmp[4].fY, clip.fTop); 290 clamp_ge(tmp[4].fY, clip.fTop);
291 clamp_ge(tmp[5].fY, tmp[4].fY);
caryclark 2013/05/08 21:07:35 update the comment above?
reed1 2013/05/08 21:08:03 Done.
291 292
292 pts[0] = tmp[3]; 293 pts[0] = tmp[3];
293 pts[1] = tmp[4]; 294 pts[1] = tmp[4];
294 pts[2] = tmp[5]; 295 pts[2] = tmp[5];
295 } else { 296 } else {
296 // if chopMonoCubicAtY failed, then we may have hit inexact numerics 297 // if chopMonoCubicAtY failed, then we may have hit inexact numerics
297 // so we just clamp against the top 298 // so we just clamp against the top
298 for (int i = 0; i < 4; i++) { 299 for (int i = 0; i < 4; i++) {
299 clamp_ge(pts[i].fY, clip.fTop); 300 clamp_ge(pts[i].fY, clip.fTop);
300 } 301 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 assert_monotonic(&pts[0].fY, count); 525 assert_monotonic(&pts[0].fY, count);
525 } 526 }
526 } 527 }
527 528
528 void sk_assert_monotonic_x(const SkPoint pts[], int count) { 529 void sk_assert_monotonic_x(const SkPoint pts[], int count) {
529 if (count > 1) { 530 if (count > 1) {
530 assert_monotonic(&pts[0].fX, count); 531 assert_monotonic(&pts[0].fX, count);
531 } 532 }
532 } 533 }
533 #endif 534 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698