OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkScan.h" | 8 #include "SkScan.h" |
9 #include "SkBlitter.h" | 9 #include "SkBlitter.h" |
10 #include "SkRasterClip.h" | 10 #include "SkRasterClip.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 // we don't just draw 4 lines, 'cause that can leave a gap in the bottom-right | 143 // we don't just draw 4 lines, 'cause that can leave a gap in the bottom-right |
144 // and double-hit the top-left. | 144 // and double-hit the top-left. |
145 // TODO: handle huge coordinates on rect (before calling SkScalarToFixed) | 145 // TODO: handle huge coordinates on rect (before calling SkScalarToFixed) |
146 void SkScan::HairRect(const SkRect& rect, const SkRasterClip& clip, | 146 void SkScan::HairRect(const SkRect& rect, const SkRasterClip& clip, |
147 SkBlitter* blitter) { | 147 SkBlitter* blitter) { |
148 SkAAClipBlitterWrapper wrapper; | 148 SkAAClipBlitterWrapper wrapper; |
149 SkBlitterClipper clipper; | 149 SkBlitterClipper clipper; |
150 SkIRect r; | |
151 | 150 |
152 r.set(SkScalarToFixed(rect.fLeft) >> 16, | 151 const SkIRect r = SkIRect::MakeLTRB(SkScalarTruncToInt(rect.fLeft), |
153 SkScalarToFixed(rect.fTop) >> 16, | 152 SkScalarTruncToInt(rect.fTop), |
154 (SkScalarToFixed(rect.fRight) >> 16) + 1, | 153 SkScalarTruncToInt(rect.fRight) + 1, |
155 (SkScalarToFixed(rect.fBottom) >> 16) + 1); | 154 SkScalarTruncToInt(rect.fBottom) + 1); |
156 | 155 |
157 if (clip.quickReject(r)) { | 156 if (clip.quickReject(r)) { |
158 return; | 157 return; |
159 } | 158 } |
160 if (!clip.quickContains(r)) { | 159 if (!clip.quickContains(r)) { |
161 const SkRegion* clipRgn; | 160 const SkRegion* clipRgn; |
162 if (clip.isBW()) { | 161 if (clip.isBW()) { |
163 clipRgn = &clip.bwRgn(); | 162 clipRgn = &clip.bwRgn(); |
164 } else { | 163 } else { |
165 wrapper.init(clip, blitter); | 164 wrapper.init(clip, blitter); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 465 } |
467 | 466 |
468 SkAAClipBlitterWrapper wrap; | 467 SkAAClipBlitterWrapper wrap; |
469 const SkRegion* clip = nullptr; | 468 const SkRegion* clip = nullptr; |
470 SkRect insetStorage, outsetStorage; | 469 SkRect insetStorage, outsetStorage; |
471 const SkRect* insetClip = nullptr; | 470 const SkRect* insetClip = nullptr; |
472 const SkRect* outsetClip = nullptr; | 471 const SkRect* outsetClip = nullptr; |
473 | 472 |
474 { | 473 { |
475 const int capOut = SkPaint::kButt_Cap == capStyle ? 1 : 2; | 474 const int capOut = SkPaint::kButt_Cap == capStyle ? 1 : 2; |
476 const SkIRect ibounds = path.getBounds().roundOut().makeOutset(capOut, c
apOut); | 475 const SkRect bounds = path.getBounds().makeOutset(capOut, capOut); |
477 if (rclip.quickReject(ibounds)) { | 476 if (rclip.quickReject(bounds)) { |
478 return; | 477 return; |
479 } | 478 } |
480 if (!rclip.quickContains(ibounds)) { | 479 if (!rclip.quickContains(bounds)) { |
481 if (rclip.isBW()) { | 480 if (rclip.isBW()) { |
482 clip = &rclip.bwRgn(); | 481 clip = &rclip.bwRgn(); |
483 } else { | 482 } else { |
484 wrap.init(rclip, blitter); | 483 wrap.init(rclip, blitter); |
485 blitter = wrap.getBlitter(); | 484 blitter = wrap.getBlitter(); |
486 clip = &wrap.getRgn(); | 485 clip = &wrap.getRgn(); |
487 } | 486 } |
488 | 487 |
489 /* | 488 /* |
490 * We now cache two scalar rects, to use for culling per-segment (e
.g. cubic). | 489 * We now cache two scalar rects, to use for culling per-segment (e
.g. cubic). |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 678 |
680 SkAAClipBlitterWrapper wrap; | 679 SkAAClipBlitterWrapper wrap; |
681 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { | 680 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { |
682 wrap.init(clip, blitter); | 681 wrap.init(clip, blitter); |
683 blitter = wrap.getBlitter(); | 682 blitter = wrap.getBlitter(); |
684 clipRgn = &wrap.getRgn(); | 683 clipRgn = &wrap.getRgn(); |
685 } | 684 } |
686 AntiHairLineRgn(pts, count, clipRgn, blitter); | 685 AntiHairLineRgn(pts, count, clipRgn, blitter); |
687 } | 686 } |
688 } | 687 } |
OLD | NEW |