| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 return; | 538 return; |
| 539 } | 539 } |
| 540 | 540 |
| 541 #ifdef SK_DEBUG | 541 #ifdef SK_DEBUG |
| 542 { | 542 { |
| 543 int ix = x >> SHIFT; | 543 int ix = x >> SHIFT; |
| 544 SkASSERT(ix >= fMask.fBounds.fLeft && ix < fMask.fBounds.fRight); | 544 SkASSERT(ix >= fMask.fBounds.fLeft && ix < fMask.fBounds.fRight); |
| 545 } | 545 } |
| 546 #endif | 546 #endif |
| 547 | 547 |
| 548 x -= (fMask.fBounds.fLeft << SHIFT); | 548 x -= SkLeftShift(fMask.fBounds.fLeft, SHIFT); |
| 549 | 549 |
| 550 // hack, until I figure out why my cubics (I think) go beyond the bounds | 550 // hack, until I figure out why my cubics (I think) go beyond the bounds |
| 551 if (x < 0) { | 551 if (x < 0) { |
| 552 width += x; | 552 width += x; |
| 553 x = 0; | 553 x = 0; |
| 554 } | 554 } |
| 555 | 555 |
| 556 uint8_t* row = fMask.fImage + iy * fMask.fRowBytes + (x >> SHIFT); | 556 uint8_t* row = fMask.fImage + iy * fMask.fRowBytes + (x >> SHIFT); |
| 557 | 557 |
| 558 int start = x; | 558 int start = x; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 585 /////////////////////////////////////////////////////////////////////////////// | 585 /////////////////////////////////////////////////////////////////////////////// |
| 586 | 586 |
| 587 static bool fitsInsideLimit(const SkRect& r, SkScalar max) { | 587 static bool fitsInsideLimit(const SkRect& r, SkScalar max) { |
| 588 const SkScalar min = -max; | 588 const SkScalar min = -max; |
| 589 return r.fLeft > min && r.fTop > min && | 589 return r.fLeft > min && r.fTop > min && |
| 590 r.fRight < max && r.fBottom < max; | 590 r.fRight < max && r.fBottom < max; |
| 591 } | 591 } |
| 592 | 592 |
| 593 static int overflows_short_shift(int value, int shift) { | 593 static int overflows_short_shift(int value, int shift) { |
| 594 const int s = 16 + shift; | 594 const int s = 16 + shift; |
| 595 return (value << s >> s) - value; | 595 return (SkLeftShift(value, s) >> s) - value; |
| 596 } | 596 } |
| 597 | 597 |
| 598 /** | 598 /** |
| 599 Would any of the coordinates of this rectangle not fit in a short, | 599 Would any of the coordinates of this rectangle not fit in a short, |
| 600 when left-shifted by shift? | 600 when left-shifted by shift? |
| 601 */ | 601 */ |
| 602 static int rect_overflows_short_shift(SkIRect rect, int shift) { | 602 static int rect_overflows_short_shift(SkIRect rect, int shift) { |
| 603 SkASSERT(!overflows_short_shift(8191, SHIFT)); | 603 SkASSERT(!overflows_short_shift(8191, SHIFT)); |
| 604 SkASSERT(overflows_short_shift(8192, SHIFT)); | 604 SkASSERT(overflows_short_shift(8192, SHIFT)); |
| 605 SkASSERT(!overflows_short_shift(32767, 0)); | 605 SkASSERT(!overflows_short_shift(32767, 0)); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 AntiFillPath(path, clip.bwRgn(), blitter); | 758 AntiFillPath(path, clip.bwRgn(), blitter); |
| 759 } else { | 759 } else { |
| 760 SkRegion tmp; | 760 SkRegion tmp; |
| 761 SkAAClipBlitter aaBlitter; | 761 SkAAClipBlitter aaBlitter; |
| 762 | 762 |
| 763 tmp.setRect(clip.getBounds()); | 763 tmp.setRect(clip.getBounds()); |
| 764 aaBlitter.init(blitter, &clip.aaRgn()); | 764 aaBlitter.init(blitter, &clip.aaRgn()); |
| 765 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); | 765 SkScan::AntiFillPath(path, tmp, &aaBlitter, true); |
| 766 } | 766 } |
| 767 } | 767 } |
| OLD | NEW |