Convert DIRTY_AFTER_EDIT to SkPath::dirtyAfterEdit
Change-Id: I0394f0956c0589597ce910f4c0ad9f44bf4ee05e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269194
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index d1e0033..938c0b4 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -1753,6 +1753,8 @@
void setPt(int index, SkScalar x, SkScalar y);
+ SkPath& dirtyAfterEdit();
+
// Bottlenecks for working with fConvexity and fFirstDirection.
// Notice the setters are const... these are mutable atomic fields.
void setConvexityType(SkPathConvexityType) const;
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 6e99bf3..a6b39c2 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -577,11 +577,11 @@
//////////////////////////////////////////////////////////////////////////////
// Construction methods
-#define DIRTY_AFTER_EDIT \
- do { \
- this->setConvexityType(SkPathConvexityType::kUnknown); \
- this->setFirstDirection(SkPathPriv::kUnknown_FirstDirection); \
- } while (0)
+SkPath& SkPath::dirtyAfterEdit() {
+ this->setConvexityType(SkPathConvexityType::kUnknown);
+ this->setFirstDirection(SkPathPriv::kUnknown_FirstDirection);
+ return *this;
+}
void SkPath::incReserve(int inc) {
SkDEBUGCODE(this->validate();)
@@ -601,8 +601,7 @@
ed.growForVerb(kMove_Verb)->set(x, y);
- DIRTY_AFTER_EDIT;
- return *this;
+ return this->dirtyAfterEdit();
}
SkPath& SkPath::rMoveTo(SkScalar x, SkScalar y) {
@@ -633,8 +632,7 @@
SkPathRef::Editor ed(&fPathRef);
ed.growForVerb(kLine_Verb)->set(x, y);
- DIRTY_AFTER_EDIT;
- return *this;
+ return this->dirtyAfterEdit();
}
SkPath& SkPath::rLineTo(SkScalar x, SkScalar y) {
@@ -654,8 +652,7 @@
pts[0].set(x1, y1);
pts[1].set(x2, y2);
- DIRTY_AFTER_EDIT;
- return *this;
+ return this->dirtyAfterEdit();
}
SkPath& SkPath::rQuadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) {
@@ -685,7 +682,7 @@
pts[0].set(x1, y1);
pts[1].set(x2, y2);
- DIRTY_AFTER_EDIT;
+ (void)this->dirtyAfterEdit();
}
return *this;
}
@@ -710,8 +707,7 @@
pts[1].set(x2, y2);
pts[2].set(x3, y3);
- DIRTY_AFTER_EDIT;
- return *this;
+ return this->dirtyAfterEdit();
}
SkPath& SkPath::rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
@@ -819,7 +815,7 @@
fLastMoveToIndex ^= ~fLastMoveToIndex >> (8 * sizeof(fLastMoveToIndex) - 1);
}
- DIRTY_AFTER_EDIT;
+ (void)this->dirtyAfterEdit();
SkDEBUGCODE(this->validate();)
return *this;
}