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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return level; | 348 return level; |
349 } | 349 } |
350 | 350 |
351 static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
blitter, | 351 static void hair_path(const SkPath& path, const SkRasterClip& rclip, SkBlitter*
blitter, |
352 SkScan::HairRgnProc lineproc) { | 352 SkScan::HairRgnProc lineproc) { |
353 if (path.isEmpty()) { | 353 if (path.isEmpty()) { |
354 return; | 354 return; |
355 } | 355 } |
356 | 356 |
357 SkAAClipBlitterWrapper wrap; | 357 SkAAClipBlitterWrapper wrap; |
358 const SkRegion* clip = NULL; | 358 const SkRegion* clip = nullptr; |
359 | 359 |
360 { | 360 { |
361 const SkIRect ibounds = path.getBounds().roundOut().makeOutset(1, 1); | 361 const SkIRect ibounds = path.getBounds().roundOut().makeOutset(1, 1); |
362 | 362 |
363 if (rclip.quickReject(ibounds)) { | 363 if (rclip.quickReject(ibounds)) { |
364 return; | 364 return; |
365 } | 365 } |
366 if (!rclip.quickContains(ibounds)) { | 366 if (!rclip.quickContains(ibounds)) { |
367 if (rclip.isBW()) { | 367 if (rclip.isBW()) { |
368 clip = &rclip.bwRgn(); | 368 clip = &rclip.bwRgn(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 tmp.fLeft = outer.fRight - dx; | 455 tmp.fLeft = outer.fRight - dx; |
456 tmp.fRight = outer.fRight; | 456 tmp.fRight = outer.fRight; |
457 SkScan::FillRect(tmp, clip, blitter); | 457 SkScan::FillRect(tmp, clip, blitter); |
458 } | 458 } |
459 | 459 |
460 void SkScan::HairLine(const SkPoint pts[], int count, const SkRasterClip& clip, | 460 void SkScan::HairLine(const SkPoint pts[], int count, const SkRasterClip& clip, |
461 SkBlitter* blitter) { | 461 SkBlitter* blitter) { |
462 if (clip.isBW()) { | 462 if (clip.isBW()) { |
463 HairLineRgn(pts, count, &clip.bwRgn(), blitter); | 463 HairLineRgn(pts, count, &clip.bwRgn(), blitter); |
464 } else { | 464 } else { |
465 const SkRegion* clipRgn = NULL; | 465 const SkRegion* clipRgn = nullptr; |
466 | 466 |
467 SkRect r; | 467 SkRect r; |
468 r.set(pts, count); | 468 r.set(pts, count); |
469 r.outset(SK_ScalarHalf, SK_ScalarHalf); | 469 r.outset(SK_ScalarHalf, SK_ScalarHalf); |
470 | 470 |
471 SkAAClipBlitterWrapper wrap; | 471 SkAAClipBlitterWrapper wrap; |
472 if (!clip.quickContains(r.roundOut())) { | 472 if (!clip.quickContains(r.roundOut())) { |
473 wrap.init(clip, blitter); | 473 wrap.init(clip, blitter); |
474 blitter = wrap.getBlitter(); | 474 blitter = wrap.getBlitter(); |
475 clipRgn = &wrap.getRgn(); | 475 clipRgn = &wrap.getRgn(); |
476 } | 476 } |
477 HairLineRgn(pts, count, clipRgn, blitter); | 477 HairLineRgn(pts, count, clipRgn, blitter); |
478 } | 478 } |
479 } | 479 } |
480 | 480 |
481 void SkScan::AntiHairLine(const SkPoint pts[], int count, const SkRasterClip& cl
ip, | 481 void SkScan::AntiHairLine(const SkPoint pts[], int count, const SkRasterClip& cl
ip, |
482 SkBlitter* blitter) { | 482 SkBlitter* blitter) { |
483 if (clip.isBW()) { | 483 if (clip.isBW()) { |
484 AntiHairLineRgn(pts, count, &clip.bwRgn(), blitter); | 484 AntiHairLineRgn(pts, count, &clip.bwRgn(), blitter); |
485 } else { | 485 } else { |
486 const SkRegion* clipRgn = NULL; | 486 const SkRegion* clipRgn = nullptr; |
487 | 487 |
488 SkRect r; | 488 SkRect r; |
489 r.set(pts, count); | 489 r.set(pts, count); |
490 | 490 |
491 SkAAClipBlitterWrapper wrap; | 491 SkAAClipBlitterWrapper wrap; |
492 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { | 492 if (!clip.quickContains(r.roundOut().makeOutset(1, 1))) { |
493 wrap.init(clip, blitter); | 493 wrap.init(clip, blitter); |
494 blitter = wrap.getBlitter(); | 494 blitter = wrap.getBlitter(); |
495 clipRgn = &wrap.getRgn(); | 495 clipRgn = &wrap.getRgn(); |
496 } | 496 } |
497 AntiHairLineRgn(pts, count, clipRgn, blitter); | 497 AntiHairLineRgn(pts, count, clipRgn, blitter); |
498 } | 498 } |
499 } | 499 } |
OLD | NEW |