add setRegion and doAA parameter to setPath
git-svn-id: http://skia.googlecode.com/svn/trunk@2450 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index 3e74031..0dbdd0f 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -210,14 +210,30 @@
return this->setPath(path);
}
-bool SkAAClip::setRect(const SkRect& r) {
+bool SkAAClip::setRect(const SkRect& r, bool doAA) {
if (r.isEmpty()) {
return this->setEmpty();
}
SkPath path;
path.addRect(r);
- return this->setPath(path);
+ return this->setPath(path, NULL, doAA);
+}
+
+bool SkAAClip::setRegion(const SkRegion& rgn) {
+ if (rgn.isEmpty()) {
+ return this->setEmpty();
+ }
+ if (rgn.isRect()) {
+ return this->setRect(rgn.getBounds());
+ }
+
+ SkAAClip clip;
+ SkRegion::Iterator iter(rgn);
+ for (; !iter.done(); iter.next()) {
+ clip.op(iter.rect(), SkRegion::kUnion_Op);
+ }
+ this->swap(clip);
}
///////////////////////////////////////////////////////////////////////////////
@@ -544,7 +560,7 @@
}
};
-bool SkAAClip::setPath(const SkPath& path, const SkRegion* clip) {
+bool SkAAClip::setPath(const SkPath& path, const SkRegion* clip, bool doAA) {
if (clip && clip->isEmpty()) {
return this->setEmpty();
}
@@ -567,7 +583,11 @@
Builder builder(ibounds);
BuilderBlitter blitter(&builder);
- SkScan::AntiFillPath(path, *clip, &blitter, true);
+ if (doAA) {
+ SkScan::AntiFillPath(path, *clip, &blitter, true);
+ } else {
+ SkScan::FillPath(path, *clip, &blitter);
+ }
this->freeRuns();
fBounds = ibounds;