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

Side by Side Diff: tests/PathTest.cpp

Issue 2482193004: Tighten SkAAClip Bounds by Path Bounds (Closed)
Patch Set: Fix 100 line limit Created 4 years, 1 month 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
« no previous file with comments | « src/core/SkScan_AAAPath.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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 <cmath> 8 #include <cmath>
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGeometry.h" 10 #include "SkGeometry.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 SkPaint paint; 163 SkPaint paint;
164 paint.setAntiAlias(true); 164 paint.setAntiAlias(true);
165 SkPath path; 165 SkPath path;
166 path.moveTo(0, 0); 166 path.moveTo(0, 0);
167 path.conicTo(SkBits2Float(0x00003939), SkBits2Float(0x42487fff), // 2.05276 e-41f, 50.125f 167 path.conicTo(SkBits2Float(0x00003939), SkBits2Float(0x42487fff), // 2.05276 e-41f, 50.125f
168 SkBits2Float(0x48082361), SkBits2Float(0x4408e8e9), // 139406, 547. 639f 168 SkBits2Float(0x48082361), SkBits2Float(0x4408e8e9), // 139406, 547. 639f
169 SkBits2Float(0x4d1ade0f)); // 1.6239e+08f 169 SkBits2Float(0x4d1ade0f)); // 1.6239e+08f
170 canvas->drawPath(path, paint); 170 canvas->drawPath(path, paint);
171 } 171 }
172 172
173 static void test_fuzz_crbug_662780() {
174 auto surface(SkSurface::MakeRasterN32Premul(250, 250));
175 SkCanvas* canvas = surface->getCanvas();
176 SkPaint paint;
177 paint.setAntiAlias(true);
178 SkPath path;
179 path.moveTo(SkBits2Float(0x41000000), SkBits2Float(0x431e0000)); // 8, 158
180 path.lineTo(SkBits2Float(0x41000000), SkBits2Float(0x42f00000)); // 8, 120
181 // 8, 8, 8.00002f, 8, 0.707107f
182 path.conicTo(SkBits2Float(0x41000000), SkBits2Float(0x41000000),
183 SkBits2Float(0x41000010), SkBits2Float(0x41000000), SkBits2Float(0x3 f3504f3));
184 path.lineTo(SkBits2Float(0x439a0000), SkBits2Float(0x41000000)); // 308, 8
185 // 308, 8, 308, 8, 0.707107f
186 path.conicTo(SkBits2Float(0x439a0000), SkBits2Float(0x41000000),
187 SkBits2Float(0x439a0000), SkBits2Float(0x41000000), SkBits2Float(0x3 f3504f3));
188 path.lineTo(SkBits2Float(0x439a0000), SkBits2Float(0x431e0000)); // 308, 15 8
189 // 308, 158, 308, 158, 0.707107f
190 path.conicTo(SkBits2Float(0x439a0000), SkBits2Float(0x431e0000),
191 SkBits2Float(0x439a0000), SkBits2Float(0x431e0000), SkBits2Float(0x3 f3504f3));
192 path.lineTo(SkBits2Float(0x41000000), SkBits2Float(0x431e0000)); // 8, 158
193 // 8, 158, 8, 158, 0.707107f
194 path.conicTo(SkBits2Float(0x41000000), SkBits2Float(0x431e0000),
195 SkBits2Float(0x41000000), SkBits2Float(0x431e0000), SkBits2Float(0x3 f3504f3));
196 path.close();
197 canvas->clipPath(path, true);
198 canvas->drawRectCoords(0, 0, 250, 250, paint);
199 }
200
173 /** 201 /**
174 * In debug mode, this path was causing an assertion to fail in 202 * In debug mode, this path was causing an assertion to fail in
175 * SkPathStroker::preJoinTo() and, in Release, the use of an unitialized value. 203 * SkPathStroker::preJoinTo() and, in Release, the use of an unitialized value.
176 */ 204 */
177 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) { 205 static void make_path_crbugskia2820(SkPath* path, skiatest::Reporter* reporter) {
178 SkPoint orig, p1, p2, p3; 206 SkPoint orig, p1, p2, p3;
179 orig = SkPoint::Make(1.f, 1.f); 207 orig = SkPoint::Make(1.f, 1.f);
180 p1 = SkPoint::Make(1.f - SK_ScalarNearlyZero, 1.f); 208 p1 = SkPoint::Make(1.f - SK_ScalarNearlyZero, 1.f);
181 p2 = SkPoint::Make(1.f, 1.f + SK_ScalarNearlyZero); 209 p2 = SkPoint::Make(1.f, 1.f + SK_ScalarNearlyZero);
182 p3 = SkPoint::Make(2.f, 2.f); 210 p3 = SkPoint::Make(2.f, 2.f);
(...skipping 4140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4323 4351
4324 DEF_TEST(Paths, reporter) { 4352 DEF_TEST(Paths, reporter) {
4325 test_fuzz_crbug_647922(); 4353 test_fuzz_crbug_647922();
4326 test_fuzz_crbug_643933(); 4354 test_fuzz_crbug_643933();
4327 test_sect_with_horizontal_needs_pinning(); 4355 test_sect_with_horizontal_needs_pinning();
4328 test_crbug_629455(reporter); 4356 test_crbug_629455(reporter);
4329 test_fuzz_crbug_627414(reporter); 4357 test_fuzz_crbug_627414(reporter);
4330 test_path_crbug364224(); 4358 test_path_crbug364224();
4331 test_fuzz_crbug_662952(reporter); 4359 test_fuzz_crbug_662952(reporter);
4332 test_fuzz_crbug_662730(reporter); 4360 test_fuzz_crbug_662730(reporter);
4361 test_fuzz_crbug_662780();
4333 4362
4334 SkTSize<SkScalar>::Make(3,4); 4363 SkTSize<SkScalar>::Make(3,4);
4335 4364
4336 SkPath p, empty; 4365 SkPath p, empty;
4337 SkRect bounds, bounds2; 4366 SkRect bounds, bounds2;
4338 test_empty(reporter, p); 4367 test_empty(reporter, p);
4339 4368
4340 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); 4369 REPORTER_ASSERT(reporter, p.getBounds().isEmpty());
4341 4370
4342 // this triggers a code path in SkPath::operator= which is otherwise unexerc ised 4371 // this triggers a code path in SkPath::operator= which is otherwise unexerc ised
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4478 PathRefTest_Private::TestPathRef(reporter); 4507 PathRefTest_Private::TestPathRef(reporter);
4479 PathTest_Private::TestPathrefListeners(reporter); 4508 PathTest_Private::TestPathrefListeners(reporter);
4480 test_dump(reporter); 4509 test_dump(reporter);
4481 test_path_crbug389050(reporter); 4510 test_path_crbug389050(reporter);
4482 test_path_crbugskia2820(reporter); 4511 test_path_crbugskia2820(reporter);
4483 test_skbug_3469(reporter); 4512 test_skbug_3469(reporter);
4484 test_skbug_3239(reporter); 4513 test_skbug_3239(reporter);
4485 test_bounds_crbug_513799(reporter); 4514 test_bounds_crbug_513799(reporter);
4486 test_fuzz_crbug_638223(); 4515 test_fuzz_crbug_638223();
4487 } 4516 }
OLDNEW
« no previous file with comments | « src/core/SkScan_AAAPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698