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 "SkScan.h" | 10 #include "SkScan.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 static int compute_int_quad_dist(const SkPoint pts[3]) { | 194 static int compute_int_quad_dist(const SkPoint pts[3]) { |
195 // compute the vector between the control point ([1]) and the middle of the | 195 // compute the vector between the control point ([1]) and the middle of the |
196 // line connecting the start and end ([0] and [2]) | 196 // line connecting the start and end ([0] and [2]) |
197 SkScalar dx = SkScalarHalf(pts[0].fX + pts[2].fX) - pts[1].fX; | 197 SkScalar dx = SkScalarHalf(pts[0].fX + pts[2].fX) - pts[1].fX; |
198 SkScalar dy = SkScalarHalf(pts[0].fY + pts[2].fY) - pts[1].fY; | 198 SkScalar dy = SkScalarHalf(pts[0].fY + pts[2].fY) - pts[1].fY; |
199 // we want everyone to be positive | 199 // we want everyone to be positive |
200 dx = SkScalarAbs(dx); | 200 dx = SkScalarAbs(dx); |
201 dy = SkScalarAbs(dy); | 201 dy = SkScalarAbs(dy); |
202 // convert to whole pixel values (use ceiling to be conservative) | 202 // convert to whole pixel values (use ceiling to be conservative) |
203 int idx = SkScalarCeil(dx); | 203 int idx = SkScalarCeilToInt(dx); |
204 int idy = SkScalarCeil(dy); | 204 int idy = SkScalarCeilToInt(dy); |
205 // use the cheap approx for distance | 205 // use the cheap approx for distance |
206 if (idx > idy) { | 206 if (idx > idy) { |
207 return idx + (idy >> 1); | 207 return idx + (idy >> 1); |
208 } else { | 208 } else { |
209 return idy + (idx >> 1); | 209 return idy + (idx >> 1); |
210 } | 210 } |
211 } | 211 } |
212 | 212 |
213 typedef void (*LineProc)(const SkPoint&, const SkPoint&, const SkRegion*, | 213 typedef void (*LineProc)(const SkPoint&, const SkPoint&, const SkRegion*, |
214 SkBlitter*); | 214 SkBlitter*); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 SkAAClipBlitterWrapper wrap; | 409 SkAAClipBlitterWrapper wrap; |
410 if (!clip.quickContains(ir)) { | 410 if (!clip.quickContains(ir)) { |
411 wrap.init(clip, blitter); | 411 wrap.init(clip, blitter); |
412 blitter = wrap.getBlitter(); | 412 blitter = wrap.getBlitter(); |
413 clipRgn = &wrap.getRgn(); | 413 clipRgn = &wrap.getRgn(); |
414 } | 414 } |
415 AntiHairLineRgn(p0, p1, clipRgn, blitter); | 415 AntiHairLineRgn(p0, p1, clipRgn, blitter); |
416 } | 416 } |
417 } | 417 } |
OLD | NEW |