diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-28 14:35:45 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-02-28 14:35:45 +0000 |
commit | 392c9be344549e809d0468abafdbeb6e32135bcd (patch) | |
tree | 20463ae97057623977e1d95c9d284c3db59330e8 /src/pipe | |
parent | 0e530754d36d942f6408c65cc93ba0a8ccd93610 (diff) |
add new onClip* methods to SkCanvas
https://codereview.chromium.org/183453002/
git-svn-id: http://skia.googlecode.com/svn/trunk@13620 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pipe')
-rw-r--r-- | src/pipe/SkGPipeWrite.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 879ce8288b..43209f644b 100644 --- a/src/pipe/SkGPipeWrite.cpp +++ b/src/pipe/SkGPipeWrite.cpp @@ -240,11 +240,6 @@ 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&, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE; - virtual bool clipRRect(const SkRRect&, SkRegion::Op op, bool doAntiAlias = false) SK_OVERRIDE; - virtual bool clipPath(const SkPath& path, SkRegion::Op op, - bool doAntiAlias = false) 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; virtual void drawPoints(PointMode, size_t count, const SkPoint pts[], @@ -294,6 +289,11 @@ public: protected: virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; + virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; + virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; + virtual void onClipPath(const SkPath&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; + virtual void onClipRegion(const SkRegion&, SkRegion::Op) SK_OVERRIDE; + private: enum { kNoSaveLayer = -1, @@ -635,47 +635,56 @@ void SkGPipeCanvas::setMatrix(const SkMatrix& matrix) { this->INHERITED::setMatrix(matrix); } -bool SkGPipeCanvas::clipRect(const SkRect& rect, SkRegion::Op rgnOp, - bool doAntiAlias) { +void SkGPipeCanvas::onClipRect(const SkRect& rect, SkRegion::Op rgnOp, + ClipEdgeStyle edgeStyle) { NOTIFY_SETUP(this); if (this->needOpBytes(sizeof(SkRect))) { - unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag; + unsigned flags = 0; + if (kSoft_ClipEdgeStyle == edgeStyle) { + flags = kClip_HasAntiAlias_DrawOpFlag; + } this->writeOp(kClipRect_DrawOp, flags, rgnOp); fWriter.writeRect(rect); } - return this->INHERITED::clipRect(rect, rgnOp, doAntiAlias); + this->INHERITED::onClipRect(rect, rgnOp, edgeStyle); } -bool SkGPipeCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op rgnOp, - bool doAntiAlias) { +void SkGPipeCanvas::onClipRRect(const SkRRect& rrect, SkRegion::Op rgnOp, + ClipEdgeStyle edgeStyle) { NOTIFY_SETUP(this); if (this->needOpBytes(kSizeOfFlatRRect)) { - unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag; + unsigned flags = 0; + if (kSoft_ClipEdgeStyle == edgeStyle) { + flags = kClip_HasAntiAlias_DrawOpFlag; + } this->writeOp(kClipRRect_DrawOp, flags, rgnOp); fWriter.writeRRect(rrect); } - return this->INHERITED::clipRRect(rrect, rgnOp, doAntiAlias); + this->INHERITED::onClipRRect(rrect, rgnOp, edgeStyle); } -bool SkGPipeCanvas::clipPath(const SkPath& path, SkRegion::Op rgnOp, - bool doAntiAlias) { +void SkGPipeCanvas::onClipPath(const SkPath& path, SkRegion::Op rgnOp, + ClipEdgeStyle edgeStyle) { NOTIFY_SETUP(this); if (this->needOpBytes(path.writeToMemory(NULL))) { - unsigned flags = doAntiAlias & kClip_HasAntiAlias_DrawOpFlag; + unsigned flags = 0; + if (kSoft_ClipEdgeStyle == edgeStyle) { + flags = kClip_HasAntiAlias_DrawOpFlag; + } this->writeOp(kClipPath_DrawOp, flags, rgnOp); fWriter.writePath(path); } // we just pass on the bounds of the path - return this->INHERITED::clipRect(path.getBounds(), rgnOp, doAntiAlias); + this->INHERITED::onClipRect(path.getBounds(), rgnOp, edgeStyle); } -bool SkGPipeCanvas::clipRegion(const SkRegion& region, SkRegion::Op rgnOp) { +void SkGPipeCanvas::onClipRegion(const SkRegion& region, SkRegion::Op rgnOp) { NOTIFY_SETUP(this); if (this->needOpBytes(region.writeToMemory(NULL))) { this->writeOp(kClipRegion_DrawOp, 0, rgnOp); fWriter.writeRegion(region); } - return this->INHERITED::clipRegion(region, rgnOp); + this->INHERITED::onClipRegion(region, rgnOp); } /////////////////////////////////////////////////////////////////////////////// |