add op(rgn, op)
git-svn-id: http://skia.googlecode.com/svn/trunk@2454 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
294dd7b3d7
commit
ba16da97e8
@ -12,6 +12,12 @@ SkRasterClip::SkRasterClip() {
|
||||
fIsBW = true;
|
||||
}
|
||||
|
||||
SkRasterClip::SkRasterClip(const SkIRect& bounds) : fBW(bounds) {
|
||||
fIsBW = true;
|
||||
}
|
||||
|
||||
SkRasterClip::~SkRasterClip() {}
|
||||
|
||||
bool SkRasterClip::isEmpty() const {
|
||||
return fIsBW ? fBW.isEmpty() : fAA.isEmpty();
|
||||
}
|
||||
@ -35,7 +41,7 @@ bool SkRasterClip::setEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SkRasterClip::setIRect(const SkIRect& rect) {
|
||||
bool SkRasterClip::setRect(const SkIRect& rect) {
|
||||
fIsBW = true;
|
||||
fAA.setEmpty();
|
||||
return fBW.setRect(rect);
|
||||
@ -76,6 +82,16 @@ bool SkRasterClip::op(const SkIRect& rect, SkRegion::Op op) {
|
||||
return fIsBW ? fBW.op(rect, op) : fAA.op(rect, op);
|
||||
}
|
||||
|
||||
bool SkRasterClip::op(const SkRegion& rgn, SkRegion::Op op) {
|
||||
if (fIsBW) {
|
||||
return fBW.op(rgn, op);
|
||||
} else {
|
||||
SkAAClip tmp;
|
||||
tmp.setRegion(rgn);
|
||||
return fAA.op(tmp, op);
|
||||
}
|
||||
}
|
||||
|
||||
bool SkRasterClip::op(const SkRasterClip& clip, SkRegion::Op op) {
|
||||
if (this->isBW() && clip.isBW()) {
|
||||
return fBW.op(clip.fBW, op);
|
||||
@ -96,6 +112,13 @@ bool SkRasterClip::op(const SkRasterClip& clip, SkRegion::Op op) {
|
||||
}
|
||||
}
|
||||
|
||||
const SkRegion& SkRasterClip::forceGetBW() {
|
||||
if (!fIsBW) {
|
||||
fBW.setRect(fAA.getBounds());
|
||||
}
|
||||
return fBW;
|
||||
}
|
||||
|
||||
void SkRasterClip::convertToAA() {
|
||||
SkASSERT(fIsBW);
|
||||
fAA.setRegion(fBW);
|
||||
|
@ -14,6 +14,7 @@
|
||||
class SkRasterClip {
|
||||
public:
|
||||
SkRasterClip();
|
||||
SkRasterClip(const SkIRect&);
|
||||
SkRasterClip(const SkRasterClip&);
|
||||
~SkRasterClip();
|
||||
|
||||
@ -26,18 +27,21 @@ public:
|
||||
const SkIRect& getBounds() const;
|
||||
|
||||
bool setEmpty();
|
||||
bool setIRect(const SkIRect&);
|
||||
bool setRect(const SkIRect&);
|
||||
|
||||
bool setPath(const SkPath& path, const SkRegion& clip, bool doAA);
|
||||
bool setPath(const SkPath& path, const SkIRect& clip, bool doAA);
|
||||
bool setPath(const SkPath& path, const SkRasterClip&, bool doAA);
|
||||
|
||||
bool op(const SkIRect&, SkRegion::Op);
|
||||
bool op(const SkRegion&, SkRegion::Op);
|
||||
bool op(const SkRasterClip&, SkRegion::Op);
|
||||
|
||||
const SkRegion& bwRgn() const { SkASSERT(fIsBW); return fBW; }
|
||||
const SkAAClip& aaRgn() const { SkASSERT(!fIsBW); return fAA; }
|
||||
|
||||
const SkRegion& forceGetBW();
|
||||
|
||||
private:
|
||||
SkRegion fBW;
|
||||
SkAAClip fAA;
|
||||
|
Loading…
Reference in New Issue
Block a user