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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 SkFixed slope = SkFixedDiv(dx, dy); | 135 SkFixed slope = SkFixedDiv(dx, dy); |
136 SkFixed startX = SkFDot6ToFixed(x0) + (slope * ((32 - y0) & 63) >> 6
); | 136 SkFixed startX = SkFDot6ToFixed(x0) + (slope * ((32 - y0) & 63) >> 6
); |
137 | 137 |
138 vertline(iy0, iy1, startX, slope, blitter); | 138 vertline(iy0, iy1, startX, slope, blitter); |
139 } | 139 } |
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 SkScalarFloorToInt) |
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; | 150 SkIRect r; |
151 | 151 |
152 r.set(SkScalarToFixed(rect.fLeft) >> 16, | 152 r.set(SkScalarFloorToInt(rect.fLeft), |
153 SkScalarToFixed(rect.fTop) >> 16, | 153 SkScalarFloorToInt(rect.fTop), |
154 (SkScalarToFixed(rect.fRight) >> 16) + 1, | 154 SkScalarFloorToInt(rect.fRight) + 1, |
155 (SkScalarToFixed(rect.fBottom) >> 16) + 1); | 155 SkScalarFloorToInt(rect.fBottom) + 1); |
156 | 156 |
157 if (clip.quickReject(r)) { | 157 if (clip.quickReject(r)) { |
158 return; | 158 return; |
159 } | 159 } |
160 if (!clip.quickContains(r)) { | 160 if (!clip.quickContains(r)) { |
161 const SkRegion* clipRgn; | 161 const SkRegion* clipRgn; |
162 if (clip.isBW()) { | 162 if (clip.isBW()) { |
163 clipRgn = &clip.bwRgn(); | 163 clipRgn = &clip.bwRgn(); |
164 } else { | 164 } else { |
165 wrapper.init(clip, blitter); | 165 wrapper.init(clip, blitter); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 SkAAClipBlitterWrapper wrap; | 680 SkAAClipBlitterWrapper wrap; |
681 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { | 681 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { |
682 wrap.init(clip, blitter); | 682 wrap.init(clip, blitter); |
683 blitter = wrap.getBlitter(); | 683 blitter = wrap.getBlitter(); |
684 clipRgn = &wrap.getRgn(); | 684 clipRgn = &wrap.getRgn(); |
685 } | 685 } |
686 AntiHairLineRgn(pts, count, clipRgn, blitter); | 686 AntiHairLineRgn(pts, count, clipRgn, blitter); |
687 } | 687 } |
688 } | 688 } |
OLD | NEW |