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

Side by Side Diff: tests/PathTest.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
« src/core/SkEdgeClipper.cpp ('K') | « src/core/SkEdgeClipper.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "Test.h" 8 #include "Test.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 13 matching lines...) Expand all
24 #define SUPPRESS_VISIBILITY_WARNING __attribute__((visibility("hidden"))) 24 #define SUPPRESS_VISIBILITY_WARNING __attribute__((visibility("hidden")))
25 #endif 25 #endif
26 26
27 static SkSurface* new_surface(int w, int h) { 27 static SkSurface* new_surface(int w, int h) {
28 SkImage::Info info = { 28 SkImage::Info info = {
29 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType 29 w, h, SkImage::kPMColor_ColorType, SkImage::kPremul_AlphaType
30 }; 30 };
31 return SkSurface::NewRaster(info); 31 return SkSurface::NewRaster(info);
32 } 32 }
33 33
34 // This used to assert in the debug build, as the edges did not all line-up.
35 static void test_bad_cubic_crbug234190() {
36 SkPath path;
37 path.moveTo(13.8509f, 3.16858f);
38 path.cubicTo(-2.35893e+08f, -4.21044e+08f,
39 -2.38991e+08f, -4.26573e+08f,
40 -2.41016e+08f, -4.30188e+08f);
41
42 SkPaint paint;
43 paint.setAntiAlias(true);
44 SkAutoTUnref<SkSurface> surface(new_surface(84, 88));
45 surface->getCanvas()->drawPath(path, paint);
46 }
47
34 static void test_bad_cubic_crbug229478() { 48 static void test_bad_cubic_crbug229478() {
35 const SkPoint pts[] = { 49 const SkPoint pts[] = {
36 { 4595.91064f, -11596.9873f }, 50 { 4595.91064f, -11596.9873f },
37 { 4597.2168f, -11595.9414f }, 51 { 4597.2168f, -11595.9414f },
38 { 4598.52344f, -11594.8955f }, 52 { 4598.52344f, -11594.8955f },
39 { 4599.83008f, -11593.8496f }, 53 { 4599.83008f, -11593.8496f },
40 }; 54 };
41 55
42 SkPath path; 56 SkPath path;
43 path.moveTo(pts[0]); 57 path.moveTo(pts[0]);
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2370 test_addPoly(reporter); 2384 test_addPoly(reporter);
2371 test_isfinite(reporter); 2385 test_isfinite(reporter);
2372 test_isfinite_after_transform(reporter); 2386 test_isfinite_after_transform(reporter);
2373 test_arb_round_rect_is_convex(reporter); 2387 test_arb_round_rect_is_convex(reporter);
2374 test_arb_zero_rad_round_rect_is_rect(reporter); 2388 test_arb_zero_rad_round_rect_is_rect(reporter);
2375 test_addrect_isfinite(reporter); 2389 test_addrect_isfinite(reporter);
2376 test_tricky_cubic(); 2390 test_tricky_cubic();
2377 test_clipped_cubic(); 2391 test_clipped_cubic();
2378 test_crbug_170666(); 2392 test_crbug_170666();
2379 test_bad_cubic_crbug229478(); 2393 test_bad_cubic_crbug229478();
2394 test_bad_cubic_crbug234190();
2380 } 2395 }
2381 2396
2382 #include "TestClassDef.h" 2397 #include "TestClassDef.h"
2383 DEFINE_TESTCLASS("Path", PathTestClass, TestPath) 2398 DEFINE_TESTCLASS("Path", PathTestClass, TestPath)
OLDNEW
« src/core/SkEdgeClipper.cpp ('K') | « src/core/SkEdgeClipper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698