Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: src/pipe/SkGPipeWrite.cpp

Issue 183453002: add new onClip* methods to SkCanvas (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: remove debug Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/utils/SkCanvasStack.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
===================================================================
--- src/pipe/SkGPipeWrite.cpp (revision 13622)
+++ src/pipe/SkGPipeWrite.cpp (working copy)
@@ -240,11 +240,6 @@
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 @@
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 @@
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);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/utils/SkCanvasStack.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698