add bool argument to canvas' clipRect and clipPath for antialiasing

(currently ignored)



git-svn-id: http://skia.googlecode.com/svn/trunk@2459 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2011-10-12 11:52:53 +00:00
parent e10f6fdf76
commit 071eef918d
9 changed files with 41 additions and 39 deletions

View File

@ -245,7 +245,8 @@ public:
@return true if the canvas' clip is non-empty
*/
virtual bool clipRect(const SkRect& rect,
SkRegion::Op op = SkRegion::kIntersect_Op);
SkRegion::Op op = SkRegion::kIntersect_Op,
bool doAntiAlias = false);
/** Modify the current clip with the specified path.
@param path The path to apply to the current clip
@ -253,7 +254,8 @@ public:
@return true if the canvas' new clip is non-empty
*/
virtual bool clipPath(const SkPath& path,
SkRegion::Op op = SkRegion::kIntersect_Op);
SkRegion::Op op = SkRegion::kIntersect_Op,
bool doAntiAlias = false);
/** Modify the current clip with the specified region. Note that unlike
clipRect() and clipPath() which transform their arguments by the current

View File

@ -70,10 +70,8 @@ public:
virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
virtual bool clipRect(const SkRect& rect,
SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
virtual bool clipPath(const SkPath& path,
SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipRegion(const SkRegion& deviceRgn,
SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;

View File

@ -33,10 +33,8 @@ public:
virtual bool skew(SkScalar sx, SkScalar sy);
virtual bool concat(const SkMatrix& matrix);
virtual void setMatrix(const SkMatrix& matrix);
virtual bool clipRect(const SkRect& rect,
SkRegion::Op op = SkRegion::kIntersect_Op);
virtual bool clipPath(const SkPath& path,
SkRegion::Op op = SkRegion::kIntersect_Op);
virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipRegion(const SkRegion& deviceRgn,
SkRegion::Op op = SkRegion::kIntersect_Op);

View File

@ -38,10 +38,8 @@ public:
virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
virtual bool clipRect(const SkRect& rect,
SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
virtual bool clipPath(const SkPath& path,
SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;
virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipRegion(const SkRegion& deviceRgn,
SkRegion::Op op = SkRegion::kIntersect_Op) SK_OVERRIDE;

View File

@ -163,7 +163,7 @@ void SkPictureRecord::recordOffsetForRestore(SkRegion::Op op) {
fRestoreOffsetStack.top() = offset;
}
bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op) {
bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
addDraw(CLIP_RECT);
addRect(rect);
addInt(op);
@ -171,10 +171,10 @@ bool SkPictureRecord::clipRect(const SkRect& rect, SkRegion::Op op) {
this->recordOffsetForRestore(op);
validate();
return this->INHERITED::clipRect(rect, op);
return this->INHERITED::clipRect(rect, op, doAA);
}
bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op) {
bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
addDraw(CLIP_PATH);
addPath(path);
addInt(op);
@ -184,9 +184,9 @@ bool SkPictureRecord::clipPath(const SkPath& path, SkRegion::Op op) {
validate();
if (fRecordFlags & SkPicture::kUsePathBoundsForClip_RecordingFlag) {
return this->INHERITED::clipRect(path.getBounds(), op);
return this->INHERITED::clipRect(path.getBounds(), op, doAA);
} else {
return this->INHERITED::clipPath(path, op);
return this->INHERITED::clipPath(path, op, doAA);
}
}

View File

@ -30,8 +30,8 @@ public:
virtual bool skew(SkScalar sx, SkScalar sy) SK_OVERRIDE;
virtual bool concat(const SkMatrix& matrix) SK_OVERRIDE;
virtual void setMatrix(const SkMatrix& matrix) SK_OVERRIDE;
virtual bool clipRect(const SkRect& rect, SkRegion::Op op) SK_OVERRIDE;
virtual bool clipPath(const SkPath& path, SkRegion::Op op) SK_OVERRIDE;
virtual bool clipRect(const SkRect&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipPath(const SkPath&, SkRegion::Op, bool) SK_OVERRIDE;
virtual bool clipRegion(const SkRegion& region, SkRegion::Op op) SK_OVERRIDE;
virtual void clear(SkColor) SK_OVERRIDE;
virtual void drawPaint(const SkPaint& paint) SK_OVERRIDE;

View File

@ -233,18 +233,24 @@ void SkDumpCanvas::setMatrix(const SkMatrix& matrix) {
///////////////////////////////////////////////////////////////////////////////
bool SkDumpCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
SkString str;
toString(rect, &str);
this->dump(kClip_Verb, NULL, "clipRect(%s %s)", str.c_str(), toString(op));
return this->INHERITED::clipRect(rect, op);
static const char* bool_to_aastring(bool doAA) {
return doAA ? "AA" : "BW";
}
bool SkDumpCanvas::clipPath(const SkPath& path, SkRegion::Op op) {
bool SkDumpCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
SkString str;
toString(rect, &str);
this->dump(kClip_Verb, NULL, "clipRect(%s %s %s)", str.c_str(), toString(op),
bool_to_aastring(doAA));
return this->INHERITED::clipRect(rect, op, doAA);
}
bool SkDumpCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
SkString str;
toString(path, &str);
this->dump(kClip_Verb, NULL, "clipPath(%s %s)", str.c_str(), toString(op));
return this->INHERITED::clipPath(path, op);
this->dump(kClip_Verb, NULL, "clipPath(%s %s %s)", str.c_str(), toString(op),
bool_to_aastring(doAA));
return this->INHERITED::clipPath(path, op, doAA);
}
bool SkDumpCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {

View File

@ -129,20 +129,20 @@ void SkNWayCanvas::setMatrix(const SkMatrix& matrix) {
this->INHERITED::setMatrix(matrix);
}
bool SkNWayCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
bool SkNWayCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
Iter iter(fList);
while (iter.next()) {
iter->clipRect(rect, op);
iter->clipRect(rect, op, doAA);
}
return this->INHERITED::clipRect(rect, op);
return this->INHERITED::clipRect(rect, op, doAA);
}
bool SkNWayCanvas::clipPath(const SkPath& path, SkRegion::Op op) {
bool SkNWayCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
Iter iter(fList);
while (iter.next()) {
iter->clipPath(path, op);
iter->clipPath(path, op, doAA);
}
return this->INHERITED::clipPath(path, op);
return this->INHERITED::clipPath(path, op, doAA);
}
bool SkNWayCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {

View File

@ -58,12 +58,12 @@ void SkProxyCanvas::setMatrix(const SkMatrix& matrix) {
fProxy->setMatrix(matrix);
}
bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op) {
return fProxy->clipRect(rect, op);
bool SkProxyCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
return fProxy->clipRect(rect, op, doAA);
}
bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op) {
return fProxy->clipPath(path, op);
bool SkProxyCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
return fProxy->clipPath(path, op, doAA);
}
bool SkProxyCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {