OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 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 "SkScanPriv.h" | 10 #include "SkScanPriv.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 { | 447 { |
448 SkASSERT(CanHandleRect(ir)); | 448 SkASSERT(CanHandleRect(ir)); |
449 SkASSERT(!isInverse); | 449 SkASSERT(!isInverse); |
450 | 450 |
451 fMask.fImage = (uint8_t*)fStorage; | 451 fMask.fImage = (uint8_t*)fStorage; |
452 fMask.fBounds = ir; | 452 fMask.fBounds = ir; |
453 fMask.fRowBytes = ir.width(); | 453 fMask.fRowBytes = ir.width(); |
454 fMask.fFormat = SkMask::kA8_Format; | 454 fMask.fFormat = SkMask::kA8_Format; |
455 | 455 |
456 fClipRect = ir; | 456 fClipRect = ir; |
457 fClipRect.intersect(clip.getBounds()); | 457 if (!fClipRect.intersect(clip.getBounds())) { |
| 458 SkASSERT(0); |
| 459 fClipRect.setEmpty(); |
| 460 } |
458 | 461 |
459 // For valgrind, write 1 extra byte at the end so we don't read | 462 // For valgrind, write 1 extra byte at the end so we don't read |
460 // uninitialized memory. See comment in add_aa_span and fStorage[]. | 463 // uninitialized memory. See comment in add_aa_span and fStorage[]. |
461 memset(fStorage, 0, fMask.fBounds.height() * fMask.fRowBytes + 1); | 464 memset(fStorage, 0, fMask.fBounds.height() * fMask.fRowBytes + 1); |
462 } | 465 } |
463 | 466 |
464 static void add_aa_span(uint8_t* alpha, U8CPU startAlpha) { | 467 static void add_aa_span(uint8_t* alpha, U8CPU startAlpha) { |
465 /* I should be able to just add alpha[x] + startAlpha. | 468 /* I should be able to just add alpha[x] + startAlpha. |
466 However, if the trailing edge of the previous span and the leading | 469 However, if the trailing edge of the previous span and the leading |
467 edge of the current span round to the same super-sampled x value, | 470 edge of the current span round to the same super-sampled x value, |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 AntiFillPath(path, clip.bwRgn(), blitter); | 766 AntiFillPath(path, clip.bwRgn(), blitter); |
764 } else { | 767 } else { |
765 SkRegion tmp; | 768 SkRegion tmp; |
766 SkAAClipBlitter aaBlitter; | 769 SkAAClipBlitter aaBlitter; |
767 | 770 |
768 tmp.setRect(clip.getBounds()); | 771 tmp.setRect(clip.getBounds()); |
769 aaBlitter.init(blitter, &clip.aaRgn()); | 772 aaBlitter.init(blitter, &clip.aaRgn()); |
770 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); | 773 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); |
771 } | 774 } |
772 } | 775 } |
OLD | NEW |