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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 static void hair_path(const SkPath& path, const SkRasterClip& rclip, | 260 static void hair_path(const SkPath& path, const SkRasterClip& rclip, |
261 SkBlitter* blitter, LineProc lineproc) { | 261 SkBlitter* blitter, LineProc lineproc) { |
262 if (path.isEmpty()) { | 262 if (path.isEmpty()) { |
263 return; | 263 return; |
264 } | 264 } |
265 | 265 |
266 SkAAClipBlitterWrapper wrap; | 266 SkAAClipBlitterWrapper wrap; |
267 const SkRegion* clip = NULL; | 267 const SkRegion* clip = NULL; |
268 | 268 |
269 { | 269 { |
270 SkIRect ibounds; | 270 const SkIRect ibounds = path.getBounds().roundOut().makeOutset(1, 1); |
271 path.getBounds().roundOut(&ibounds); | |
272 ibounds.inset(-1, -1); | |
273 | 271 |
274 if (rclip.quickReject(ibounds)) { | 272 if (rclip.quickReject(ibounds)) { |
275 return; | 273 return; |
276 } | 274 } |
277 if (!rclip.quickContains(ibounds)) { | 275 if (!rclip.quickContains(ibounds)) { |
278 if (rclip.isBW()) { | 276 if (rclip.isBW()) { |
279 clip = &rclip.bwRgn(); | 277 clip = &rclip.bwRgn(); |
280 } else { | 278 } else { |
281 wrap.init(rclip, blitter); | 279 wrap.init(rclip, blitter); |
282 blitter = wrap.getBlitter(); | 280 blitter = wrap.getBlitter(); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 370 |
373 void SkScan::HairLine(const SkPoint& p0, const SkPoint& p1, | 371 void SkScan::HairLine(const SkPoint& p0, const SkPoint& p1, |
374 const SkRasterClip& clip, SkBlitter* blitter) { | 372 const SkRasterClip& clip, SkBlitter* blitter) { |
375 if (clip.isBW()) { | 373 if (clip.isBW()) { |
376 HairLineRgn(p0, p1, &clip.bwRgn(), blitter); | 374 HairLineRgn(p0, p1, &clip.bwRgn(), blitter); |
377 } else { | 375 } else { |
378 const SkRegion* clipRgn = NULL; | 376 const SkRegion* clipRgn = NULL; |
379 SkRect r; | 377 SkRect r; |
380 r.set(p0.fX, p0.fY, p1.fX, p1.fY); | 378 r.set(p0.fX, p0.fY, p1.fX, p1.fY); |
381 r.sort(); | 379 r.sort(); |
382 r.inset(-SK_ScalarHalf, -SK_ScalarHalf); | 380 r.outset(SK_ScalarHalf, SK_ScalarHalf); |
383 | 381 |
384 SkAAClipBlitterWrapper wrap; | 382 SkAAClipBlitterWrapper wrap; |
385 if (!clip.quickContains(r.roundOut())) { | 383 if (!clip.quickContains(r.roundOut())) { |
386 wrap.init(clip, blitter); | 384 wrap.init(clip, blitter); |
387 blitter = wrap.getBlitter(); | 385 blitter = wrap.getBlitter(); |
388 clipRgn = &wrap.getRgn(); | 386 clipRgn = &wrap.getRgn(); |
389 } | 387 } |
390 HairLineRgn(p0, p1, clipRgn, blitter); | 388 HairLineRgn(p0, p1, clipRgn, blitter); |
391 } | 389 } |
392 } | 390 } |
393 | 391 |
394 void SkScan::AntiHairLine(const SkPoint& p0, const SkPoint& p1, | 392 void SkScan::AntiHairLine(const SkPoint& p0, const SkPoint& p1, |
395 const SkRasterClip& clip, SkBlitter* blitter) { | 393 const SkRasterClip& clip, SkBlitter* blitter) { |
396 if (clip.isBW()) { | 394 if (clip.isBW()) { |
397 AntiHairLineRgn(p0, p1, &clip.bwRgn(), blitter); | 395 AntiHairLineRgn(p0, p1, &clip.bwRgn(), blitter); |
398 } else { | 396 } else { |
399 const SkRegion* clipRgn = NULL; | 397 const SkRegion* clipRgn = NULL; |
400 SkRect r; | 398 SkRect r; |
401 SkIRect ir; | |
402 r.set(p0.fX, p0.fY, p1.fX, p1.fY); | 399 r.set(p0.fX, p0.fY, p1.fX, p1.fY); |
403 r.sort(); | 400 r.sort(); |
404 r.roundOut(&ir); | |
405 ir.inset(-1, -1); | |
406 | 401 |
407 SkAAClipBlitterWrapper wrap; | 402 SkAAClipBlitterWrapper wrap; |
408 if (!clip.quickContains(ir)) { | 403 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { |
409 wrap.init(clip, blitter); | 404 wrap.init(clip, blitter); |
410 blitter = wrap.getBlitter(); | 405 blitter = wrap.getBlitter(); |
411 clipRgn = &wrap.getRgn(); | 406 clipRgn = &wrap.getRgn(); |
412 } | 407 } |
413 AntiHairLineRgn(p0, p1, clipRgn, blitter); | 408 AntiHairLineRgn(p0, p1, clipRgn, blitter); |
414 } | 409 } |
415 } | 410 } |
OLD | NEW |