| OLD | NEW |
| 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 Loading... |
| 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 4125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4308 } | 4336 } |
| 4309 | 4337 |
| 4310 DEF_TEST(Paths, reporter) { | 4338 DEF_TEST(Paths, reporter) { |
| 4311 test_fuzz_crbug_647922(); | 4339 test_fuzz_crbug_647922(); |
| 4312 test_fuzz_crbug_643933(); | 4340 test_fuzz_crbug_643933(); |
| 4313 test_sect_with_horizontal_needs_pinning(); | 4341 test_sect_with_horizontal_needs_pinning(); |
| 4314 test_crbug_629455(reporter); | 4342 test_crbug_629455(reporter); |
| 4315 test_fuzz_crbug_627414(reporter); | 4343 test_fuzz_crbug_627414(reporter); |
| 4316 test_path_crbug364224(); | 4344 test_path_crbug364224(); |
| 4317 test_fuzz_crbug_662952(reporter); | 4345 test_fuzz_crbug_662952(reporter); |
| 4346 test_fuzz_crbug_662780(); |
| 4318 | 4347 |
| 4319 SkTSize<SkScalar>::Make(3,4); | 4348 SkTSize<SkScalar>::Make(3,4); |
| 4320 | 4349 |
| 4321 SkPath p, empty; | 4350 SkPath p, empty; |
| 4322 SkRect bounds, bounds2; | 4351 SkRect bounds, bounds2; |
| 4323 test_empty(reporter, p); | 4352 test_empty(reporter, p); |
| 4324 | 4353 |
| 4325 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); | 4354 REPORTER_ASSERT(reporter, p.getBounds().isEmpty()); |
| 4326 | 4355 |
| 4327 // this triggers a code path in SkPath::operator= which is otherwise unexerc
ised | 4356 // 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 Loading... |
| 4463 PathRefTest_Private::TestPathRef(reporter); | 4492 PathRefTest_Private::TestPathRef(reporter); |
| 4464 PathTest_Private::TestPathrefListeners(reporter); | 4493 PathTest_Private::TestPathrefListeners(reporter); |
| 4465 test_dump(reporter); | 4494 test_dump(reporter); |
| 4466 test_path_crbug389050(reporter); | 4495 test_path_crbug389050(reporter); |
| 4467 test_path_crbugskia2820(reporter); | 4496 test_path_crbugskia2820(reporter); |
| 4468 test_skbug_3469(reporter); | 4497 test_skbug_3469(reporter); |
| 4469 test_skbug_3239(reporter); | 4498 test_skbug_3239(reporter); |
| 4470 test_bounds_crbug_513799(reporter); | 4499 test_bounds_crbug_513799(reporter); |
| 4471 test_fuzz_crbug_638223(); | 4500 test_fuzz_crbug_638223(); |
| 4472 } | 4501 } |
| OLD | NEW |