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

Unified Diff: src/core/SkCanvas.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « samplecode/SampleIdentityScale.cpp ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index a6f263f517dd387510638b00d7bba207e93cda4e..be514bcd2f4cf1cf4acd58fd500a77f98f5f9986 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1335,6 +1335,31 @@ void SkCanvas::resetMatrix() {
//////////////////////////////////////////////////////////////////////////////
+static SkRegion::Op clip2rgn(SkClipOp op) {
+ if (kIntersect_SkClipOp == op) {
+ return SkRegion::kIntersect_Op;
+ } else {
+ SkASSERT(kDifference_SkClipOp == op);
+ return SkRegion::kDifference_Op;
+ }
+}
+
+void SkCanvas::clipRect(const SkRect& rect, SkClipOp op, bool doAntiAlias) {
+ this->clipRect(rect, clip2rgn(op), doAntiAlias);
+}
+
+void SkCanvas::clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias) {
+ this->clipRRect(rrect, clip2rgn(op), doAntiAlias);
+}
+
+void SkCanvas::clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias) {
+ this->clipPath(path, clip2rgn(op), doAntiAlias);
+}
+
+void SkCanvas::clipRegion(const SkRegion& deviceRgn, SkClipOp op) {
+ this->clipRegion(deviceRgn, clip2rgn(op));
+}
+
void SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) {
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;
this->onClipRect(rect, op, edgeStyle);
« no previous file with comments | « samplecode/SampleIdentityScale.cpp ('k') | src/core/SkPicturePlayback.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698