| 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 "SkAAClip.h" | 8 #include "SkAAClip.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkMask.h" | 10 #include "SkMask.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 SkAAClip clip; | 414 SkAAClip clip; |
| 415 SkRect r; | 415 SkRect r; |
| 416 r.fLeft = 129.892181f; | 416 r.fLeft = 129.892181f; |
| 417 r.fTop = 10.3999996f; | 417 r.fTop = 10.3999996f; |
| 418 r.fRight = 130.892181f; | 418 r.fRight = 130.892181f; |
| 419 r.fBottom = 20.3999996f; | 419 r.fBottom = 20.3999996f; |
| 420 clip.setRect(r, true); | 420 clip.setRect(r, true); |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| 424 // Building aaclip meant aa-scan-convert a path into a huge clip. |
| 425 // the old algorithm sized the supersampler to the size of the clip, which overf
lowed |
| 426 // its internal 16bit coordinates. The fix was to intersect the clip+path_bounds
before |
| 427 // sizing the supersampler. |
| 428 // |
| 429 // Before the fix, the following code would assert in debug builds. |
| 430 // |
| 431 static void test_crbug_422693(skiatest::Reporter* reporter) { |
| 432 #if 0 |
| 433 SkRasterClip rc(SkIRect::MakeLTRB(-25000, -25000, 25000, 25000)); |
| 434 SkPath path; |
| 435 path.addCircle(50, 50, 50); |
| 436 rc.op(path, rc.getBounds().size(), SkRegion::kIntersect_Op, true); |
| 437 #endif |
| 438 } |
| 439 |
| 424 DEF_TEST(AAClip, reporter) { | 440 DEF_TEST(AAClip, reporter) { |
| 425 test_empty(reporter); | 441 test_empty(reporter); |
| 426 test_path_bounds(reporter); | 442 test_path_bounds(reporter); |
| 427 test_irect(reporter); | 443 test_irect(reporter); |
| 428 test_rgn(reporter); | 444 test_rgn(reporter); |
| 429 test_path_with_hole(reporter); | 445 test_path_with_hole(reporter); |
| 430 test_regressions(); | 446 test_regressions(); |
| 431 test_nearly_integral(reporter); | 447 test_nearly_integral(reporter); |
| 432 test_really_a_rect(reporter); | 448 test_really_a_rect(reporter); |
| 449 test_crbug_422693(reporter); |
| 433 } | 450 } |
| OLD | NEW |