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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 // Since we expect these to succeed, we bit-or together | 583 // Since we expect these to succeed, we bit-or together |
584 // for a tiny extra bit of speed. | 584 // for a tiny extra bit of speed. |
585 return overflows_short_shift(rect.fLeft, SHIFT) | | 585 return overflows_short_shift(rect.fLeft, SHIFT) | |
586 overflows_short_shift(rect.fRight, SHIFT) | | 586 overflows_short_shift(rect.fRight, SHIFT) | |
587 overflows_short_shift(rect.fTop, SHIFT) | | 587 overflows_short_shift(rect.fTop, SHIFT) | |
588 overflows_short_shift(rect.fBottom, SHIFT); | 588 overflows_short_shift(rect.fBottom, SHIFT); |
589 } | 589 } |
590 | 590 |
591 static bool safeRoundOut(const SkRect& src, SkIRect* dst, int32_t maxInt) { | 591 static bool safeRoundOut(const SkRect& src, SkIRect* dst, int32_t maxInt) { |
592 #ifdef SK_SCALAR_IS_FIXED | |
593 // the max-int (shifted) is exactly what we want to compare against, to know | |
594 // if we can survive shifting our fixed-point coordinates | |
595 const SkFixed maxScalar = maxInt; | |
596 #else | |
597 const SkScalar maxScalar = SkIntToScalar(maxInt); | 592 const SkScalar maxScalar = SkIntToScalar(maxInt); |
598 #endif | 593 |
599 if (fitsInsideLimit(src, maxScalar)) { | 594 if (fitsInsideLimit(src, maxScalar)) { |
600 src.roundOut(dst); | 595 src.roundOut(dst); |
601 return true; | 596 return true; |
602 } | 597 } |
603 return false; | 598 return false; |
604 } | 599 } |
605 | 600 |
606 void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip, | 601 void SkScan::AntiFillPath(const SkPath& path, const SkRegion& origClip, |
607 SkBlitter* blitter, bool forceRLE) { | 602 SkBlitter* blitter, bool forceRLE) { |
608 if (origClip.isEmpty()) { | 603 if (origClip.isEmpty()) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 AntiFillPath(path, clip.bwRgn(), blitter); | 732 AntiFillPath(path, clip.bwRgn(), blitter); |
738 } else { | 733 } else { |
739 SkRegion tmp; | 734 SkRegion tmp; |
740 SkAAClipBlitter aaBlitter; | 735 SkAAClipBlitter aaBlitter; |
741 | 736 |
742 tmp.setRect(clip.getBounds()); | 737 tmp.setRect(clip.getBounds()); |
743 aaBlitter.init(blitter, &clip.aaRgn()); | 738 aaBlitter.init(blitter, &clip.aaRgn()); |
744 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); | 739 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); |
745 } | 740 } |
746 } | 741 } |
OLD | NEW |