diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-10-24 12:56:20 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-10-24 12:56:20 +0000 |
commit | 67ba5fa3283185f29c22e9b8daad521de0d00b23 (patch) | |
tree | 71e500fe3b1cd96aa26ba11296cb8c4202bcac1b /src | |
parent | 045e62d715f5ee9b03deb5af3c750f8318096179 (diff) |
fix scalar=fixed by implementing SkRegion form of AntiFillRect
git-svn-id: http://skia.googlecode.com/svn/trunk@2516 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkScan_Antihair.cpp | 77 |
1 files changed, 48 insertions, 29 deletions
diff --git a/src/core/SkScan_Antihair.cpp b/src/core/SkScan_Antihair.cpp index bb81cd6816..3b286343b6 100644 --- a/src/core/SkScan_Antihair.cpp +++ b/src/core/SkScan_Antihair.cpp @@ -556,41 +556,60 @@ static void antifillrect(const SkXRect& xr, SkBlitter* blitter) { /////////////////////////////////////////////////////////////////////////////// -void SkScan::AntiFillXRect(const SkXRect& xr, const SkRasterClip& clip, +void SkScan::AntiFillXRect(const SkXRect& xr, const SkRegion* clip, SkBlitter* blitter) { - SkAAClipBlitterWrapper wrapper(clip, blitter); - const SkRegion* clipRgn = &wrapper.getRgn(); - blitter = wrapper.getBlitter(); - - SkIRect outerBounds; - XRect_roundOut(xr, &outerBounds); - - if (clipRgn->isRect()) { - const SkIRect& clipBounds = clipRgn->getBounds(); + if (NULL == clip) { + antifillrect(xr, blitter); + } else { + SkIRect outerBounds; + XRect_roundOut(xr, &outerBounds); - if (clipBounds.contains(outerBounds)) { - antifillrect(xr, blitter); + if (clip->isRect()) { + const SkIRect& clipBounds = clip->getBounds(); + + if (clipBounds.contains(outerBounds)) { + antifillrect(xr, blitter); + } else { + SkXRect tmpR; + // this keeps our original edges fractional + XRect_set(&tmpR, clipBounds); + if (tmpR.intersect(xr)) { + antifillrect(tmpR, blitter); + } + } } else { - SkXRect tmpR; - // this keeps our original edges fractional - XRect_set(&tmpR, clipBounds); - if (tmpR.intersect(xr)) { - antifillrect(tmpR, blitter); + SkRegion::Cliperator clipper(*clip, outerBounds); + const SkIRect& rr = clipper.rect(); + + while (!clipper.done()) { + SkXRect tmpR; + + // this keeps our original edges fractional + XRect_set(&tmpR, rr); + if (tmpR.intersect(xr)) { + antifillrect(tmpR, blitter); + } + clipper.next(); } } + } +} + +void SkScan::AntiFillXRect(const SkXRect& xr, const SkRasterClip& clip, + SkBlitter* blitter) { + if (clip.isBW()) { + AntiFillXRect(xr, &clip.bwRgn(), blitter); } else { - SkRegion::Cliperator clipper(*clipRgn, outerBounds); - const SkIRect& rr = clipper.rect(); - - while (!clipper.done()) { - SkXRect tmpR; - - // this keeps our original edges fractional - XRect_set(&tmpR, rr); - if (tmpR.intersect(xr)) { - antifillrect(tmpR, blitter); - } - clipper.next(); + SkIRect outerBounds; + XRect_roundOut(xr, &outerBounds); + + if (clip.quickContains(outerBounds)) { + AntiFillXRect(xr, NULL, blitter); + } else { + SkAAClipBlitterWrapper wrapper(clip, blitter); + blitter = wrapper.getBlitter(); + + AntiFillXRect(xr, &wrapper.getRgn(), wrapper.getBlitter()); } } } |