fix scalar=fixed by implementing SkRegion form of AntiFillRect

git-svn-id: http://skia.googlecode.com/svn/trunk@2516 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-10-24 12:56:20 +00:00
parent 045e62d715
commit 67ba5fa328
2 changed files with 48 additions and 28 deletions

View File

@ -80,6 +80,7 @@ private:
static void FillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
static void AntiFillRect(const SkRect&, const SkRegion* clip, SkBlitter*);
#endif
static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*);
static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*);
static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*,
bool forceRLE = false);

View File

@ -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();
if (NULL == clip) {
antifillrect(xr, blitter);
} else {
SkIRect outerBounds;
XRect_roundOut(xr, &outerBounds);
SkIRect outerBounds;
XRect_roundOut(xr, &outerBounds);
if (clip->isRect()) {
const SkIRect& clipBounds = clip->getBounds();
if (clipRgn->isRect()) {
const SkIRect& clipBounds = clipRgn->getBounds();
if (clipBounds.contains(outerBounds)) {
antifillrect(xr, blitter);
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());
}
}
}