Revert "Reland "Revert "Use flat version of path-direction enum"""
This reverts commit 7cda6f37439f69b1e4a9b08147f9c12ddad1bddb.
Reason for revert: legacy convexity code removed -- google3 should be ok
Original change's description:
> Reland "Revert "Use flat version of path-direction enum""
>
> This reverts commit 1792b19485cacb0c950a3c0ea0aab763a8d43176.
>
> Reason for revert: need to update legacy_convexity, still used by google3
>
> Original change's description:
> > Revert "Revert "Use flat version of path-direction enum""
> >
> > This reverts commit 0dacc6b7d3027e8181311a61f7ca798be52a0250.
> >
> > Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
> > Auto-Submit: Mike Reed <reed@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Mike Reed <reed@google.com>
>
> TBR=reed@google.com
>
> Change-Id: I0ecea0eb8a237298c6b908cc4bfd1cacdfc5b900
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255976
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=reed@google.com
Change-Id: I3529139bb391c4f62ce5cd0744cdf38a13b71d78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255984
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/bench/BlurRectsBench.cpp b/bench/BlurRectsBench.cpp
index ed2b254..df1775c 100644
--- a/bench/BlurRectsBench.cpp
+++ b/bench/BlurRectsBench.cpp
@@ -34,8 +34,8 @@
paint.setMaskFilter(SkMaskFilter::MakeBlur(kNormal_SkBlurStyle, fRadius));
SkPath path;
- path.addRect(fOuter, SkPath::kCW_Direction);
- path.addRect(fInner, SkPath::kCW_Direction);
+ path.addRect(fOuter, SkPathDirection::kCW);
+ path.addRect(fInner, SkPathDirection::kCW);
for (int i = 0; i < loops; i++) {
canvas->drawPath(path, paint);
diff --git a/bench/GeometryBench.cpp b/bench/GeometryBench.cpp
index 457151d..abaf678 100644
--- a/bench/GeometryBench.cpp
+++ b/bench/GeometryBench.cpp
@@ -271,7 +271,7 @@
void onDraw(int loops, SkCanvas* canvas) override {
for (int i = 0; i < loops; ++i) {
- fPath.setConvexity(SkPath::kUnknown_Convexity);
+ fPath.setConvexityType(SkPathConvexityType::kUnknown);
(void)fPath.isConvex();
}
}
diff --git a/bench/PathBench.cpp b/bench/PathBench.cpp
index eb4d4a3..c92e88d 100644
--- a/bench/PathBench.cpp
+++ b/bench/PathBench.cpp
@@ -691,7 +691,7 @@
// mimic how Chrome does circles
temp.arcTo(r, 0, 0, false);
- temp.addOval(r, SkPath::kCCW_Direction);
+ temp.addOval(r, SkPathDirection::kCCW);
temp.arcTo(r, 360, 0, true);
temp.close();
@@ -1206,7 +1206,7 @@
fPath.addRRect(SkRRect::MakeRectXY(r, w/8.0f, h/8.0f));
if (forceConcave) {
- fPath.setConvexity(SkPath::kConcave_Convexity);
+ fPath.setConvexityType(SkPathConvexityType::kConcave);
SkASSERT(!fPath.isConvex());
} else {
SkASSERT(fPath.isConvex());
diff --git a/docs/examples/Arc.cpp b/docs/examples/Arc.cpp
index 7b6daaf..bb96907 100644
--- a/docs/examples/Arc.cpp
+++ b/docs/examples/Arc.cpp
@@ -34,7 +34,7 @@
path.arcTo({56, 56}, {32, 56}, 24);
break;
case '5':
- path.arcTo({24, 24}, 0, SkPath::kSmall_ArcSize, SkPath::kCW_Direction, {32, 56});
+ path.arcTo({24, 24}, 0, SkPath::kSmall_ArcSize, SkPathDirection::kCW, {32, 56});
break;
case '6':
path.conicTo({56, 56}, {32, 56}, SK_ScalarRoot2Over2);
diff --git a/docs/examples/Path_ArcSize.cpp b/docs/examples/Path_ArcSize.cpp
index b99a237..1c7b683 100644
--- a/docs/examples/Path_ArcSize.cpp
+++ b/docs/examples/Path_ArcSize.cpp
@@ -7,12 +7,12 @@
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
- for (auto sweep: { SkPath::kCW_Direction, SkPath::kCCW_Direction } ) {
+ for (auto sweep: { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
for (auto arcSize : { SkPath::kSmall_ArcSize, SkPath::kLarge_ArcSize } ) {
SkPath path;
path.moveTo({120, 50});
path.arcTo(70, 40, 30, arcSize, sweep, 156, 100);
- if (SkPath::kCCW_Direction == sweep && SkPath::kLarge_ArcSize == arcSize) {
+ if (SkPathDirection::kCCW == sweep && SkPath::kLarge_ArcSize == arcSize) {
paint.setColor(SK_ColorBLUE);
paint.setStrokeWidth(3);
}
diff --git a/docs/examples/Path_Direction.cpp b/docs/examples/Path_Direction.cpp
index dab6ba9..bbc74a2 100644
--- a/docs/examples/Path_Direction.cpp
+++ b/docs/examples/Path_Direction.cpp
@@ -16,14 +16,14 @@
arrowPath.addPoly(arrow, SK_ARRAY_COUNT(arrow), true);
arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 320, 0,
SkPath1DPathEffect::kRotate_Style));
- for (auto direction : { SkPath::kCW_Direction, SkPath::kCCW_Direction } ) {
+ for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
canvas->drawRect(rect, rectPaint);
for (unsigned start : { 0, 1, 2, 3 } ) {
SkPath path;
path.addRect(rect, direction, start);
canvas->drawPath(path, arrowPaint);
}
- canvas->drawString(SkPath::kCW_Direction == direction ? "CW" : "CCW", rect.centerX(),
+ canvas->drawString(SkPathDirection::kCW == direction ? "CW" : "CCW", rect.centerX(),
rect.centerY(), textPaint);
canvas->translate(120, 0);
}
diff --git a/docs/examples/Path_FillType_a.cpp b/docs/examples/Path_FillType_a.cpp
index 5931cab..caed39a 100644
--- a/docs/examples/Path_FillType_a.cpp
+++ b/docs/examples/Path_FillType_a.cpp
@@ -5,10 +5,10 @@
REG_FIDDLE(Path_FillType_a, 256, 100, false, 0) {
void draw(SkCanvas* canvas) {
SkPath path;
- path.addRect({10, 10, 30, 30}, SkPath::kCW_Direction);
- path.addRect({20, 20, 40, 40}, SkPath::kCW_Direction);
- path.addRect({10, 60, 30, 80}, SkPath::kCW_Direction);
- path.addRect({20, 70, 40, 90}, SkPath::kCCW_Direction);
+ path.addRect({10, 10, 30, 30}, SkPathDirection::kCW);
+ path.addRect({20, 20, 40, 40}, SkPathDirection::kCW);
+ path.addRect({10, 60, 30, 80}, SkPathDirection::kCW);
+ path.addRect({20, 70, 40, 90}, SkPathDirection::kCCW);
SkPaint strokePaint;
strokePaint.setStyle(SkPaint::kStroke_Style);
SkRect clipRect = {0, 0, 51, 100};
diff --git a/docs/examples/Path_FillType_b.cpp b/docs/examples/Path_FillType_b.cpp
index 6064fe0..110117e 100644
--- a/docs/examples/Path_FillType_b.cpp
+++ b/docs/examples/Path_FillType_b.cpp
@@ -6,8 +6,8 @@
REG_FIDDLE(Path_FillType_b, 256, 230, false, 0) {
void draw(SkCanvas* canvas) {
SkPath path;
- path.addRect({20, 10, 80, 70}, SkPath::kCW_Direction);
- path.addRect({40, 30, 100, 90}, SkPath::kCW_Direction);
+ path.addRect({20, 10, 80, 70}, SkPathDirection::kCW);
+ path.addRect({40, 30, 100, 90}, SkPathDirection::kCW);
SkPaint strokePaint;
strokePaint.setStyle(SkPaint::kStroke_Style);
SkRect clipRect = {0, 0, 128, 128};
diff --git a/docs/examples/Path_addCircle.cpp b/docs/examples/Path_addCircle.cpp
index dbea5b7..73cca56 100644
--- a/docs/examples/Path_addCircle.cpp
+++ b/docs/examples/Path_addCircle.cpp
@@ -10,7 +10,7 @@
paint.setStrokeWidth(10);
for (int size = 10; size < 300; size += 20) {
SkPath path;
- path.addCircle(128, 128, size, SkPath::kCW_Direction);
+ path.addCircle(128, 128, size, SkPathDirection::kCW);
canvas->drawPath(path, paint);
}
}
diff --git a/docs/examples/Path_addOval_2.cpp b/docs/examples/Path_addOval_2.cpp
index ba07e54..1af9977 100644
--- a/docs/examples/Path_addOval_2.cpp
+++ b/docs/examples/Path_addOval_2.cpp
@@ -16,7 +16,7 @@
arrowPath.addPoly(arrow, SK_ARRAY_COUNT(arrow), true);
arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 176, 0,
SkPath1DPathEffect::kRotate_Style));
- for (auto direction : { SkPath::kCW_Direction, SkPath::kCCW_Direction } ) {
+ for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
for (unsigned start : { 0, 1, 2, 3 } ) {
SkPath path;
path.addOval(rect, direction, start);
@@ -26,7 +26,7 @@
canvas->translate(64, 0);
}
canvas->translate(-256, 72);
- canvas->drawString(SkPath::kCW_Direction == direction ? "clockwise" : "counterclockwise",
+ canvas->drawString(SkPathDirection::kCW == direction ? "clockwise" : "counterclockwise",
128, 0, textPaint);
}
}
diff --git a/docs/examples/Path_addPath_2.cpp b/docs/examples/Path_addPath_2.cpp
index e00ff7c..8d72404 100644
--- a/docs/examples/Path_addPath_2.cpp
+++ b/docs/examples/Path_addPath_2.cpp
@@ -7,7 +7,7 @@
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
SkPath dest, path;
- path.addOval({-80, 20, 0, 60}, SkPath::kCW_Direction, 1);
+ path.addOval({-80, 20, 0, 60}, SkPathDirection::kCW, 1);
for (int i = 0; i < 2; i++) {
dest.addPath(path, SkPath::kExtend_AddPathMode);
dest.offset(100, 0);
diff --git a/docs/examples/Path_addPath_3.cpp b/docs/examples/Path_addPath_3.cpp
index 2fb4761..b865d2b 100644
--- a/docs/examples/Path_addPath_3.cpp
+++ b/docs/examples/Path_addPath_3.cpp
@@ -7,7 +7,7 @@
SkPaint paint;
paint.setStyle(SkPaint::kStroke_Style);
SkPath dest, path;
- path.addOval({20, 20, 200, 120}, SkPath::kCW_Direction, 1);
+ path.addOval({20, 20, 200, 120}, SkPathDirection::kCW, 1);
for (int i = 0; i < 6; i++) {
SkMatrix matrix;
matrix.reset();
diff --git a/docs/examples/Path_addRRect_2.cpp b/docs/examples/Path_addRRect_2.cpp
index 2f14659..43f7c87 100644
--- a/docs/examples/Path_addRRect_2.cpp
+++ b/docs/examples/Path_addRRect_2.cpp
@@ -13,7 +13,7 @@
canvas->drawPath(path, paint);
for (int start = 0; start < 8; ++start) {
SkPath textPath;
- textPath.addRRect(rrect, SkPath::kCW_Direction, start);
+ textPath.addRRect(rrect, SkPathDirection::kCW, start);
SkPathMeasure pathMeasure(textPath, false);
SkPoint position;
SkVector tangent;
diff --git a/docs/examples/Path_addRect.cpp b/docs/examples/Path_addRect.cpp
index e51b8ef..694e420 100644
--- a/docs/examples/Path_addRect.cpp
+++ b/docs/examples/Path_addRect.cpp
@@ -11,10 +11,10 @@
paint.setStyle(SkPaint::kStroke_Style);
paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
SkPath path;
- path.addRect({20, 20, 100, 100}, SkPath::kCW_Direction);
+ path.addRect({20, 20, 100, 100}, SkPathDirection::kCW);
canvas->drawPath(path, paint);
path.rewind();
- path.addRect({140, 20, 220, 100}, SkPath::kCCW_Direction);
+ path.addRect({140, 20, 220, 100}, SkPathDirection::kCCW);
canvas->drawPath(path, paint);
}
} // END FIDDLE
diff --git a/docs/examples/Path_addRect_2.cpp b/docs/examples/Path_addRect_2.cpp
index 39d1044..798eaae 100644
--- a/docs/examples/Path_addRect_2.cpp
+++ b/docs/examples/Path_addRect_2.cpp
@@ -14,7 +14,7 @@
arrowPath.addPoly(arrow, SK_ARRAY_COUNT(arrow), true);
arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 176, 0,
SkPath1DPathEffect::kRotate_Style));
- for (auto direction : { SkPath::kCW_Direction, SkPath::kCCW_Direction } ) {
+ for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
for (unsigned start : { 0, 1, 2, 3 } ) {
SkPath path;
path.addRect(rect, direction, start);
diff --git a/docs/examples/Path_addRect_3.cpp b/docs/examples/Path_addRect_3.cpp
index 1022328..b5bb877 100644
--- a/docs/examples/Path_addRect_3.cpp
+++ b/docs/examples/Path_addRect_3.cpp
@@ -10,7 +10,7 @@
float intervals[] = { 5, 21.75f };
paint.setStyle(SkPaint::kStroke_Style);
paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
- for (auto direction : { SkPath::kCW_Direction, SkPath::kCCW_Direction } ) {
+ for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
SkPath path;
path.addRect(20, 20, 100, 100, direction);
canvas->drawPath(path, paint);
diff --git a/docs/examples/Path_arcTo_4.cpp b/docs/examples/Path_arcTo_4.cpp
index 8de4927..37395d7 100644
--- a/docs/examples/Path_arcTo_4.cpp
+++ b/docs/examples/Path_arcTo_4.cpp
@@ -7,12 +7,12 @@
SkPaint paint;
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
- for (auto sweep: { SkPath::kCW_Direction, SkPath::kCCW_Direction } ) {
+ for (auto sweep: { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
for (auto arcSize : { SkPath::kSmall_ArcSize, SkPath::kLarge_ArcSize } ) {
SkPath path;
path.moveTo({120, 50});
path.arcTo(70, 40, 30, arcSize, sweep, 120.1f, 50);
- if (SkPath::kCCW_Direction == sweep && SkPath::kLarge_ArcSize == arcSize) {
+ if (SkPathDirection::kCCW == sweep && SkPath::kLarge_ArcSize == arcSize) {
paint.setColor(SK_ColorBLUE);
paint.setStrokeWidth(3);
}
diff --git a/docs/examples/Path_getConvexity.cpp b/docs/examples/Path_getConvexity.cpp
index ef09116..9f5987b 100644
--- a/docs/examples/Path_getConvexity.cpp
+++ b/docs/examples/Path_getConvexity.cpp
@@ -6,8 +6,8 @@
void draw(SkCanvas* canvas) {
auto debugster = [](const char* prefix, const SkPath& path) -> void {
SkDebugf("%s path convexity is %s\n", prefix,
- SkPath::kUnknown_Convexity == path.getConvexity() ? "unknown" :
- SkPath::kConvex_Convexity == path.getConvexity() ? "convex" : "concave"); };
+ SkPathConvexityType::kUnknown == path.getConvexityType() ? "unknown" :
+ SkPathConvexityType::kConvex == path.getConvexityType() ? "convex" : "concave"); };
SkPath path;
debugster("initial", path);
path.lineTo(50, 0);
diff --git a/docs/examples/Path_getConvexityOrUnknown.cpp b/docs/examples/Path_getConvexityOrUnknown.cpp
index b03c8b4..4aca799 100644
--- a/docs/examples/Path_getConvexityOrUnknown.cpp
+++ b/docs/examples/Path_getConvexityOrUnknown.cpp
@@ -6,17 +6,17 @@
void draw(SkCanvas* canvas) {
auto debugster = [](const char* prefix, const SkPath& path) -> void {
SkDebugf("%s path convexity is %s\n", prefix,
- SkPath::kUnknown_Convexity == path.getConvexityOrUnknown() ? "unknown" :
- SkPath::kConvex_Convexity == path.getConvexityOrUnknown() ? "convex" : "concave"); };
+ SkPathConvexityType::kUnknown == path.getConvexityTypeOrUnknown() ? "unknown" :
+ SkPathConvexityType::kConvex == path.getConvexityTypeOrUnknown() ? "convex" : "concave"); };
SkPath path;
debugster("initial", path);
path.lineTo(50, 0);
debugster("first line", path);
- path.getConvexity();
+ path.getConvexityType();
path.lineTo(50, 50);
debugster("second line", path);
path.lineTo(100, 50);
- path.getConvexity();
+ path.getConvexityType();
debugster("third line", path);
}
} // END FIDDLE
diff --git a/docs/examples/Path_isRect.cpp b/docs/examples/Path_isRect.cpp
index 9d9a621..c099bb9 100644
--- a/docs/examples/Path_isRect.cpp
+++ b/docs/examples/Path_isRect.cpp
@@ -6,12 +6,12 @@
void draw(SkCanvas* canvas) {
auto debugster = [](const char* prefix, const SkPath& path) -> void {
SkRect rect;
- SkPath::Direction direction;
+ SkPathDirection direction;
bool isClosed;
path.isRect(&rect, &isClosed, &direction) ?
SkDebugf("%s is rect (%g, %g, %g, %g); is %s" "closed; direction %s\n", prefix,
rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, isClosed ? "" : "not ",
- SkPath::kCW_Direction == direction ? "CW" : "CCW") :
+ SkPathDirection::kCW == direction ? "CW" : "CCW") :
SkDebugf("%s is not rect\n", prefix);
};
SkPath path;
diff --git a/docs/examples/Path_notequal_operator.cpp b/docs/examples/Path_notequal_operator.cpp
index dfba8c2..dcd56ef 100644
--- a/docs/examples/Path_notequal_operator.cpp
+++ b/docs/examples/Path_notequal_operator.cpp
@@ -13,8 +13,8 @@
one.addRect({10, 20, 30, 40});
two.addRect({10, 20, 30, 40});
debugster("add rect", one, two);
- one.setConvexity(SkPath::kConcave_Convexity);
+ one.setConvexityType(SkPathConvexityType::kConcave);
debugster("setConvexity", one, two);
- SkDebugf("convexity %c=\n", one.getConvexity() == two.getConvexity() ? '=' : '!');
+ SkDebugf("convexity %c=\n", one.getConvexityType() == two.getConvexityType() ? '=' : '!');
}
} // END FIDDLE
diff --git a/docs/examples/Path_rArcTo.cpp b/docs/examples/Path_rArcTo.cpp
index 8244674..8eccb5b 100644
--- a/docs/examples/Path_rArcTo.cpp
+++ b/docs/examples/Path_rArcTo.cpp
@@ -9,7 +9,7 @@
const SkPoint starts[] = {{20, 20}, {120, 20}, {70, 60}};
for (auto start : starts) {
path.moveTo(start.fX, start.fY);
- path.rArcTo(20, 20, 0, SkPath::kSmall_ArcSize, SkPath::kCCW_Direction, 60, 0);
+ path.rArcTo(20, 20, 0, SkPath::kSmall_ArcSize, SkPathDirection::kCCW, 60, 0);
}
canvas->drawPath(path, paint);
}
diff --git a/docs/examples/Path_rMoveTo.cpp b/docs/examples/Path_rMoveTo.cpp
index fd4e06d..f59b579 100644
--- a/docs/examples/Path_rMoveTo.cpp
+++ b/docs/examples/Path_rMoveTo.cpp
@@ -6,7 +6,7 @@
REG_FIDDLE(Path_rMoveTo, 256, 100, false, 0) {
void draw(SkCanvas* canvas) {
SkPath path;
- path.addRect({20, 20, 80, 80}, SkPath::kCW_Direction, 2);
+ path.addRect({20, 20, 80, 80}, SkPathDirection::kCW, 2);
path.rMoveTo(25, 2);
SkVector arrow[] = {{0, -4}, {-20, 0}, {0, -3}, {-5, 5}, {5, 5}, {0, -3}, {20, 0}};
for (unsigned i = 0; i < SK_ARRAY_COUNT(arrow); ++i) {
diff --git a/docs/examples/Path_setConvexity.cpp b/docs/examples/Path_setConvexity.cpp
index 16e5c9f..7fe5cee 100644
--- a/docs/examples/Path_setConvexity.cpp
+++ b/docs/examples/Path_setConvexity.cpp
@@ -6,15 +6,15 @@
void draw(SkCanvas* canvas) {
auto debugster = [](const char* prefix, const SkPath& path) -> void {
SkDebugf("%s path convexity is %s\n", prefix,
- SkPath::kUnknown_Convexity == path.getConvexity() ? "unknown" :
- SkPath::kConvex_Convexity == path.getConvexity() ? "convex" : "concave"); };
+ SkPathConvexityType::kUnknown == path.getConvexityTypeOrUnknown() ? "unknown" :
+ SkPathConvexityType::kConvex == path.getConvexityTypeOrUnknown() ? "convex" : "concave"); };
SkPoint quad[] = {{70, 70}, {20, 20}, {120, 20}, {120, 120}};
SkPath path;
path.addPoly(quad, SK_ARRAY_COUNT(quad), true);
debugster("initial", path);
- path.setConvexity(SkPath::kConcave_Convexity);
+ path.setConvexityType(SkPathConvexityType::kConcave);
debugster("after forcing concave", path);
- path.setConvexity(SkPath::kUnknown_Convexity);
+ path.setConvexityType(SkPathConvexityType::kUnknown);
debugster("after forcing unknown", path);
}
} // END FIDDLE
diff --git a/docs/examples/RRect_setRectRadii.cpp b/docs/examples/RRect_setRectRadii.cpp
index 2004e5f..86f35c7 100644
--- a/docs/examples/RRect_setRectRadii.cpp
+++ b/docs/examples/RRect_setRectRadii.cpp
@@ -15,10 +15,10 @@
SkRRect rrect;
SkVector corners[] = {{15, 17}, {17, 19}, {19, 15}, {15, 15}};
rrect.setRectRadii({20, 20, 100, 100}, corners);
- path.addRRect(rrect, SkPath::kCW_Direction);
+ path.addRRect(rrect, SkPathDirection::kCW);
canvas->drawPath(path, paint);
path.rewind();
- path.addRRect(rrect, SkPath::kCCW_Direction, 1);
+ path.addRRect(rrect, SkPathDirection::kCCW, 1);
canvas->translate(120, 0);
canvas->drawPath(path, paint);
}
diff --git a/fuzz/FuzzCommon.cpp b/fuzz/FuzzCommon.cpp
index 3a2108e..0de7ce0 100644
--- a/fuzz/FuzzCommon.cpp
+++ b/fuzz/FuzzCommon.cpp
@@ -52,7 +52,7 @@
SkMatrix m;
SkRRect rr;
SkRect r;
- SkPath::Direction dir;
+ SkPathDirection dir;
unsigned int ui;
SkScalar a, b, c, d, e, f;
switch (op) {
@@ -112,32 +112,32 @@
case 13:
fuzz_nice_rect(fuzz, &r);
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
path->addRect(r, dir);
break;
case 14:
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
fuzz_nice_rect(fuzz, &r);
fuzz->next(&ui);
path->addRect(r, dir, ui);
break;
case 15:
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
fuzz_nice_rect(fuzz, &r);
path->addOval(r, dir);
break;
case 16:
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
fuzz_nice_rect(fuzz, &r);
fuzz->next(&ui);
path->addOval(r, dir, ui);
break;
case 17:
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
fuzz_nice_float(fuzz, &a, &b, &c);
path->addCircle(a, b, c, dir);
break;
@@ -150,18 +150,18 @@
fuzz_nice_float(fuzz, &a, &b);
fuzz_nice_rect(fuzz, &r);
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
path->addRoundRect(r, a, b, dir);
break;
case 20:
FuzzNiceRRect(fuzz, &rr);
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
path->addRRect(rr, dir);
break;
case 21:
fuzz->nextRange(&ui, 0, 1);
- dir = static_cast<SkPath::Direction>(ui);
+ dir = static_cast<SkPathDirection>(ui);
FuzzNiceRRect(fuzz, &rr);
path->addRRect(rr, dir, ui);
break;
diff --git a/gm/aaa.cpp b/gm/aaa.cpp
index d056b0b..4ebd25e 100644
--- a/gm/aaa.cpp
+++ b/gm/aaa.cpp
@@ -64,7 +64,7 @@
SkBits2Float(0x4344f079), SkBits2Float(0x4397e900), SkBits2Float(0x3f3504f3));
path.close();
// Manually setting convexity is required. Otherwise, this path will be considered concave.
- path.setConvexity(SkPath::kConvex_Convexity);
+ path.setConvexityType(SkPathConvexityType::kConvex);
canvas->drawPath(path, p);
// skbug.com/7573
diff --git a/gm/arcto.cpp b/gm/arcto.cpp
index f28d86c..03942fe 100644
--- a/gm/arcto.cpp
+++ b/gm/arcto.cpp
@@ -79,13 +79,13 @@
SkScalar ovalHeight = oval.height() / oHeight;
svgArc.moveTo(oval.fLeft, oval.fTop);
svgArc.arcTo(oval.width() / 2, ovalHeight, SkIntToScalar(angle), SkPath::kSmall_ArcSize,
- SkPath::kCW_Direction, oval.right(), oval.bottom());
+ SkPathDirection::kCW, oval.right(), oval.bottom());
canvas->drawPath(svgArc, paint);
svgArc.reset();
svgArc.moveTo(oval.fLeft + 100, oval.fTop + 100);
svgArc.arcTo(oval.width() / 2, ovalHeight, SkIntToScalar(angle), SkPath::kLarge_ArcSize,
- SkPath::kCCW_Direction, oval.right(), oval.bottom() + 100);
+ SkPathDirection::kCCW, oval.right(), oval.bottom() + 100);
canvas->drawPath(svgArc, paint);
oval.offset(50, 0);
svgArc.reset();
@@ -114,12 +114,12 @@
paint.setStrokeCap(SkPaint::kRound_Cap);
SkPath path;
path.moveTo(100, 100);
- path.arcTo(0, 0, 0, SkPath::kLarge_ArcSize, SkPath::kCW_Direction, 200, 200);
+ path.arcTo(0, 0, 0, SkPath::kLarge_ArcSize, SkPathDirection::kCW, 200, 200);
canvas->drawPath(path, paint);
path.reset();
path.moveTo(200, 100);
- path.arcTo(80, 80, 0, SkPath::kLarge_ArcSize, SkPath::kCW_Direction, 200, 100);
+ path.arcTo(80, 80, 0, SkPath::kLarge_ArcSize, SkPathDirection::kCW, 200, 100);
canvas->drawPath(path, paint);
}
diff --git a/gm/bigblurs.cpp b/gm/bigblurs.cpp
index ff12b6b..6436c85 100644
--- a/gm/bigblurs.cpp
+++ b/gm/bigblurs.cpp
@@ -52,7 +52,7 @@
SkPath rectori;
rectori.addRect(bigRect);
- rectori.addRect(insetRect, SkPath::kCCW_Direction);
+ rectori.addRect(insetRect, SkPathDirection::kCCW);
// The blur extends 3*kSigma out from the big rect.
// Offset the close-up windows so we get the entire blur
diff --git a/gm/blurs.cpp b/gm/blurs.cpp
index 3aef017..e6f6910 100644
--- a/gm/blurs.cpp
+++ b/gm/blurs.cpp
@@ -89,8 +89,8 @@
SkRect outer = SkRect::MakeXYWH(10.125f, 10.125f, 100.125f, 100);
SkRect inner = SkRect::MakeXYWH(20.25f, 20.125f, 80, 80);
SkPath path;
- path.addRect(outer, SkPath::kCW_Direction);
- path.addRect(inner, SkPath::kCCW_Direction);
+ path.addRect(outer, SkPathDirection::kCW);
+ path.addRect(inner, SkPathDirection::kCCW);
canvas->drawPath(path, paint);
// important to translate by a factional amount to exercise a different "phase"
@@ -107,8 +107,8 @@
SkRect outer = SkRect::MakeXYWH(10, 110, 100, 100);
SkRect inner = SkRect::MakeXYWH(50, 150, 10, 10);
SkPath path;
- path.addRect(outer, SkPath::kCW_Direction);
- path.addRect(inner, SkPath::kCW_Direction);
+ path.addRect(outer, SkPathDirection::kCW);
+ path.addRect(inner, SkPathDirection::kCW);
canvas->drawPath(path, paint);
SkScalar dx = SkScalarRoundToScalar(path.getBounds().width()) + 40 + 0.25f;
diff --git a/gm/circularclips.cpp b/gm/circularclips.cpp
index 025b693..b213838 100644
--- a/gm/circularclips.cpp
+++ b/gm/circularclips.cpp
@@ -28,8 +28,8 @@
fY = 50;
fR = 40;
- fCircle1.addCircle(fX1, fY, fR, SkPath::kCW_Direction);
- fCircle2.addCircle(fX2, fY, fR, SkPath::kCW_Direction);
+ fCircle1.addCircle(fX1, fY, fR, SkPathDirection::kCW);
+ fCircle2.addCircle(fX2, fY, fR, SkPathDirection::kCW);
}
diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp
index 2fa2adf..1936dfc 100644
--- a/gm/convex_all_line_paths.cpp
+++ b/gm/convex_all_line_paths.cpp
@@ -183,7 +183,7 @@
SkISize onISize() override { return SkISize::Make(kGMWidth, kGMHeight); }
bool runAsBench() const override { return true; }
- static SkPath GetPath(int index, SkPath::Direction dir) {
+ static SkPath GetPath(int index, SkPathDirection dir) {
std::unique_ptr<SkPoint[]> data(nullptr);
const SkPoint* points;
int numPts;
@@ -238,7 +238,7 @@
SkPath path;
- if (SkPath::kCW_Direction == dir) {
+ if (SkPathDirection::kCW == dir) {
path.moveTo(points[0]);
for (int i = 1; i < numPts; ++i) {
path.lineTo(points[i]);
@@ -273,7 +273,7 @@
SkPoint center;
{
- SkPath path = GetPath(index, SkPath::kCW_Direction);
+ SkPath path = GetPath(index, SkPathDirection::kCW);
if (offset->fX+path.getBounds().width() > kGMWidth) {
offset->fX = 0;
offset->fY += kMaxPathHeight;
@@ -290,7 +290,7 @@
}
const SkColor colors[2] = { SK_ColorBLACK, SK_ColorWHITE };
- const SkPath::Direction dirs[2] = { SkPath::kCW_Direction, SkPath::kCCW_Direction };
+ const SkPathDirection dirs[2] = { SkPathDirection::kCW, SkPathDirection::kCCW };
const float scales[] = { 1.0f, 0.75f, 0.5f, 0.25f, 0.1f, 0.01f, 0.001f };
const SkPaint::Join joins[3] = { SkPaint::kRound_Join,
SkPaint::kBevel_Join,
diff --git a/gm/convexpaths.cpp b/gm/convexpaths.cpp
index a92508f..0fa0e34 100644
--- a/gm/convexpaths.cpp
+++ b/gm/convexpaths.cpp
@@ -66,36 +66,36 @@
fPaths.push_back().addRect(0, 0,
100 * SK_Scalar1, 100 * SK_Scalar1,
- SkPath::kCW_Direction);
+ SkPathDirection::kCW);
fPaths.push_back().addRect(0, 0,
100 * SK_Scalar1, 100 * SK_Scalar1,
- SkPath::kCCW_Direction);
+ SkPathDirection::kCCW);
fPaths.push_back().addCircle(50 * SK_Scalar1, 50 * SK_Scalar1,
- 50 * SK_Scalar1, SkPath::kCW_Direction);
+ 50 * SK_Scalar1, SkPathDirection::kCW);
fPaths.push_back().addOval(SkRect::MakeXYWH(0, 0,
50 * SK_Scalar1,
100 * SK_Scalar1),
- SkPath::kCW_Direction);
+ SkPathDirection::kCW);
fPaths.push_back().addOval(SkRect::MakeXYWH(0, 0,
100 * SK_Scalar1,
5 * SK_Scalar1),
- SkPath::kCCW_Direction);
+ SkPathDirection::kCCW);
fPaths.push_back().addOval(SkRect::MakeXYWH(0, 0,
SK_Scalar1,
100 * SK_Scalar1),
- SkPath::kCCW_Direction);
+ SkPathDirection::kCCW);
fPaths.push_back().addRoundRect(SkRect::MakeXYWH(0, 0,
SK_Scalar1 * 100,
SK_Scalar1 * 100),
40 * SK_Scalar1, 20 * SK_Scalar1,
- SkPath::kCW_Direction);
+ SkPathDirection::kCW);
// large number of points
enum {
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 132fd5b..e349bbf 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -208,8 +208,8 @@
SkPath path;
const float baseline_offset = -5;
- const SkPath::Direction dirs[] = {
- SkPath::kCW_Direction, SkPath::kCCW_Direction,
+ const SkPathDirection dirs[] = {
+ SkPathDirection::kCW, SkPathDirection::kCCW,
};
for (auto d : dirs) {
path.reset();
diff --git a/gm/inversepaths.cpp b/gm/inversepaths.cpp
index 0726983..7ddf088 100644
--- a/gm/inversepaths.cpp
+++ b/gm/inversepaths.cpp
@@ -34,7 +34,7 @@
static SkPath generate_circle(SkScalar cx, SkScalar cy, SkScalar d) {
SkPath path;
- path.addCircle(cx, cy, d/2, SkPath::kCW_Direction);
+ path.addCircle(cx, cy, d/2, SkPathDirection::kCW);
return path;
}
diff --git a/gm/nested.cpp b/gm/nested.cpp
index 859077f..9c1370c 100644
--- a/gm/nested.cpp
+++ b/gm/nested.cpp
@@ -53,7 +53,7 @@
kShapeCount
};
- static void AddShape(SkPath* path, const SkRect& rect, Shapes shape, SkPath::Direction dir) {
+ static void AddShape(SkPath* path, const SkRect& rect, Shapes shape, SkPathDirection dir) {
switch (shape) {
case kRect_Shape:
path->addRect(rect, dir);
@@ -105,9 +105,9 @@
for (size_t innerRect = 0; innerRect < SK_ARRAY_COUNT(innerRects); ++innerRect) {
SkPath path;
- AddShape(&path, outerRect, (Shapes) outerShape, SkPath::kCW_Direction);
+ AddShape(&path, outerRect, (Shapes) outerShape, SkPathDirection::kCW);
AddShape(&path, innerRects[innerRect], (Shapes) innerShape,
- SkPath::kCCW_Direction);
+ SkPathDirection::kCCW);
canvas->save();
if (fFlipped) {
diff --git a/gm/pathcontourstart.cpp b/gm/pathcontourstart.cpp
index 430e59b..7d3ff48 100644
--- a/gm/pathcontourstart.cpp
+++ b/gm/pathcontourstart.cpp
@@ -55,19 +55,19 @@
void onDraw(SkCanvas* canvas) override {
- drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) {
+ drawDirs(canvas, [](const SkRect& rect, SkPathDirection dir, unsigned startIndex) {
SkPath path;
path.addRect(rect, dir, startIndex);
return path;
});
- drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) {
+ drawDirs(canvas, [](const SkRect& rect, SkPathDirection dir, unsigned startIndex) {
SkPath path;
path.addOval(rect, dir, startIndex);
return path;
});
- drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) {
+ drawDirs(canvas, [](const SkRect& rect, SkPathDirection dir, unsigned startIndex) {
SkRRect rrect;
const SkVector radii[4] = { {15, 15}, {15, 15}, {15, 15}, {15, 15}};
rrect.setRectRadii(rect, radii);
@@ -77,7 +77,7 @@
return path;
});
- drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) {
+ drawDirs(canvas, [](const SkRect& rect, SkPathDirection dir, unsigned startIndex) {
SkRRect rrect;
rrect.setRect(rect);
@@ -86,7 +86,7 @@
return path;
});
- drawDirs(canvas, [](const SkRect& rect, SkPath::Direction dir, unsigned startIndex) {
+ drawDirs(canvas, [](const SkRect& rect, SkPathDirection dir, unsigned startIndex) {
SkRRect rrect;
rrect.setOval(rect);
@@ -105,15 +105,15 @@
SkRect fRect;
void drawDirs(SkCanvas* canvas,
- SkPath (*makePath)(const SkRect&, SkPath::Direction, unsigned)) const {
- drawOneColumn(canvas, SkPath::kCW_Direction, makePath);
+ SkPath (*makePath)(const SkRect&, SkPathDirection, unsigned)) const {
+ drawOneColumn(canvas, SkPathDirection::kCW, makePath);
canvas->translate(kImageWidth / 10, 0);
- drawOneColumn(canvas, SkPath::kCCW_Direction, makePath);
+ drawOneColumn(canvas, SkPathDirection::kCCW, makePath);
canvas->translate(kImageWidth / 10, 0);
}
- void drawOneColumn(SkCanvas* canvas, SkPath::Direction dir,
- SkPath (*makePath)(const SkRect&, SkPath::Direction, unsigned)) const {
+ void drawOneColumn(SkCanvas* canvas, SkPathDirection dir,
+ SkPath (*makePath)(const SkRect&, SkPathDirection, unsigned)) const {
SkAutoCanvasRestore acr(canvas, true);
for (unsigned i = 0; i < 8; ++i) {
diff --git a/gm/patheffects.cpp b/gm/patheffects.cpp
index 33a6841..37715f1 100644
--- a/gm/patheffects.cpp
+++ b/gm/patheffects.cpp
@@ -148,9 +148,9 @@
path.reset();
SkRect r = { 0, 0, 250, 120 };
- path.addOval(r, SkPath::kCW_Direction);
+ path.addOval(r, SkPathDirection::kCW);
r.inset(50, 50);
- path.addRect(r, SkPath::kCCW_Direction);
+ path.addRect(r, SkPathDirection::kCCW);
canvas->translate(320, 20);
for (size_t i = 0; i < SK_ARRAY_COUNT(gPE2); i++) {
diff --git a/gm/pathinterior.cpp b/gm/pathinterior.cpp
index b152f72..8480b22 100644
--- a/gm/pathinterior.cpp
+++ b/gm/pathinterior.cpp
@@ -76,8 +76,8 @@
for (int innerCW = 0; innerCW <= 1; ++innerCW) {
SkPath path;
path.setFillType(doEvenOdd ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType);
- SkPath::Direction outerDir = outerCW ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
- SkPath::Direction innerDir = innerCW ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
+ SkPathDirection outerDir = outerCW ? SkPathDirection::kCW : SkPathDirection::kCCW;
+ SkPathDirection innerDir = innerCW ? SkPathDirection::kCW : SkPathDirection::kCCW;
SkRect r = insetFirst ? inset(rect) : rect;
if (outerRR) {
diff --git a/gm/polygonoffset.cpp b/gm/polygonoffset.cpp
index 9cdd9ea..9f906ac 100644
--- a/gm/polygonoffset.cpp
+++ b/gm/polygonoffset.cpp
@@ -23,12 +23,12 @@
#include <functional>
#include <memory>
-static void create_ngon(int n, SkPoint* pts, SkScalar w, SkScalar h, SkPath::Direction dir) {
+static void create_ngon(int n, SkPoint* pts, SkScalar w, SkScalar h, SkPathDirection dir) {
float angleStep = 360.0f / n, angle = 0.0f;
if ((n % 2) == 1) {
angle = angleStep/2.0f;
}
- if (SkPath::kCCW_Direction == dir) {
+ if (SkPathDirection::kCCW == dir) {
angle = -angle;
angleStep = -angleStep;
}
@@ -438,13 +438,13 @@
SkISize onISize() override { return SkISize::Make(kGMWidth, kGMHeight); }
bool runAsBench() const override { return true; }
- static void GetConvexPolygon(int index, SkPath::Direction dir,
+ static void GetConvexPolygon(int index, SkPathDirection dir,
std::unique_ptr<SkPoint[]>* data, int* numPts) {
if (index < (int)SK_ARRAY_COUNT(PolygonOffsetData::gConvexPoints)) {
// manually specified
*numPts = (int)PolygonOffsetData::gConvexSizes[index];
data->reset(new SkPoint[*numPts]);
- if (SkPath::kCW_Direction == dir) {
+ if (SkPathDirection::kCW == dir) {
for (int i = 0; i < *numPts; ++i) {
(*data)[i] = PolygonOffsetData::gConvexPoints[index][i];
}
@@ -473,13 +473,13 @@
}
}
- static void GetSimplePolygon(int index, SkPath::Direction dir,
+ static void GetSimplePolygon(int index, SkPathDirection dir,
std::unique_ptr<SkPoint[]>* data, int* numPts) {
if (index < (int)SK_ARRAY_COUNT(PolygonOffsetData::gSimplePoints)) {
// manually specified
*numPts = (int)PolygonOffsetData::gSimpleSizes[index];
data->reset(new SkPoint[*numPts]);
- if (SkPath::kCW_Direction == dir) {
+ if (SkPathDirection::kCW == dir) {
for (int i = 0; i < *numPts; ++i) {
(*data)[i] = PolygonOffsetData::gSimplePoints[index][i];
}
@@ -515,9 +515,9 @@
std::unique_ptr<SkPoint[]> data(nullptr);
int numPts;
if (fConvexOnly) {
- GetConvexPolygon(index, SkPath::kCW_Direction, &data, &numPts);
+ GetConvexPolygon(index, SkPathDirection::kCW, &data, &numPts);
} else {
- GetSimplePolygon(index, SkPath::kCW_Direction, &data, &numPts);
+ GetSimplePolygon(index, SkPathDirection::kCW, &data, &numPts);
}
bounds.setBounds(data.get(), numPts);
if (!fConvexOnly) {
@@ -531,7 +531,7 @@
offset->fX += bounds.width();
}
- const SkPath::Direction dirs[2] = { SkPath::kCW_Direction, SkPath::kCCW_Direction };
+ const SkPathDirection dirs[2] = { SkPathDirection::kCW, SkPathDirection::kCCW };
const float insets[] = { 5, 10, 15, 20, 25, 30, 35, 40 };
const float offsets[] = { 2, 5, 9, 14, 20, 27, 35, 44, -2, -5, -9 };
const SkColor colors[] = { 0xFF901313, 0xFF8D6214, 0xFF698B14, 0xFF1C8914,
diff --git a/gm/strokefill.cpp b/gm/strokefill.cpp
index 9b0bb04..0533024 100644
--- a/gm/strokefill.cpp
+++ b/gm/strokefill.cpp
@@ -283,24 +283,24 @@
SkPath path;
path.setFillType(SkPath::kWinding_FillType);
- path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction);
- path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCCW_Direction);
+ path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(50), SkPathDirection::kCW);
+ path.addCircle(x, y + SkIntToScalar(200), SkIntToScalar(40), SkPathDirection::kCCW);
canvas->drawPath(path, paint);
SkPath path2;
path2.setFillType(SkPath::kWinding_FillType);
- path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCCW_Direction);
- path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToScalar(40), SkPath::kCW_Direction);
+ path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToScalar(50), SkPathDirection::kCCW);
+ path2.addCircle(x + SkIntToScalar(120), y + SkIntToScalar(200), SkIntToScalar(40), SkPathDirection::kCW);
canvas->drawPath(path2, paint);
path2.reset();
- path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCCW_Direction);
+ path2.addCircle(x + SkIntToScalar(240), y + SkIntToScalar(200), SkIntToScalar(50), SkPathDirection::kCCW);
canvas->drawPath(path2, paint);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCCW_FirstDirection));
path2.reset();
SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path2, nullptr));
- path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToScalar(50), SkPath::kCW_Direction);
+ path2.addCircle(x + SkIntToScalar(360), y + SkIntToScalar(200), SkIntToScalar(50), SkPathDirection::kCW);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path2, SkPathPriv::kCW_FirstDirection));
canvas->drawPath(path2, paint);
@@ -308,25 +308,25 @@
SkIntToScalar(100), SkIntToScalar(100));
SkPath path3;
path3.setFillType(SkPath::kWinding_FillType);
- path3.addRect(r, SkPath::kCW_Direction);
+ path3.addRect(r, SkPathDirection::kCW);
r.inset(SkIntToScalar(10), SkIntToScalar(10));
- path3.addRect(r, SkPath::kCCW_Direction);
+ path3.addRect(r, SkPathDirection::kCCW);
canvas->drawPath(path3, paint);
r = SkRect::MakeXYWH(x + SkIntToScalar(70), y + SkIntToScalar(280),
SkIntToScalar(100), SkIntToScalar(100));
SkPath path4;
path4.setFillType(SkPath::kWinding_FillType);
- path4.addRect(r, SkPath::kCCW_Direction);
+ path4.addRect(r, SkPathDirection::kCCW);
r.inset(SkIntToScalar(10), SkIntToScalar(10));
- path4.addRect(r, SkPath::kCW_Direction);
+ path4.addRect(r, SkPathDirection::kCW);
canvas->drawPath(path4, paint);
r = SkRect::MakeXYWH(x + SkIntToScalar(190), y + SkIntToScalar(280),
SkIntToScalar(100), SkIntToScalar(100));
path4.reset();
SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr));
- path4.addRect(r, SkPath::kCCW_Direction);
+ path4.addRect(r, SkPathDirection::kCCW);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCCW_FirstDirection));
path4.moveTo(0, 0); // test for crbug.com/247770
canvas->drawPath(path4, paint);
@@ -335,7 +335,7 @@
SkIntToScalar(100), SkIntToScalar(100));
path4.reset();
SkASSERT(!SkPathPriv::CheapComputeFirstDirection(path4, nullptr));
- path4.addRect(r, SkPath::kCW_Direction);
+ path4.addRect(r, SkPathDirection::kCW);
SkASSERT(SkPathPriv::CheapIsFirstDirection(path4, SkPathPriv::kCW_FirstDirection));
path4.moveTo(0, 0); // test for crbug.com/247770
canvas->drawPath(path4, paint);
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index a2e7bfd..9b3b1a4 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -344,42 +344,42 @@
class Strokes3GM : public skiagm::GM {
static void make0(SkPath* path, const SkRect& bounds, SkString* title) {
- path->addRect(bounds, SkPath::kCW_Direction);
- path->addRect(inset(bounds), SkPath::kCW_Direction);
+ path->addRect(bounds, SkPathDirection::kCW);
+ path->addRect(inset(bounds), SkPathDirection::kCW);
title->set("CW CW");
}
static void make1(SkPath* path, const SkRect& bounds, SkString* title) {
- path->addRect(bounds, SkPath::kCW_Direction);
- path->addRect(inset(bounds), SkPath::kCCW_Direction);
+ path->addRect(bounds, SkPathDirection::kCW);
+ path->addRect(inset(bounds), SkPathDirection::kCCW);
title->set("CW CCW");
}
static void make2(SkPath* path, const SkRect& bounds, SkString* title) {
- path->addOval(bounds, SkPath::kCW_Direction);
- path->addOval(inset(bounds), SkPath::kCW_Direction);
+ path->addOval(bounds, SkPathDirection::kCW);
+ path->addOval(inset(bounds), SkPathDirection::kCW);
title->set("CW CW");
}
static void make3(SkPath* path, const SkRect& bounds, SkString* title) {
- path->addOval(bounds, SkPath::kCW_Direction);
- path->addOval(inset(bounds), SkPath::kCCW_Direction);
+ path->addOval(bounds, SkPathDirection::kCW);
+ path->addOval(inset(bounds), SkPathDirection::kCCW);
title->set("CW CCW");
}
static void make4(SkPath* path, const SkRect& bounds, SkString* title) {
- path->addRect(bounds, SkPath::kCW_Direction);
+ path->addRect(bounds, SkPathDirection::kCW);
SkRect r = bounds;
r.inset(bounds.width() / 10, -bounds.height() / 10);
- path->addOval(r, SkPath::kCW_Direction);
+ path->addOval(r, SkPathDirection::kCW);
title->set("CW CW");
}
static void make5(SkPath* path, const SkRect& bounds, SkString* title) {
- path->addRect(bounds, SkPath::kCW_Direction);
+ path->addRect(bounds, SkPathDirection::kCW);
SkRect r = bounds;
r.inset(bounds.width() / 10, -bounds.height() / 10);
- path->addOval(r, SkPath::kCCW_Direction);
+ path->addOval(r, SkPathDirection::kCCW);
title->set("CW CCW");
}
diff --git a/gn/flutter_defines.gni b/gn/flutter_defines.gni
index 97be7d8..4ab268c 100644
--- a/gn/flutter_defines.gni
+++ b/gn/flutter_defines.gni
@@ -13,6 +13,7 @@
"SK_DISABLE_AAA",
# API staging
+ "SK_SUPPORT_LEGACY_PATH_DIRECTION_ENUM",
# Flutter doesn't deserialize anything.
"SK_DISABLE_READBUFFER",
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 8f69d0e..da5bda1 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -41,6 +41,7 @@
class SK_API SkPath {
public:
+#ifdef SK_SUPPORT_LEGACY_PATH_DIRECTION_ENUM
/** \enum SkPath::Direction
Direction describes whether contour is clockwise or counterclockwise.
When SkPath contains multiple overlapping contours, Direction together with
@@ -58,6 +59,7 @@
kCW_Direction = static_cast<int>(SkPathDirection::kCW),
kCCW_Direction = static_cast<int>(SkPathDirection::kCCW)
};
+#endif
/** Constructs an empty SkPath. By default, SkPath has no verbs, no SkPoint, and no weights.
SkPath::FillType is set to kWinding_FillType.
@@ -211,6 +213,44 @@
fFillType ^= 2;
}
+ /** Returns the comvexity type, computing if needed. Never returns kUnknown.
+ @return path's convexity type (convex or concave)
+ */
+ SkPathConvexityType getConvexityType() const {
+ SkPathConvexityType convexity = this->getConvexityTypeOrUnknown();
+ if (convexity != SkPathConvexityType::kUnknown) {
+ return convexity;
+ }
+ return this->internalGetConvexity();
+ }
+
+ /** If the path's convexity is already known, return it, else return kUnknown.
+ * If you always want to know the convexity, even if that means having to compute it,
+ * call getConvexitytype().
+ *
+ * @return known convexity, or kUnknown
+ */
+ SkPathConvexityType getConvexityTypeOrUnknown() const {
+ return (SkPathConvexityType)fConvexity.load(std::memory_order_relaxed);
+ }
+
+ /** Stores a convexity type for this path. This is what will be returned if
+ * getConvexityTypeOrUnknown() is called. If you pass kUnknown, then if getContexityType()
+ * is called, the real convexity will be computed.
+ *
+ * @param convexity one of: kUnknown, kConvex, or kConcave
+ *
+ * example: https://fiddle.skia.org/c/@Path_setConvexity
+ */
+ void setConvexityType(SkPathConvexityType convexity);
+
+ /** Returns true if the path is convex. If necessary, it will first compute the convexity.
+ */
+ bool isConvex() const {
+ return SkPathConvexityType::kConvex == this->getConvexityType();
+ }
+
+#ifdef SK_SUPPORT_LEGACY_PATH_DIRECTION_ENUM
/** \enum SkPath::Convexity
SkPath is convex if it contains one contour and contour loops no more than
360 degrees, and contour angles all have same Direction. Convex SkPath
@@ -229,53 +269,12 @@
kConcave_Convexity = static_cast<int>(SkPathConvexityType::kConcave),
};
- /** Computes SkPath::Convexity if required, and returns stored value.
- SkPath::Convexity is computed if stored value is kUnknown_Convexity,
- or if SkPath has been altered since SkPath::Convexity was computed or set.
-
- @return computed or stored SkPath::Convexity
- */
- Convexity getConvexity() const {
- Convexity convexity = this->getConvexityOrUnknown();
- if (convexity != kUnknown_Convexity) {
- return convexity;
- }
- return this->internalGetConvexity();
+ Convexity getConvexity() const { return (Convexity)this->getConvexityType(); }
+ Convexity getConvexityOrUnknown() const { return (Convexity)this->getConvexityTypeOrUnknown(); }
+ void setConvexity(Convexity convexity) {
+ this->setConvexityType((SkPathConvexityType)convexity);
}
-
- /** Returns last computed SkPath::Convexity, or kUnknown_Convexity if
- SkPath has been altered since SkPath::Convexity was computed or set.
-
- @return stored SkPath::Convexity
- */
- Convexity getConvexityOrUnknown() const { return fConvexity.load(std::memory_order_relaxed); }
-
- /** Stores convexity so that it is later returned by getConvexity() or getConvexityOrUnknown().
- convexity may differ from getConvexity(), although setting an incorrect value may
- cause incorrect or inefficient drawing.
-
- If convexity is kUnknown_Convexity: getConvexity() will
- compute SkPath::Convexity, and getConvexityOrUnknown() will return kUnknown_Convexity.
-
- If convexity is kConvex_Convexity or kConcave_Convexity, getConvexity()
- and getConvexityOrUnknown() will return convexity until the path is
- altered.
-
- @param convexity one of: kUnknown_Convexity, kConvex_Convexity, or kConcave_Convexity
-
- example: https://fiddle.skia.org/c/@Path_setConvexity
- */
- void setConvexity(Convexity convexity);
-
- /** Computes SkPath::Convexity if required, and returns true if value is kConvex_Convexity.
- If setConvexity() was called with kConvex_Convexity or kConcave_Convexity, and
- the path has not been altered, SkPath::Convexity is not recomputed.
-
- @return true if SkPath::Convexity stored or computed is kConvex_Convexity
- */
- bool isConvex() const {
- return kConvex_Convexity == this->getConvexity();
- }
+#endif
/** Returns true if this path is recognized as an oval or circle.
@@ -968,7 +967,7 @@
@return reference to SkPath
*/
SkPath& arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
- Direction sweep, SkScalar x, SkScalar y);
+ SkPathDirection sweep, SkScalar x, SkScalar y);
/** Appends arc to SkPath. Arc is implemented by one or more conic weighted to describe
part of oval with radii (r.fX, r.fY) rotated by xAxisRotate degrees. Arc curves
@@ -993,7 +992,7 @@
@param xy end of arc
@return reference to SkPath
*/
- SkPath& arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep,
+ SkPath& arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, SkPathDirection sweep,
const SkPoint xy) {
return this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, sweep, xy.fX, xy.fY);
}
@@ -1025,7 +1024,7 @@
@return reference to SkPath
*/
SkPath& rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
- Direction sweep, SkScalar dx, SkScalar dy);
+ SkPathDirection sweep, SkScalar dx, SkScalar dy);
/** Appends kClose_Verb to SkPath. A closed contour connects the first and last SkPoint
with line, forming a continuous loop. Open and closed contour draw the same
@@ -1114,7 +1113,7 @@
example: https://fiddle.skia.org/c/@Path_isRect
*/
- bool isRect(SkRect* rect, bool* isClosed = nullptr, Direction* direction = nullptr) const;
+ bool isRect(SkRect* rect, bool* isClosed = nullptr, SkPathDirection* direction = nullptr) const;
/** Adds SkRect to SkPath, appending kMove_Verb, three kLine_Verb, and kClose_Verb,
starting with top-left corner of SkRect; followed by top-right, bottom-right,
@@ -1127,7 +1126,7 @@
example: https://fiddle.skia.org/c/@Path_addRect
*/
- SkPath& addRect(const SkRect& rect, Direction dir = kCW_Direction);
+ SkPath& addRect(const SkRect& rect, SkPathDirection dir = SkPathDirection::kCW);
/** Adds SkRect to SkPath, appending kMove_Verb, three kLine_Verb, and kClose_Verb.
If dir is kCW_Direction, SkRect corners are added clockwise; if dir is
@@ -1141,7 +1140,7 @@
example: https://fiddle.skia.org/c/@Path_addRect_2
*/
- SkPath& addRect(const SkRect& rect, Direction dir, unsigned start);
+ SkPath& addRect(const SkRect& rect, SkPathDirection dir, unsigned start);
/** Adds SkRect (left, top, right, bottom) to SkPath,
appending kMove_Verb, three kLine_Verb, and kClose_Verb,
@@ -1157,7 +1156,7 @@
@return reference to SkPath
*/
SkPath& addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom,
- Direction dir = kCW_Direction);
+ SkPathDirection dir = SkPathDirection::kCW);
/** Adds oval to path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width
@@ -1170,7 +1169,7 @@
example: https://fiddle.skia.org/c/@Path_addOval
*/
- SkPath& addOval(const SkRect& oval, Direction dir = kCW_Direction);
+ SkPath& addOval(const SkRect& oval, SkPathDirection dir = SkPathDirection::kCW);
/** Adds oval to SkPath, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width
@@ -1184,7 +1183,7 @@
example: https://fiddle.skia.org/c/@Path_addOval_2
*/
- SkPath& addOval(const SkRect& oval, Direction dir, unsigned start);
+ SkPath& addOval(const SkRect& oval, SkPathDirection dir, unsigned start);
/** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,
four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing
@@ -1199,7 +1198,7 @@
@return reference to SkPath
*/
SkPath& addCircle(SkScalar x, SkScalar y, SkScalar radius,
- Direction dir = kCW_Direction);
+ SkPathDirection dir = SkPathDirection::kCW);
/** Appends arc to SkPath, as the start of new contour. Arc added is part of ellipse
bounded by oval, from startAngle through sweepAngle. Both startAngle and
@@ -1238,7 +1237,7 @@
@return reference to SkPath
*/
SkPath& addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
- Direction dir = kCW_Direction);
+ SkPathDirection dir = SkPathDirection::kCW);
/** Appends SkRRect to SkPath, creating a new closed contour. SkRRect has bounds
equal to rect; each corner is 90 degrees of an ellipse with radii from the
@@ -1250,7 +1249,7 @@
@return reference to SkPath
*/
SkPath& addRoundRect(const SkRect& rect, const SkScalar radii[],
- Direction dir = kCW_Direction);
+ SkPathDirection dir = SkPathDirection::kCW);
/** Adds rrect to SkPath, creating a new closed contour. If
dir is kCW_Direction, rrect starts at top-left of the lower-left corner and
@@ -1265,7 +1264,7 @@
example: https://fiddle.skia.org/c/@Path_addRRect
*/
- SkPath& addRRect(const SkRRect& rrect, Direction dir = kCW_Direction);
+ SkPath& addRRect(const SkRRect& rrect, SkPathDirection dir = SkPathDirection::kCW);
/** Adds rrect to SkPath, creating a new closed contour. If dir is kCW_Direction, rrect
winds clockwise; if dir is kCCW_Direction, rrect winds counterclockwise.
@@ -1278,7 +1277,7 @@
example: https://fiddle.skia.org/c/@Path_addRRect_2
*/
- SkPath& addRRect(const SkRRect& rrect, Direction dir, unsigned start);
+ SkPath& addRRect(const SkRRect& rrect, SkPathDirection dir, unsigned start);
/** Adds contour created from line array, adding (count - 1) line segments.
Contour added starts at pts[0], then adds a line for every additional SkPoint
@@ -1776,10 +1775,62 @@
*/
bool isValid() const { return this->isValidImpl() && fPathRef->isValid(); }
+#ifdef SK_SUPPORT_LEGACY_PATH_DIRECTION_ENUM
+ SkPath& arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
+ Direction sweep, SkScalar x, SkScalar y) {
+ return this->arcTo(rx, ry, xAxisRotate, largeArc, (SkPathDirection)sweep, x, y);
+ }
+ SkPath& arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep,
+ const SkPoint xy) {
+ return this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, (SkPathDirection)sweep, xy.fX, xy.fY);
+ }
+ SkPath& rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
+ Direction sweep, SkScalar dx, SkScalar dy) {
+ return this->rArcTo(rx, ry, xAxisRotate, largeArc, (SkPathDirection)sweep, dx, dy);
+ }
+ bool isRect(SkRect* rect, bool* isClosed, Direction* direction) const {
+ return this->isRect(rect, isClosed, (SkPathDirection*)direction);
+ }
+ bool isRect(SkRect* rect, bool* isClosed, nullptr_t) const {
+ return this->isRect(rect, isClosed);
+ }
+ SkPath& addRect(const SkRect& rect, Direction dir) {
+ return this->addRect(rect, (SkPathDirection)dir);
+ }
+ SkPath& addRect(const SkRect& rect, Direction dir, unsigned start) {
+ return this->addRect(rect, (SkPathDirection)dir, start);
+ }
+ SkPath& addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom,
+ Direction dir) {
+ return this->addRect(left, top, right, bottom, (SkPathDirection)dir);
+ }
+ SkPath& addOval(const SkRect& oval, Direction dir) {
+ return addOval(oval, (SkPathDirection)dir);
+ }
+ SkPath& addOval(const SkRect& oval, Direction dir, unsigned start) {
+ return this->addOval(oval, (SkPathDirection)dir, start);
+ }
+ SkPath& addCircle(SkScalar x, SkScalar y, SkScalar radius, Direction dir) {
+ return this->addCircle(x, y, radius, (SkPathDirection)dir);
+ }
+ SkPath& addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, Direction dir) {
+ return this->addRoundRect(rect, rx, ry, (SkPathDirection)dir);
+ }
+ SkPath& addRoundRect(const SkRect& rect, const SkScalar radii[], Direction dir) {
+ return this->addRoundRect(rect, radii, (SkPathDirection)dir);
+ }
+ SkPath& addRRect(const SkRRect& rrect, Direction dir) {
+ return this->addRRect(rrect, (SkPathDirection)dir);
+ }
+ SkPath& addRRect(const SkRRect& rrect, Direction dir, unsigned start) {
+ return this->addRRect(rrect, (SkPathDirection)dir, start);
+ }
+#endif
+
private:
sk_sp<SkPathRef> fPathRef;
int fLastMoveToIndex;
- mutable std::atomic<Convexity> fConvexity;
+ mutable std::atomic<uint8_t> fConvexity; // SkPathConvexityType
mutable std::atomic<uint8_t> fFirstDirection; // really an SkPathPriv::FirstDirection
uint8_t fFillType : 2;
uint8_t fIsVolatile : 1;
@@ -1820,7 +1871,7 @@
inline bool hasOnlyMoveTos() const;
- Convexity internalGetConvexity() const;
+ SkPathConvexityType internalGetConvexity() const;
/** Asserts if SkPath data is inconsistent.
Debugging check intended for internal use only.
@@ -1852,7 +1903,7 @@
// Bottlenecks for working with fConvexity and fFirstDirection.
// Notice the setters are const... these are mutable atomic fields.
- void setConvexity(Convexity) const;
+ void setConvexityType(SkPathConvexityType) const;
void setFirstDirection(uint8_t) const;
uint8_t getFirstDirection() const;
diff --git a/modules/canvaskit/canvaskit_bindings.cpp b/modules/canvaskit/canvaskit_bindings.cpp
index 9183ba1..de777d0 100644
--- a/modules/canvaskit/canvaskit_bindings.cpp
+++ b/modules/canvaskit/canvaskit_bindings.cpp
@@ -193,8 +193,7 @@
}
void ApplyAddOval(SkPath& orig, const SkRect& oval, bool ccw, unsigned start) {
- orig.addOval(oval, ccw ? SkPath::Direction::kCCW_Direction :
- SkPath::Direction::kCW_Direction, start);
+ orig.addOval(oval, ccw ? SkPathDirection::kCCW : SkPathDirection::kCW, start);
}
void ApplyAddPath(SkPath& orig, const SkPath& newPath,
@@ -211,9 +210,7 @@
void ApplyAddRect(SkPath& path, SkScalar left, SkScalar top,
SkScalar right, SkScalar bottom, bool ccw) {
- path.addRect(left, top, right, bottom,
- ccw ? SkPath::Direction::kCCW_Direction :
- SkPath::Direction::kCW_Direction);
+ path.addRect(left, top, right, bottom, ccw ? SkPathDirection::kCCW : SkPathDirection::kCW);
}
void ApplyAddRoundRect(SkPath& path, SkScalar left, SkScalar top,
@@ -222,7 +219,7 @@
// See comment below for uintptr_t explanation
const SkScalar* radii = reinterpret_cast<const SkScalar*>(rPtr);
path.addRoundRect(SkRect::MakeLTRB(left, top, right, bottom), radii,
- ccw ? SkPath::Direction::kCCW_Direction : SkPath::Direction::kCW_Direction);
+ ccw ? SkPathDirection::kCCW : SkPathDirection::kCW);
}
@@ -238,14 +235,14 @@
void ApplyArcToArcSize(SkPath& orig, SkScalar rx, SkScalar ry, SkScalar xAxisRotate,
bool useSmallArc, bool ccw, SkScalar x, SkScalar y) {
auto arcSize = useSmallArc ? SkPath::ArcSize::kSmall_ArcSize : SkPath::ArcSize::kLarge_ArcSize;
- auto sweep = ccw ? SkPath::Direction::kCCW_Direction : SkPath::Direction::kCW_Direction;
+ auto sweep = ccw ? SkPathDirection::kCCW : SkPathDirection::kCW;
orig.arcTo(rx, ry, xAxisRotate, arcSize, sweep, x, y);
}
void ApplyRArcToArcSize(SkPath& orig, SkScalar rx, SkScalar ry, SkScalar xAxisRotate,
bool useSmallArc, bool ccw, SkScalar dx, SkScalar dy) {
auto arcSize = useSmallArc ? SkPath::ArcSize::kSmall_ArcSize : SkPath::ArcSize::kLarge_ArcSize;
- auto sweep = ccw ? SkPath::Direction::kCCW_Direction : SkPath::Direction::kCW_Direction;
+ auto sweep = ccw ? SkPathDirection::kCCW : SkPathDirection::kCW;
orig.rArcTo(rx, ry, xAxisRotate, arcSize, sweep, dx, dy);
}
diff --git a/modules/skottie/src/layers/ShapeLayer.cpp b/modules/skottie/src/layers/ShapeLayer.cpp
index 7396696..97a96da 100644
--- a/modules/skottie/src/layers/ShapeLayer.cpp
+++ b/modules/skottie/src/layers/ShapeLayer.cpp
@@ -41,8 +41,8 @@
sk_sp<sksg::GeometryNode> AttachRRectGeometry(const skjson::ObjectValue& jrect,
const AnimationBuilder* abuilder) {
auto rect_node = sksg::RRect::Make();
- rect_node->setDirection(ParseDefault(jrect["d"], -1) == 3 ? SkPath::kCCW_Direction
- : SkPath::kCW_Direction);
+ rect_node->setDirection(ParseDefault(jrect["d"], -1) == 3 ? SkPathDirection::kCCW
+ : SkPathDirection::kCW);
rect_node->setInitialPointIndex(2); // starting point: (Right, Top - radius.y)
auto adapter = sk_make_sp<RRectAdapter>(rect_node);
@@ -70,8 +70,8 @@
sk_sp<sksg::GeometryNode> AttachEllipseGeometry(const skjson::ObjectValue& jellipse,
const AnimationBuilder* abuilder) {
auto rect_node = sksg::RRect::Make();
- rect_node->setDirection(ParseDefault(jellipse["d"], -1) == 3 ? SkPath::kCCW_Direction
- : SkPath::kCW_Direction);
+ rect_node->setDirection(ParseDefault(jellipse["d"], -1) == 3 ? SkPathDirection::kCCW
+ : SkPathDirection::kCW);
rect_node->setInitialPointIndex(1); // starting point: (Center, Top)
auto adapter = sk_make_sp<RRectAdapter>(rect_node);
diff --git a/modules/sksg/include/SkSGRect.h b/modules/sksg/include/SkSGRect.h
index 29456a0..fa39a8f 100644
--- a/modules/sksg/include/SkSGRect.h
+++ b/modules/sksg/include/SkSGRect.h
@@ -32,8 +32,8 @@
SG_ATTRIBUTE(R, SkScalar, fRect.fRight )
SG_ATTRIBUTE(B, SkScalar, fRect.fBottom)
- SG_MAPPED_ATTRIBUTE(Direction , SkPath::Direction, fAttrContaier)
- SG_MAPPED_ATTRIBUTE(InitialPointIndex, uint8_t , fAttrContaier)
+ SG_MAPPED_ATTRIBUTE(Direction , SkPathDirection, fAttrContaier)
+ SG_MAPPED_ATTRIBUTE(InitialPointIndex, uint8_t , fAttrContaier)
protected:
void onClip(SkCanvas*, bool antiAlias) const override;
@@ -52,15 +52,15 @@
uint8_t fDirection : 1;
uint8_t fInitialPointIndex : 2;
- SkPath::Direction getDirection() const {
- return static_cast<SkPath::Direction>(fDirection);
+ SkPathDirection getDirection() const {
+ return static_cast<SkPathDirection>(fDirection);
}
- void setDirection(SkPath::Direction dir) { fDirection = SkTo<uint8_t>(dir); }
+ void setDirection(SkPathDirection dir) { fDirection = SkTo<uint8_t>(dir); }
uint8_t getInitialPointIndex() const { return fInitialPointIndex; }
void setInitialPointIndex(uint8_t idx) { fInitialPointIndex = idx; }
};
- AttrContainer fAttrContaier = { SkPath::kCW_Direction, 0 };
+ AttrContainer fAttrContaier = { (int)SkPathDirection::kCW, 0 };
using INHERITED = GeometryNode;
};
@@ -75,7 +75,7 @@
SG_ATTRIBUTE(RRect, SkRRect, fRRect)
- SG_MAPPED_ATTRIBUTE(Direction , SkPath::Direction, fAttrContaier)
+ SG_MAPPED_ATTRIBUTE(Direction , SkPathDirection, fAttrContaier)
SG_MAPPED_ATTRIBUTE(InitialPointIndex, uint8_t , fAttrContaier)
protected:
@@ -95,15 +95,15 @@
uint8_t fDirection : 1;
uint8_t fInitialPointIndex : 2;
- SkPath::Direction getDirection() const {
- return static_cast<SkPath::Direction>(fDirection);
+ SkPathDirection getDirection() const {
+ return static_cast<SkPathDirection>(fDirection);
}
- void setDirection(SkPath::Direction dir) { fDirection = SkTo<uint8_t>(dir); }
+ void setDirection(SkPathDirection dir) { fDirection = SkTo<uint8_t>(dir); }
uint8_t getInitialPointIndex() const { return fInitialPointIndex; }
void setInitialPointIndex(uint8_t idx) { fInitialPointIndex = idx; }
};
- AttrContainer fAttrContaier = { SkPath::kCW_Direction, 0 };
+ AttrContainer fAttrContaier = { (int)SkPathDirection::kCW, 0 };
using INHERITED = GeometryNode;
};
diff --git a/samplecode/SampleAndroidShadows.cpp b/samplecode/SampleAndroidShadows.cpp
index 71eb22a..a4518f2 100644
--- a/samplecode/SampleAndroidShadows.cpp
+++ b/samplecode/SampleAndroidShadows.cpp
@@ -53,7 +53,7 @@
fRRPath.addRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(-100, -50, 200, 100), 4, 4));
fFunkyRRPath.addRoundRect(SkRect::MakeXYWH(-50, -50, SK_Scalar1 * 100, SK_Scalar1 * 100),
40 * SK_Scalar1, 20 * SK_Scalar1,
- SkPath::kCW_Direction);
+ SkPathDirection::kCW);
fCubicPath.cubicTo(100 * SK_Scalar1, 50 * SK_Scalar1,
20 * SK_Scalar1, 100 * SK_Scalar1,
0 * SK_Scalar1, 0 * SK_Scalar1);
diff --git a/samplecode/SampleClock.cpp b/samplecode/SampleClock.cpp
index a90ecf1..f7332ce 100644
--- a/samplecode/SampleClock.cpp
+++ b/samplecode/SampleClock.cpp
@@ -160,7 +160,7 @@
#ifdef USE_PATH
path.reset();
path.arcTo(rect, 0, 0, false);
- path.addOval(rect, SkPath::kCCW_Direction);
+ path.addOval(rect, SkPathDirection::kCCW);
path.arcTo(rect, 360, 0, true);
canvas->drawPath(path, paintFill);
#else
@@ -170,7 +170,7 @@
#ifdef USE_PATH
path.reset();
path.arcTo(rect, 0, 0, false);
- path.addOval(rect, SkPath::kCCW_Direction);
+ path.addOval(rect, SkPathDirection::kCCW);
path.arcTo(rect, 360, 0, true);
canvas->drawPath(path, paintStroke);
#else
@@ -180,7 +180,7 @@
#ifdef USE_PATH
rect = SkRect::MakeLTRB(-6, -6, 6, 6);
path.arcTo(rect, 0, 0, false);
- path.addOval(rect, SkPath::kCCW_Direction);
+ path.addOval(rect, SkPathDirection::kCCW);
path.arcTo(rect, 360, 0, true);
canvas->drawPath(path, paintFill);
#else
@@ -196,7 +196,7 @@
#ifdef USE_PATH
path.reset();
path.arcTo(rect, 0, 0, false);
- path.addOval(rect, SkPath::kCCW_Direction);
+ path.addOval(rect, SkPathDirection::kCCW);
path.arcTo(rect, 360, 0, true);
canvas->drawPath(path, paintStroke);
#else
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 72dfabc..53bf5eb 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -646,9 +646,9 @@
path.reset();
SkRRect rr2;
rr.inset(width/2, width/2, &rr2);
- path.addRRect(rr2, SkPath::kCCW_Direction);
+ path.addRRect(rr2, SkPathDirection::kCCW);
rr.inset(-width/2, -width/2, &rr2);
- path.addRRect(rr2, SkPath::kCW_Direction);
+ path.addRRect(rr2, SkPathDirection::kCW);
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(0x40FF8844);
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 58ad5e0..7c16c01 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -32,7 +32,7 @@
SkPath path;
path.addRect(0.0f, 0.0f,
SkIntToScalar(width), SkIntToScalar(height),
- SkPath::kCW_Direction);
+ SkPathDirection::kCW);
SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
SkCanvas c(bitmap);
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index 09cb87c..d58f4f1 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -136,9 +136,9 @@
path.reset();
SkRect r = { 0, 0, 250, 120 };
- path.addOval(r, SkPath::kCW_Direction);
+ path.addOval(r, SkPathDirection::kCW);
r.inset(50, 50);
- path.addRect(r, SkPath::kCCW_Direction);
+ path.addRect(r, SkPathDirection::kCCW);
canvas->translate(320, 20);
for (i = 0; i < SK_ARRAY_COUNT(gPE2); i++) {
diff --git a/samplecode/SampleStrokePath.cpp b/samplecode/SampleStrokePath.cpp
index 4963f97..3ab8bf4 100644
--- a/samplecode/SampleStrokePath.cpp
+++ b/samplecode/SampleStrokePath.cpp
@@ -112,8 +112,8 @@
"Z";
SkParsePath::FromSVGString(str, &fPath);
#else
- fPath.addCircle(0, 0, SkIntToScalar(50), SkPath::kCW_Direction);
- fPath.addCircle(0, SkIntToScalar(-50), SkIntToScalar(30), SkPath::kCW_Direction);
+ fPath.addCircle(0, 0, SkIntToScalar(50), SkPathDirection::kCW);
+ fPath.addCircle(0, SkIntToScalar(-50), SkIntToScalar(30), SkPathDirection::kCW);
#endif
scale_to_width(&fPath, fWidth);
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index b3f203f..65fe209 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -56,13 +56,13 @@
const struct {
sk_path_direction_t fC;
- SkPath::Direction fSk;
+ SkPathDirection fSk;
} gPathDirMap[] = {
- { CW_SK_PATH_DIRECTION, SkPath::kCW_Direction },
- { CCW_SK_PATH_DIRECTION, SkPath::kCCW_Direction },
+ { CW_SK_PATH_DIRECTION, SkPathDirection::kCW },
+ { CCW_SK_PATH_DIRECTION, SkPathDirection::kCCW },
};
-static bool from_c_path_direction(sk_path_direction_t cdir, SkPath::Direction* dir) {
+static bool from_c_path_direction(sk_path_direction_t cdir, SkPathDirection* dir) {
for (size_t i = 0; i < SK_ARRAY_COUNT(gPathDirMap); ++i) {
if (gPathDirMap[i].fC == cdir) {
if (dir) {
@@ -202,7 +202,7 @@
}
void sk_path_add_rect(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) {
- SkPath::Direction dir;
+ SkPathDirection dir;
if (!from_c_path_direction(cdir, &dir)) {
return;
}
@@ -210,7 +210,7 @@
}
void sk_path_add_oval(sk_path_t* cpath, const sk_rect_t* crect, sk_path_direction_t cdir) {
- SkPath::Direction dir;
+ SkPathDirection dir;
if (!from_c_path_direction(cdir, &dir)) {
return;
}
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index b955816..2d4d69f 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -107,8 +107,8 @@
}
~SkAutoPathBoundsUpdate() {
- fPath->setConvexity(fDegenerate ? SkPath::kConvex_Convexity
- : SkPath::kUnknown_Convexity);
+ fPath->setConvexityType(fDegenerate ? SkPathConvexityType::kConvex
+ : SkPathConvexityType::kUnknown);
if ((fEmpty || fHasValidBounds) && fRect.isFinite()) {
fPath->setBounds(fRect);
}
@@ -152,7 +152,7 @@
//fPathRef is assumed to have been emptied by the caller.
fLastMoveToIndex = INITIAL_LASTMOVETOINDEX_VALUE;
fFillType = kWinding_FillType;
- this->setConvexity(kUnknown_Convexity);
+ this->setConvexityType(SkPathConvexityType::kUnknown);
this->setFirstDirection(SkPathPriv::kUnknown_FirstDirection);
// We don't touch Android's fSourcePath. It's used to track texture garbage collection, so we
@@ -187,7 +187,7 @@
fIsVolatile = that.fIsVolatile;
// Non-atomic assignment of atomic values.
- this->setConvexity(that.getConvexityOrUnknown());
+ this->setConvexityType(that.getConvexityTypeOrUnknown());
this->setFirstDirection(that.getFirstDirection());
}
@@ -212,9 +212,9 @@
that.fIsVolatile = iv;
// Non-atomic swaps of atomic values.
- Convexity c = this->getConvexityOrUnknown();
- this->setConvexity(that.getConvexityOrUnknown());
- that.setConvexity(c);
+ SkPathConvexityType c = this->getConvexityTypeOrUnknown();
+ this->setConvexityType(that.getConvexityTypeOrUnknown());
+ that.setConvexityType(c);
uint8_t fd = this->getFirstDirection();
this->setFirstDirection(that.getFirstDirection());
@@ -271,7 +271,7 @@
bool SkPath::conservativelyContainsRect(const SkRect& rect) const {
// This only handles non-degenerate convex paths currently.
- if (kConvex_Convexity != this->getConvexity()) {
+ if (!this->isConvex()) {
return false;
}
@@ -455,7 +455,7 @@
return ((0 != dx) << 0) | ((dx > 0 || dy > 0) << 1);
}
-bool SkPath::isRect(SkRect* rect, bool* isClosed, Direction* direction) const {
+bool SkPath::isRect(SkRect* rect, bool* isClosed, SkPathDirection* direction) const {
SkDEBUGCODE(this->validate();)
int currVerb = 0;
const SkPoint* pts = fPathRef->points();
@@ -559,13 +559,13 @@
}
// This is the public-facing non-const setConvexity().
-void SkPath::setConvexity(Convexity c) {
- fConvexity.store(c, std::memory_order_relaxed);
+void SkPath::setConvexityType(SkPathConvexityType c) {
+ fConvexity.store((uint8_t)c, std::memory_order_relaxed);
}
// Const hooks for working with fConvexity and fFirstDirection from const methods.
-void SkPath::setConvexity(Convexity c) const {
- fConvexity.store(c, std::memory_order_relaxed);
+void SkPath::setConvexityType(SkPathConvexityType c) const {
+ fConvexity.store((uint8_t)c, std::memory_order_relaxed);
}
void SkPath::setFirstDirection(uint8_t d) const {
fFirstDirection.store(d, std::memory_order_relaxed);
@@ -579,7 +579,7 @@
#define DIRTY_AFTER_EDIT \
do { \
- this->setConvexity(kUnknown_Convexity); \
+ this->setConvexityType(SkPathConvexityType::kUnknown); \
this->setFirstDirection(SkPathPriv::kUnknown_FirstDirection); \
} while (0)
@@ -760,20 +760,20 @@
///////////////////////////////////////////////////////////////////////////////
-static void assert_known_direction(int dir) {
- SkASSERT(SkPath::kCW_Direction == dir || SkPath::kCCW_Direction == dir);
+static void assert_known_direction(SkPathDirection dir) {
+ SkASSERT(SkPathDirection::kCW == dir || SkPathDirection::kCCW == dir);
}
-SkPath& SkPath::addRect(const SkRect& rect, Direction dir) {
+SkPath& SkPath::addRect(const SkRect& rect, SkPathDirection dir) {
return this->addRect(rect, dir, 0);
}
SkPath& SkPath::addRect(SkScalar left, SkScalar top, SkScalar right,
- SkScalar bottom, Direction dir) {
+ SkScalar bottom, SkPathDirection dir) {
return this->addRect(SkRect::MakeLTRB(left, top, right, bottom), dir, 0);
}
-SkPath& SkPath::addRect(const SkRect &rect, Direction dir, unsigned startIndex) {
+SkPath& SkPath::addRect(const SkRect &rect, SkPathDirection dir, unsigned startIndex) {
assert_known_direction(dir);
this->setFirstDirection(this->hasOnlyMoveTos() ? (SkPathPriv::FirstDirection)dir
: SkPathPriv::kUnknown_FirstDirection);
@@ -903,18 +903,18 @@
}
SkPath& SkPath::addRoundRect(const SkRect& rect, const SkScalar radii[],
- Direction dir) {
+ SkPathDirection dir) {
SkRRect rrect;
rrect.setRectRadii(rect, (const SkVector*) radii);
return this->addRRect(rrect, dir);
}
-SkPath& SkPath::addRRect(const SkRRect& rrect, Direction dir) {
+SkPath& SkPath::addRRect(const SkRRect& rrect, SkPathDirection dir) {
// legacy start indices: 6 (CW) and 7(CCW)
- return this->addRRect(rrect, dir, dir == kCW_Direction ? 6 : 7);
+ return this->addRRect(rrect, dir, dir == SkPathDirection::kCW ? 6 : 7);
}
-SkPath& SkPath::addRRect(const SkRRect &rrect, Direction dir, unsigned startIndex) {
+SkPath& SkPath::addRRect(const SkRRect &rrect, SkPathDirection dir, unsigned startIndex) {
assert_known_direction(dir);
bool isRRect = hasOnlyMoveTos();
@@ -934,7 +934,7 @@
SkAutoDisableDirectionCheck addc(this);
// we start with a conic on odd indices when moving CW vs. even indices when moving CCW
- const bool startsWithConic = ((startIndex & 1) == (dir == kCW_Direction));
+ const bool startsWithConic = ((startIndex & 1) == (dir == SkPathDirection::kCW));
const SkScalar weight = SK_ScalarRoot2Over2;
SkDEBUGCODE(int initialVerbCount = this->countVerbs());
@@ -946,7 +946,7 @@
SkPath_RRectPointIterator rrectIter(rrect, dir, startIndex);
// Corner iterator indices follow the collapsed radii model,
// adjusted such that the start pt is "behind" the radii start pt.
- const unsigned rectStartIndex = startIndex / 2 + (dir == kCW_Direction ? 0 : 1);
+ const unsigned rectStartIndex = startIndex / 2 + (dir == SkPathDirection::kCW ? 0 : 1);
SkPath_RectPointIterator rectIter(bounds, dir, rectStartIndex);
this->moveTo(rrectIter.current());
@@ -966,7 +966,7 @@
this->close();
SkPathRef::Editor ed(&fPathRef);
- ed.setIsRRect(isRRect, dir, startIndex % 8);
+ ed.setIsRRect(isRRect, dir == SkPathDirection::kCCW, startIndex % 8);
SkASSERT(this->countVerbs() == initialVerbCount + kVerbs);
}
@@ -1006,7 +1006,7 @@
}
SkPath& SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry,
- Direction dir) {
+ SkPathDirection dir) {
assert_known_direction(dir);
if (rx < 0 || ry < 0) {
@@ -1018,12 +1018,12 @@
return this->addRRect(rrect, dir);
}
-SkPath& SkPath::addOval(const SkRect& oval, Direction dir) {
+SkPath& SkPath::addOval(const SkRect& oval, SkPathDirection dir) {
// legacy start index: 1
return this->addOval(oval, dir, 1);
}
-SkPath& SkPath::addOval(const SkRect &oval, Direction dir, unsigned startPointIndex) {
+SkPath& SkPath::addOval(const SkRect &oval, SkPathDirection dir, unsigned startPointIndex) {
assert_known_direction(dir);
/* If addOval() is called after previous moveTo(),
@@ -1048,7 +1048,7 @@
SkPath_OvalPointIterator ovalIter(oval, dir, startPointIndex);
// The corner iterator pts are tracking "behind" the oval/radii pts.
- SkPath_RectPointIterator rectIter(oval, dir, startPointIndex + (dir == kCW_Direction ? 0 : 1));
+ SkPath_RectPointIterator rectIter(oval, dir, startPointIndex + (dir == SkPathDirection::kCW ? 0 : 1));
const SkScalar weight = SK_ScalarRoot2Over2;
this->moveTo(ovalIter.current());
@@ -1061,11 +1061,11 @@
SkPathRef::Editor ed(&fPathRef);
- ed.setIsOval(isOval, kCCW_Direction == dir, startPointIndex % 4);
+ ed.setIsOval(isOval, SkPathDirection::kCCW == dir, startPointIndex % 4);
return *this;
}
-SkPath& SkPath::addCircle(SkScalar x, SkScalar y, SkScalar r, Direction dir) {
+SkPath& SkPath::addCircle(SkScalar x, SkScalar y, SkScalar r, SkPathDirection dir) {
if (r > 0) {
this->addOval(SkRect::MakeLTRB(x - r, y - r, x + r, y + r), dir);
}
@@ -1145,7 +1145,7 @@
// http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter
// Note that arcSweep bool value is flipped from the original implementation.
SkPath& SkPath::arcTo(SkScalar rx, SkScalar ry, SkScalar angle, SkPath::ArcSize arcLarge,
- SkPath::Direction arcSweep, SkScalar x, SkScalar y) {
+ SkPathDirection arcSweep, SkScalar x, SkScalar y) {
this->injectMoveToIfNeeded();
SkPoint srcPts[2];
this->getLastPt(&srcPts[0]);
@@ -1196,7 +1196,7 @@
SkScalar scaleFactorSquared = SkTMax(1 / d - 0.25f, 0.f);
SkScalar scaleFactor = SkScalarSqrt(scaleFactorSquared);
- if (SkToBool(arcSweep) != SkToBool(arcLarge)) { // flipped from the original implementation
+ if ((arcSweep == SkPathDirection::kCCW) != SkToBool(arcLarge)) { // flipped from the original implementation
scaleFactor = -scaleFactor;
}
delta.scale(scaleFactor);
@@ -1208,9 +1208,9 @@
SkScalar theta1 = SkScalarATan2(unitPts[0].fY, unitPts[0].fX);
SkScalar theta2 = SkScalarATan2(unitPts[1].fY, unitPts[1].fX);
SkScalar thetaArc = theta2 - theta1;
- if (thetaArc < 0 && !arcSweep) { // arcSweep flipped from the original implementation
+ if (thetaArc < 0 && (arcSweep == SkPathDirection::kCW)) { // arcSweep flipped from the original implementation
thetaArc += SK_ScalarPI * 2;
- } else if (thetaArc > 0 && arcSweep) { // arcSweep flipped from the original implementation
+ } else if (thetaArc > 0 && (arcSweep != SkPathDirection::kCW)) { // arcSweep flipped from the original implementation
thetaArc -= SK_ScalarPI * 2;
}
@@ -1270,7 +1270,7 @@
}
SkPath& SkPath::rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, SkPath::ArcSize largeArc,
- SkPath::Direction sweep, SkScalar dx, SkScalar dy) {
+ SkPathDirection sweep, SkScalar dx, SkScalar dy) {
SkPoint currentPoint;
this->getLastPt(¤tPoint);
return this->arcTo(rx, ry, xAxisRotate, largeArc, sweep,
@@ -1294,7 +1294,7 @@
// Index 1 is at startAngle == 0.
SkScalar startIndex = std::fmod(startOver90I + 1.f, 4.f);
startIndex = startIndex < 0 ? startIndex + 4.f : startIndex;
- return this->addOval(oval, sweepAngle > 0 ? kCW_Direction : kCCW_Direction,
+ return this->addOval(oval, sweepAngle > 0 ? SkPathDirection::kCW : SkPathDirection::kCCW,
(unsigned) startIndex);
}
}
@@ -1597,7 +1597,7 @@
matrix.mapPoints(ed.writablePoints(), ed.pathRef()->countPoints());
dst->setFirstDirection(SkPathPriv::kUnknown_FirstDirection);
} else {
- Convexity convexity = this->getConvexityOrUnknown();
+ SkPathConvexityType convexity = this->getConvexityTypeOrUnknown();
SkPathRef::CreateTransformedCopy(&dst->fPathRef, *fPathRef.get(), matrix);
@@ -1617,9 +1617,9 @@
// check, and keep convex paths marked as such after a general transform...
//
if (matrix.isScaleTranslate() && SkPathPriv::IsAxisAligned(*this)) {
- dst->setConvexity(convexity);
+ dst->setConvexityType(convexity);
} else {
- dst->setConvexity(kUnknown_Convexity);
+ dst->setConvexityType(SkPathConvexityType::kUnknown);
}
if (this->getFirstDirection() == SkPathPriv::kUnknown_FirstDirection) {
@@ -2012,7 +2012,7 @@
return true;
}
- static SkPath::Convexity BySign(const SkPoint points[], int count) {
+ static SkPathConvexityType BySign(const SkPoint points[], int count) {
const SkPoint* last = points + count;
SkPoint currPt = *points++;
SkPoint firstPt = currPt;
@@ -2026,14 +2026,14 @@
if (!vec.isZero()) {
// give up if vector construction failed
if (!vec.isFinite()) {
- return SkPath::kUnknown_Convexity;
+ return SkPathConvexityType::kUnknown;
}
int sx = sign(vec.fX);
int sy = sign(vec.fY);
dxes += (sx != lastSx);
dyes += (sy != lastSy);
if (dxes > 3 || dyes > 3) {
- return SkPath::kConcave_Convexity;
+ return SkPathConvexityType::kConcave;
}
lastSx = sx;
lastSy = sy;
@@ -2045,7 +2045,7 @@
}
points = &firstPt;
}
- return SkPath::kConvex_Convexity; // that is, it may be convex, don't know yet
+ return SkPathConvexityType::kConvex; // that is, it may be convex, don't know yet
}
bool close() {
@@ -2125,13 +2125,13 @@
bool fIsFinite { true };
};
-SkPath::Convexity SkPath::internalGetConvexity() const {
+SkPathConvexityType SkPath::internalGetConvexity() const {
SkPoint pts[4];
SkPath::Verb verb;
SkPath::Iter iter(*this, true);
- auto setComputedConvexity = [=](Convexity convexity){
- SkASSERT(kUnknown_Convexity != convexity);
- this->setConvexity(convexity);
+ auto setComputedConvexity = [=](SkPathConvexityType convexity){
+ SkASSERT(SkPathConvexityType::kUnknown != convexity);
+ this->setConvexityType(convexity);
return convexity;
};
@@ -2149,15 +2149,15 @@
++points;
}
--points;
- SkPath::Convexity convexity = Convexicator::BySign(points, (int) (last - points));
- if (SkPath::kConcave_Convexity == convexity) {
- return setComputedConvexity(SkPath::kConcave_Convexity);
- } else if (SkPath::kUnknown_Convexity == convexity) {
- return SkPath::kUnknown_Convexity;
+ SkPathConvexityType convexity = Convexicator::BySign(points, (int) (last - points));
+ if (SkPathConvexityType::kConcave == convexity) {
+ return setComputedConvexity(SkPathConvexityType::kConcave);
+ } else if (SkPathConvexityType::kUnknown == convexity) {
+ return SkPathConvexityType::kUnknown;
}
iter.setPath(*this, true);
} else if (!this->isFinite()) {
- return kUnknown_Convexity;
+ return SkPathConvexityType::kUnknown;
}
int contourCount = 0;
@@ -2165,16 +2165,16 @@
Convexicator state;
auto setFail = [=](){
if (!state.isFinite()) {
- return SkPath::kUnknown_Convexity;
+ return SkPathConvexityType::kUnknown;
}
- return setComputedConvexity(SkPath::kConcave_Convexity);
+ return setComputedConvexity(SkPathConvexityType::kConcave);
};
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
switch (verb) {
case kMove_Verb:
if (++contourCount > 1) {
- return setComputedConvexity(kConcave_Convexity);
+ return setComputedConvexity(SkPathConvexityType::kConcave);
}
state.setMovePt(pts[0]);
count = 0;
@@ -2198,7 +2198,7 @@
break;
default:
SkDEBUGFAIL("bad verb");
- return setComputedConvexity(kConcave_Convexity);
+ return setComputedConvexity(SkPathConvexityType::kConcave);
}
for (int i = 1; i <= count; i++) {
if (!state.addPt(pts[i])) {
@@ -2211,16 +2211,16 @@
if (state.getFirstDirection() == SkPathPriv::kUnknown_FirstDirection
&& !this->getBounds().isEmpty()) {
return setComputedConvexity(state.reversals() < 3 ?
- kConvex_Convexity : kConcave_Convexity);
+ SkPathConvexityType::kConvex : SkPathConvexityType::kConcave);
}
this->setFirstDirection(state.getFirstDirection());
}
- return setComputedConvexity(kConvex_Convexity);
+ return setComputedConvexity(SkPathConvexityType::kConvex);
}
bool SkPathPriv::IsConvex(const SkPoint points[], int count) {
- SkPath::Convexity convexity = Convexicator::BySign(points, count);
- if (SkPath::kConvex_Convexity != convexity) {
+ SkPathConvexityType convexity = Convexicator::BySign(points, count);
+ if (SkPathConvexityType::kConvex != convexity) {
return false;
}
Convexicator state;
@@ -2417,7 +2417,7 @@
// We don't want to pay the cost for computing convexity if it is unknown,
// so we call getConvexityOrUnknown() instead of isConvex().
- if (path.getConvexityOrUnknown() == SkPath::kConvex_Convexity) {
+ if (path.getConvexityTypeOrUnknown() == SkPathConvexityType::kConvex) {
SkASSERT(path.getFirstDirection() == kUnknown_FirstDirection);
*dir = static_cast<FirstDirection>(path.getFirstDirection());
return false;
@@ -3010,7 +3010,7 @@
return conic.chopIntoQuadsPOW2(pts, pow2);
}
-bool SkPathPriv::IsSimpleClosedRect(const SkPath& path, SkRect* rect, SkPath::Direction* direction,
+bool SkPathPriv::IsSimpleClosedRect(const SkPath& path, SkRect* rect, SkPathDirection* direction,
unsigned* start) {
if (path.getSegmentMasks() != SkPath::kLine_SegmentMask) {
return false;
@@ -3080,22 +3080,22 @@
switch (sortFlags) {
case 0b00:
rect->setLTRB(rectPts[0].fX, rectPts[0].fY, rectPts[2].fX, rectPts[2].fY);
- *direction = vec03IsVertical ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
+ *direction = vec03IsVertical ? SkPathDirection::kCW : SkPathDirection::kCCW;
*start = 0;
break;
case 0b01:
rect->setLTRB(rectPts[2].fX, rectPts[0].fY, rectPts[0].fX, rectPts[2].fY);
- *direction = vec03IsVertical ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ *direction = vec03IsVertical ? SkPathDirection::kCCW : SkPathDirection::kCW;
*start = 1;
break;
case 0b10:
rect->setLTRB(rectPts[0].fX, rectPts[2].fY, rectPts[2].fX, rectPts[0].fY);
- *direction = vec03IsVertical ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ *direction = vec03IsVertical ? SkPathDirection::kCCW : SkPathDirection::kCW;
*start = 3;
break;
case 0b11:
rect->setLTRB(rectPts[2].fX, rectPts[2].fY, rectPts[0].fX, rectPts[0].fY);
- *direction = vec03IsVertical ? SkPath::kCW_Direction : SkPath::kCCW_Direction;
+ *direction = vec03IsVertical ? SkPathDirection::kCW : SkPathDirection::kCCW;
*start = 2;
break;
}
@@ -3157,7 +3157,7 @@
if (useCenter) {
path->close();
}
- path->setConvexity(convex ? SkPath::kConvex_Convexity : SkPath::kConcave_Convexity);
+ path->setConvexityType(convex ? SkPathConvexityType::kConvex : SkPathConvexityType::kConcave);
path->setFirstDirection(firstDir);
}
@@ -3276,7 +3276,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
bool SkPathPriv::IsRectContour(const SkPath& path, bool allowPartial, int* currVerb,
- const SkPoint** ptsPtr, bool* isClosed, SkPath::Direction* direction,
+ const SkPoint** ptsPtr, bool* isClosed, SkPathDirection* direction,
SkRect* rect) {
int corners = 0;
SkPoint closeXY; // used to determine if final line falls on a diagonal
@@ -3409,17 +3409,17 @@
}
if (direction) {
*direction = directions[0] == ((directions[1] + 1) & 3) ?
- SkPath::kCW_Direction : SkPath::kCCW_Direction;
+ SkPathDirection::kCW : SkPathDirection::kCCW;
}
return true;
}
-bool SkPathPriv::IsNestedFillRects(const SkPath& path, SkRect rects[2], SkPath::Direction dirs[2]) {
+bool SkPathPriv::IsNestedFillRects(const SkPath& path, SkRect rects[2], SkPathDirection dirs[2]) {
SkDEBUGCODE(path.validate();)
int currVerb = 0;
const SkPoint* pts = path.fPathRef->points();
- SkPath::Direction testDirs[2];
+ SkPathDirection testDirs[2];
SkRect testRects[2];
if (!IsRectContour(path, true, &currVerb, &pts, nullptr, &testDirs[0], &testRects[0])) {
return false;
diff --git a/src/core/SkPathMakers.h b/src/core/SkPathMakers.h
index a4ef7e1..8e668e5 100644
--- a/src/core/SkPathMakers.h
+++ b/src/core/SkPathMakers.h
@@ -8,15 +8,15 @@
#ifndef SkPathMakers_DEFINED
#define SkPathMakers_DEFINED
-#include "include/core/SkPath.h" // just for direction
+#include "include/core/SkPathTypes.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
template <unsigned N> class SkPath_PointIterator {
public:
- SkPath_PointIterator(SkPath::Direction dir, unsigned startIndex)
+ SkPath_PointIterator(SkPathDirection dir, unsigned startIndex)
: fCurrent(startIndex % N)
- , fAdvance(dir == SkPath::kCW_Direction ? 1 : N - 1) { }
+ , fAdvance(dir == SkPathDirection::kCW ? 1 : N - 1) { }
const SkPoint& current() const {
SkASSERT(fCurrent < N);
@@ -38,7 +38,7 @@
class SkPath_RectPointIterator : public SkPath_PointIterator<4> {
public:
- SkPath_RectPointIterator(const SkRect& rect, SkPath::Direction dir, unsigned startIndex)
+ SkPath_RectPointIterator(const SkRect& rect, SkPathDirection dir, unsigned startIndex)
: SkPath_PointIterator(dir, startIndex) {
fPts[0] = SkPoint::Make(rect.fLeft, rect.fTop);
@@ -50,7 +50,7 @@
class SkPath_OvalPointIterator : public SkPath_PointIterator<4> {
public:
- SkPath_OvalPointIterator(const SkRect& oval, SkPath::Direction dir, unsigned startIndex)
+ SkPath_OvalPointIterator(const SkRect& oval, SkPathDirection dir, unsigned startIndex)
: SkPath_PointIterator(dir, startIndex) {
const SkScalar cx = oval.centerX();
@@ -65,7 +65,7 @@
class SkPath_RRectPointIterator : public SkPath_PointIterator<8> {
public:
- SkPath_RRectPointIterator(const SkRRect& rrect, SkPath::Direction dir, unsigned startIndex)
+ SkPath_RRectPointIterator(const SkRRect& rrect, SkPathDirection dir, unsigned startIndex)
: SkPath_PointIterator(dir, startIndex) {
const SkRect& bounds = rrect.getBounds();
diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h
index a018be4..803d8f4 100644
--- a/src/core/SkPathPriv.h
+++ b/src/core/SkPathPriv.h
@@ -10,6 +10,11 @@
#include "include/core/SkPath.h"
+static_assert(0 == static_cast<int>(SkPathFillType::kWinding), "fill_type_mismatch");
+static_assert(1 == static_cast<int>(SkPathFillType::kEvenOdd), "fill_type_mismatch");
+static_assert(2 == static_cast<int>(SkPathFillType::kInverseWinding), "fill_type_mismatch");
+static_assert(3 == static_cast<int>(SkPathFillType::kInverseEvenOdd), "fill_type_mismatch");
+
class SkPathPriv {
public:
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
@@ -19,12 +24,12 @@
#endif
enum FirstDirection : int {
- kCW_FirstDirection, // == SkPath::kCW_Direction
- kCCW_FirstDirection, // == SkPath::kCCW_Direction
+ kCW_FirstDirection, // == SkPathDirection::kCW
+ kCCW_FirstDirection, // == SkPathDirection::kCCW
kUnknown_FirstDirection,
};
- static FirstDirection AsFirstDirection(SkPath::Direction dir) {
+ static FirstDirection AsFirstDirection(SkPathDirection dir) {
// since we agree numerically for the values in Direction, we can just cast.
return (FirstDirection)dir;
}
@@ -96,7 +101,7 @@
* followed by four lines or a move followed by 3 lines and a close. None of the parameters are
* optional. This does not permit degenerate line or point rectangles.
*/
- static bool IsSimpleClosedRect(const SkPath& path, SkRect* rect, SkPath::Direction* direction,
+ static bool IsSimpleClosedRect(const SkPath& path, SkRect* rect, SkPathDirection* direction,
unsigned* start);
/**
@@ -177,7 +182,7 @@
return true though SkPath draws oval.
rect receives bounds of oval.
- dir receives SkPath::Direction of oval: kCW_Direction if clockwise, kCCW_Direction if
+ dir receives SkPathDirection of oval: kCW_Direction if clockwise, kCCW_Direction if
counterclockwise.
start receives start of oval: 0 for top, 1 for right, 2 for bottom, 3 for left.
@@ -186,15 +191,15 @@
Triggers performance optimizations on some GPU surface implementations.
@param rect storage for bounding SkRect of oval; may be nullptr
- @param dir storage for SkPath::Direction; may be nullptr
+ @param dir storage for SkPathDirection; may be nullptr
@param start storage for start of oval; may be nullptr
@return true if SkPath was constructed by method that reduces to oval
*/
- static bool IsOval(const SkPath& path, SkRect* rect, SkPath::Direction* dir, unsigned* start) {
+ static bool IsOval(const SkPath& path, SkRect* rect, SkPathDirection* dir, unsigned* start) {
bool isCCW = false;
bool result = path.fPathRef->isOval(rect, &isCCW, start);
if (dir && result) {
- *dir = isCCW ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ *dir = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
}
return result;
}
@@ -204,7 +209,7 @@
will not return true though SkPath draws SkRRect.
rrect receives bounds of SkRRect.
- dir receives SkPath::Direction of oval: kCW_Direction if clockwise, kCCW_Direction if
+ dir receives SkPathDirection of oval: kCW_Direction if clockwise, kCCW_Direction if
counterclockwise.
start receives start of SkRRect: 0 for top, 1 for right, 2 for bottom, 3 for left.
@@ -213,16 +218,16 @@
Triggers performance optimizations on some GPU surface implementations.
@param rrect storage for bounding SkRect of SkRRect; may be nullptr
- @param dir storage for SkPath::Direction; may be nullptr
+ @param dir storage for SkPathDirection; may be nullptr
@param start storage for start of SkRRect; may be nullptr
@return true if SkPath contains only SkRRect
*/
- static bool IsRRect(const SkPath& path, SkRRect* rrect, SkPath::Direction* dir,
+ static bool IsRRect(const SkPath& path, SkRRect* rrect, SkPathDirection* dir,
unsigned* start) {
bool isCCW = false;
bool result = path.fPathRef->isRRect(rrect, &isCCW, start);
if (dir && result) {
- *dir = isCCW ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ *dir = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
}
return result;
}
@@ -280,22 +285,37 @@
}
static bool IsRectContour(const SkPath&, bool allowPartial, int* currVerb,
- const SkPoint** ptsPtr, bool* isClosed, SkPath::Direction* direction,
+ const SkPoint** ptsPtr, bool* isClosed, SkPathDirection* direction,
SkRect* rect);
/** Returns true if SkPath is equivalent to nested SkRect pair when filled.
If false, rect and dirs are unchanged.
If true, rect and dirs are written to if not nullptr:
setting rect[0] to outer SkRect, and rect[1] to inner SkRect;
- setting dirs[0] to SkPath::Direction of outer SkRect, and dirs[1] to SkPath::Direction of
+ setting dirs[0] to SkPathDirection of outer SkRect, and dirs[1] to SkPathDirection of
inner SkRect.
@param rect storage for SkRect pair; may be nullptr
- @param dirs storage for SkPath::Direction pair; may be nullptr
+ @param dirs storage for SkPathDirection pair; may be nullptr
@return true if SkPath contains nested SkRect pair
*/
static bool IsNestedFillRects(const SkPath&, SkRect rect[2],
- SkPath::Direction dirs[2] = nullptr);
+ SkPathDirection dirs[2] = nullptr);
+
+ static bool IsInverseFillType(SkPathFillType fill) {
+ return (static_cast<int>(fill) & 2) != 0;
+ }
+
+ /** Returns equivalent SkPath::FillType representing SkPath fill inside its bounds.
+ .
+
+ @param fill one of: kWinding_FillType, kEvenOdd_FillType,
+ kInverseWinding_FillType, kInverseEvenOdd_FillType
+ @return fill, or kWinding_FillType or kEvenOdd_FillType if fill is inverted
+ */
+ static SkPathFillType ConvertToNonInverseFillType(SkPathFillType fill) {
+ return (SkPathFillType)(static_cast<int>(fill) & 1);
+ }
};
// Lightweight variant of SkPath::Iter that only returns segments (e.g. lines/conics).
diff --git a/src/core/SkPath_serial.cpp b/src/core/SkPath_serial.cpp
index 44fd146..5c94c04 100644
--- a/src/core/SkPath_serial.cpp
+++ b/src/core/SkPath_serial.cpp
@@ -169,15 +169,15 @@
uint8_t dir = (packed >> kDirection_SerializationShift) & 0x3;
FillType fillType = extract_filltype(packed);
- Direction rrectDir;
+ SkPathDirection rrectDir;
SkRRect rrect;
int32_t start;
switch (dir) {
case SkPathPriv::kCW_FirstDirection:
- rrectDir = kCW_Direction;
+ rrectDir = SkPathDirection::kCW;
break;
case SkPathPriv::kCCW_FirstDirection:
- rrectDir = kCCW_Direction;
+ rrectDir = SkPathDirection::kCCW;
break;
default:
return 0;
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index a734efa..1c32900 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -1391,7 +1391,7 @@
{
SkRect rect;
bool isClosed = false;
- SkPath::Direction dir;
+ SkPathDirection dir;
if (src.isRect(&rect, &isClosed, &dir) && isClosed) {
this->strokeRect(rect, dst, dir);
// our answer should preserve the inverseness of the src
@@ -1498,15 +1498,15 @@
}
}
-static SkPath::Direction reverse_direction(SkPath::Direction dir) {
- static const SkPath::Direction gOpposite[] = { SkPath::kCCW_Direction, SkPath::kCW_Direction };
- return gOpposite[dir];
+static SkPathDirection reverse_direction(SkPathDirection dir) {
+ static const SkPathDirection gOpposite[] = { SkPathDirection::kCCW, SkPathDirection::kCW };
+ return gOpposite[(int)dir];
}
-static void addBevel(SkPath* path, const SkRect& r, const SkRect& outer, SkPath::Direction dir) {
+static void addBevel(SkPath* path, const SkRect& r, const SkRect& outer, SkPathDirection dir) {
SkPoint pts[8];
- if (SkPath::kCW_Direction == dir) {
+ if (SkPathDirection::kCW == dir) {
pts[0].set(r.fLeft, outer.fTop);
pts[1].set(r.fRight, outer.fTop);
pts[2].set(outer.fRight, r.fTop);
@@ -1529,7 +1529,7 @@
}
void SkStroke::strokeRect(const SkRect& origRect, SkPath* dst,
- SkPath::Direction dir) const {
+ SkPathDirection dir) const {
SkASSERT(dst != nullptr);
dst->reset();
diff --git a/src/core/SkStroke.h b/src/core/SkStroke.h
index 66edf3d..b0458d3 100644
--- a/src/core/SkStroke.h
+++ b/src/core/SkStroke.h
@@ -62,7 +62,7 @@
* Stroke the specified rect, winding it in the specified direction..
*/
void strokeRect(const SkRect& rect, SkPath* result,
- SkPath::Direction = SkPath::kCW_Direction) const;
+ SkPathDirection = SkPathDirection::kCW) const;
void strokePath(const SkPath& path, SkPath*) const;
////////////////////////////////////////////////////////////////
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 0e1fc1a..bd8c894 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1415,7 +1415,7 @@
assert_alive(paint);
this->drawShapeUsingPathRenderer(
clip, std::move(paint), aa, viewMatrix,
- GrShape(SkRRect::MakeOval(oval), SkPath::kCW_Direction, 2, false, style));
+ GrShape(SkRRect::MakeOval(oval), SkPathDirection::kCW, 2, false, style));
}
void GrRenderTargetContext::drawArc(const GrClip& clip,
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 42aba5e..b348c78 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -232,7 +232,7 @@
gPath[2].lineTo(-50.0f, 31.0f);
for (size_t i = 0; i < SK_ARRAY_COUNT(gPath); i++) {
- SkASSERT(SkPath::kConvex_Convexity == gPath[i].getConvexity());
+ SkASSERT(SkPathConvexityType::kConvex == gPath[i].getConvexityType());
}
}
diff --git a/src/gpu/geometry/GrShape.cpp b/src/gpu/geometry/GrShape.cpp
index 4fc3472..bb4f92b 100644
--- a/src/gpu/geometry/GrShape.cpp
+++ b/src/gpu/geometry/GrShape.cpp
@@ -273,7 +273,7 @@
case Type::kRRect:
fRRectData.fRRect.writeToMemory(key);
key += SkRRect::kSizeInMemory / sizeof(uint32_t);
- *key = (fRRectData.fDir == SkPath::kCCW_Direction) ? (1 << 31) : 0;
+ *key = (fRRectData.fDir == SkPathDirection::kCCW) ? (1 << 31) : 0;
*key |= fRRectData.fInverted ? (1 << 30) : 0;
*key++ |= fRRectData.fStart;
SkASSERT(fRRectData.fStart < 8);
@@ -507,7 +507,7 @@
void GrShape::attemptToSimplifyPath() {
SkRect rect;
SkRRect rrect;
- SkPath::Direction rrectDir;
+ SkPathDirection rrectDir;
unsigned rrectStart;
bool inverted = this->path().isInverseFillType();
SkPoint pts[2];
diff --git a/src/gpu/geometry/GrShape.h b/src/gpu/geometry/GrShape.h
index 37f38f8..08146df 100644
--- a/src/gpu/geometry/GrShape.h
+++ b/src/gpu/geometry/GrShape.h
@@ -61,7 +61,7 @@
this->attemptToSimplifyRRect();
}
- GrShape(const SkRRect& rrect, SkPath::Direction dir, unsigned start, bool inverted,
+ GrShape(const SkRRect& rrect, SkPathDirection dir, unsigned start, bool inverted,
const GrStyle& style)
: fStyle(style) {
this->initType(Type::kRRect);
@@ -160,7 +160,7 @@
}
/** Returns the unstyled geometry as a rrect if possible. */
- bool asRRect(SkRRect* rrect, SkPath::Direction* dir, unsigned* start, bool* inverted) const {
+ bool asRRect(SkRRect* rrect, SkPathDirection* dir, unsigned* start, bool* inverted) const {
if (Type::kRRect != fType) {
return false;
}
@@ -255,7 +255,7 @@
return false;
}
- SkPath::Direction dirs[2];
+ SkPathDirection dirs[2];
if (!SkPathPriv::IsNestedFillRects(this->path(), rects, dirs)) {
return false;
}
@@ -554,11 +554,11 @@
static constexpr SkPath::FillType kDefaultPathInverseFillType =
SkPath::kInverseEvenOdd_FillType;
- static constexpr SkPath::Direction kDefaultRRectDir = SkPath::kCW_Direction;
+ static constexpr SkPathDirection kDefaultRRectDir = SkPathDirection::kCW;
static constexpr unsigned kDefaultRRectStart = 0;
static unsigned DefaultRectDirAndStartIndex(const SkRect& rect, bool hasPathEffect,
- SkPath::Direction* dir) {
+ SkPathDirection* dir) {
*dir = kDefaultRRectDir;
// This comes from SkPath's interface. The default for adding a SkRect is counter clockwise
// beginning at index 0 (which happens to correspond to rrect index 0 or 7).
@@ -575,11 +575,11 @@
// 0 becomes start index 2 and times 2 to convert from rect the rrect indices.
return 2 * 2;
} else if (swapX) {
- *dir = SkPath::kCCW_Direction;
+ *dir = SkPathDirection::kCCW;
// 0 becomes start index 1 and times 2 to convert from rect the rrect indices.
return 2 * 1;
} else if (swapY) {
- *dir = SkPath::kCCW_Direction;
+ *dir = SkPathDirection::kCCW;
// 0 becomes start index 3 and times 2 to convert from rect the rrect indices.
return 2 * 3;
}
@@ -587,7 +587,7 @@
}
static unsigned DefaultRRectDirAndStartIndex(const SkRRect& rrect, bool hasPathEffect,
- SkPath::Direction* dir) {
+ SkPathDirection* dir) {
// This comes from SkPath's interface. The default for adding a SkRRect to a path is
// clockwise beginning at starting index 6.
static constexpr unsigned kPathRRectStartIdx = 6;
@@ -602,7 +602,7 @@
union {
struct {
SkRRect fRRect;
- SkPath::Direction fDir;
+ SkPathDirection fDir;
unsigned fStart;
bool fInverted;
} fRRectData;
diff --git a/src/gpu/ops/GrAAConvexTessellator.cpp b/src/gpu/ops/GrAAConvexTessellator.cpp
index c345c33..86aa54c 100644
--- a/src/gpu/ops/GrAAConvexTessellator.cpp
+++ b/src/gpu/ops/GrAAConvexTessellator.cpp
@@ -377,7 +377,7 @@
}
bool GrAAConvexTessellator::extractFromPath(const SkMatrix& m, const SkPath& path) {
- SkASSERT(SkPath::kConvex_Convexity == path.getConvexity());
+ SkASSERT(SkPathConvexityType::kConvex == path.getConvexityType());
SkRect bounds = path.getBounds();
m.mapRect(&bounds);
diff --git a/src/pathops/SkPathOpsAsWinding.cpp b/src/pathops/SkPathOpsAsWinding.cpp
index 3dfae2f..b3d92a9 100644
--- a/src/pathops/SkPathOpsAsWinding.cpp
+++ b/src/pathops/SkPathOpsAsWinding.cpp
@@ -13,7 +13,7 @@
using std::vector;
struct Contour {
- enum class Direction { // SkPath::Direction doesn't have 'none' state
+ enum class Direction { // SkPathDirection doesn't have 'none' state
kCCW = -1,
kNone,
kCW,
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index 7ee44de..da4e76b 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -2914,15 +2914,15 @@
int rectCount = path.isRectContours() ? path.rectContours(nullptr, nullptr) : 0;
if (rectCount > 0) {
SkTDArray<SkRect> rects;
- SkTDArray<SkPath::Direction> directions;
+ SkTDArray<SkPathDirection> directions;
rects.setCount(rectCount);
directions.setCount(rectCount);
path.rectContours(rects.begin(), directions.begin());
for (int contour = 0; contour < rectCount; ++contour) {
const SkRect& rect = rects[contour];
SkDebugf("path.addRect(%1.9g, %1.9g, %1.9g, %1.9g, %s);\n", rect.fLeft, rect.fTop,
- rect.fRight, rect.fBottom, directions[contour] == SkPath::kCCW_Direction
- ? "SkPath::kCCW_Direction" : "SkPath::kCW_Direction");
+ rect.fRight, rect.fBottom, directions[contour] == SkPathDirection::kCCW
+ ? "SkPathDirection::kCCW" : "SkPathDirection::kCW");
}
return;
}
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
index 9beedfb..0564b0f 100644
--- a/src/pdf/SkPDFUtils.cpp
+++ b/src/pdf/SkPDFUtils.cpp
@@ -128,10 +128,10 @@
SkRect rect;
bool isClosed; // Both closure and direction need to be checked.
- SkPath::Direction direction;
+ SkPathDirection direction;
if (path.isRect(&rect, &isClosed, &direction) &&
isClosed &&
- (SkPath::kCW_Direction == direction ||
+ (SkPathDirection::kCW == direction ||
SkPath::kEvenOdd_FillType == path.getFillType()))
{
SkPDFUtils::AppendRectangle(rect, content);
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index 92e4bdb..f94df30 100644
--- a/src/utils/SkDashPath.cpp
+++ b/src/utils/SkDashPath.cpp
@@ -425,7 +425,7 @@
} while (meas.nextContour());
if (segCount > 1) {
- dst->setConvexity(SkPath::kConcave_Convexity);
+ dst->setConvexityType(SkPathConvexityType::kConcave);
}
return true;
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 03318bb..2f1482e 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -1310,7 +1310,7 @@
}
static int lpath_isConvex(lua_State* L) {
- bool isConvex = SkPath::kConvex_Convexity == get_obj<SkPath>(L, 1)->getConvexity();
+ bool isConvex = get_obj<SkPath>(L, 1)->isConvex();
SkLua(L).pushBool(isConvex);
return 1;
}
diff --git a/src/utils/SkParsePath.cpp b/src/utils/SkParsePath.cpp
index 8c9469b..688daae 100644
--- a/src/utils/SkParsePath.cpp
+++ b/src/utils/SkParsePath.cpp
@@ -175,7 +175,7 @@
&& (data = skip_sep(data))
&& (data = find_points(data, &points[0], 1, relative, &c))) {
path.arcTo(radii, angle, (SkPath::ArcSize) SkToBool(largeArc),
- (SkPath::Direction) !SkToBool(sweep), points[0]);
+ (SkPathDirection) !SkToBool(sweep), points[0]);
path.getLastPt(&c);
}
} break;
diff --git a/tests/DefaultPathRendererTest.cpp b/tests/DefaultPathRendererTest.cpp
index 7b5f903..c4498a2 100644
--- a/tests/DefaultPathRendererTest.cpp
+++ b/tests/DefaultPathRendererTest.cpp
@@ -55,8 +55,8 @@
static SkPath make_path(const SkRect& outer, int inset, SkPath::FillType fill) {
SkPath p;
- p.addRect(outer, SkPath::kCW_Direction);
- p.addRect(outer.makeInset(inset, inset), SkPath::kCCW_Direction);
+ p.addRect(outer, SkPathDirection::kCW);
+ p.addRect(outer.makeInset(inset, inset), SkPathDirection::kCCW);
p.setFillType(fill);
return p;
}
diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp
index 22fecd7..5431aaa 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -65,8 +65,8 @@
SkPath oval1, oval2;
const SkRect rect = SkRect::MakeWH(100, 50);
- oval1.addOval(rect, SkPath::kCW_Direction);
- oval2.addOval(rect, SkPath::kCCW_Direction);
+ oval1.addOval(rect, SkPathDirection::kCW);
+ oval2.addOval(rect, SkPathDirection::kCCW);
fill_and_stroke(canvas, oval1, oval2, nullptr);
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp
index 548bd04..44d43be 100644
--- a/tests/GrShapeTest.cpp
+++ b/tests/GrShapeTest.cpp
@@ -119,7 +119,7 @@
// The asRRect() output params are all initialized just to silence compiler warnings about
// uninitialized variables.
SkRRect rrectA = SkRRect::MakeEmpty(), rrectB = SkRRect::MakeEmpty();
- SkPath::Direction dirA = SkPath::kCW_Direction, dirB = SkPath::kCW_Direction;
+ SkPathDirection dirA = SkPathDirection::kCW, dirB = SkPathDirection::kCW;
unsigned startA = ~0U, startB = ~0U;
bool invertedA = true, invertedB = true;
@@ -457,7 +457,7 @@
}
SkRect rect;
unsigned start;
- SkPath::Direction dir;
+ SkPathDirection dir;
if (SkPathPriv::IsSimpleClosedRect(fPath, &rect, &dir, &start)) {
return RectGeo(rect).strokeAndFillIsConvertedToFill(paint);
}
@@ -1577,7 +1577,7 @@
dashAndStrokeEmptyRRectCase.compare(reporter, fillEmptyCase,
TestCase::kAllSame_ComparisonExpecation);
- static constexpr SkPath::Direction kDir = SkPath::kCCW_Direction;
+ static constexpr SkPathDirection kDir = SkPathDirection::kCCW;
static constexpr int kStart = 0;
TestCase fillInvertedEmptyRRectCase(reporter, emptyRRect, kDir, kStart, true, GrStyle(fill));
@@ -1646,21 +1646,21 @@
static constexpr Style kStyleCnt = static_cast<Style>(SK_ARRAY_COUNT(strokeRecs));
auto index = [](bool inverted,
- SkPath::Direction dir,
+ SkPathDirection dir,
unsigned start,
Style style,
bool dash) -> int {
return inverted * (2 * 8 * kStyleCnt * 2) +
- dir * ( 8 * kStyleCnt * 2) +
+ (int)dir * ( 8 * kStyleCnt * 2) +
start * ( kStyleCnt * 2) +
style * ( 2) +
dash;
};
- static const SkPath::Direction kSecondDirection = static_cast<SkPath::Direction>(1);
+ static const SkPathDirection kSecondDirection = static_cast<SkPathDirection>(1);
const int cnt = index(true, kSecondDirection, 7, static_cast<Style>(kStyleCnt - 1), true) + 1;
SkAutoTArray<GrShape> shapes(cnt);
for (bool inverted : {false, true}) {
- for (SkPath::Direction dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (SkPathDirection dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (unsigned start = 0; start < 8; ++start) {
for (Style style : {kFill, kStroke, kHairline, kStrokeAndFill}) {
for (bool dash : {false, true}) {
@@ -1676,7 +1676,7 @@
// Get the keys for some example shape instances that we'll use for comparision against the
// rest.
- static constexpr SkPath::Direction kExamplesDir = SkPath::kCW_Direction;
+ static constexpr SkPathDirection kExamplesDir = SkPathDirection::kCW;
static constexpr unsigned kExamplesStart = 0;
const GrShape& exampleFillCase = shapes[index(false, kExamplesDir, kExamplesStart, kFill,
false)];
@@ -1720,61 +1720,61 @@
// These are dummy initializations to suppress warnings.
SkRRect queryRR = SkRRect::MakeEmpty();
- SkPath::Direction queryDir = SkPath::kCW_Direction;
+ SkPathDirection queryDir = SkPathDirection::kCW;
unsigned queryStart = ~0U;
bool queryInverted = true;
REPORTER_ASSERT(r, exampleFillCase.asRRect(&queryRR, &queryDir, &queryStart, &queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, !queryInverted);
REPORTER_ASSERT(r, exampleInvFillCase.asRRect(&queryRR, &queryDir, &queryStart,
&queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, queryInverted);
REPORTER_ASSERT(r, exampleStrokeAndFillCase.asRRect(&queryRR, &queryDir, &queryStart,
&queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, !queryInverted);
REPORTER_ASSERT(r, exampleInvStrokeAndFillCase.asRRect(&queryRR, &queryDir, &queryStart,
&queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, queryInverted);
REPORTER_ASSERT(r, exampleHairlineCase.asRRect(&queryRR, &queryDir, &queryStart,
&queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, !queryInverted);
REPORTER_ASSERT(r, exampleInvHairlineCase.asRRect(&queryRR, &queryDir, &queryStart,
&queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, queryInverted);
REPORTER_ASSERT(r, exampleStrokeCase.asRRect(&queryRR, &queryDir, &queryStart, &queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, !queryInverted);
REPORTER_ASSERT(r, exampleInvStrokeCase.asRRect(&queryRR, &queryDir, &queryStart,
&queryInverted));
REPORTER_ASSERT(r, queryRR == rrect);
- REPORTER_ASSERT(r, SkPath::kCW_Direction == queryDir);
+ REPORTER_ASSERT(r, SkPathDirection::kCW == queryDir);
REPORTER_ASSERT(r, 0 == queryStart);
REPORTER_ASSERT(r, queryInverted);
@@ -1791,7 +1791,7 @@
REPORTER_ASSERT(r, exampleInvStrokeAndFillCaseKey == exampleInvHairlineCaseKey);
for (bool inverted : {false, true}) {
- for (SkPath::Direction dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (SkPathDirection dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (unsigned start = 0; start < 8; ++start) {
for (bool dash : {false, true}) {
const GrShape& fillCase = shapes[index(inverted, dir, start, kFill, dash)];
@@ -1846,7 +1846,7 @@
// The pre-style case for the dash will match the non-dash example iff the
// dir and start match (dir=cw, start=0).
- if (0 == expectedStart && SkPath::kCW_Direction == dir) {
+ if (0 == expectedStart && SkPathDirection::kCW == dir) {
e.compare(r, f, TestCase::kSameUpToPE_ComparisonExpecation);
g.compare(r, h, TestCase::kSameUpToPE_ComparisonExpecation);
} else {
diff --git a/tests/PathOpsAsWindingTest.cpp b/tests/PathOpsAsWindingTest.cpp
index e92dc0d..81d3192 100644
--- a/tests/PathOpsAsWindingTest.cpp
+++ b/tests/PathOpsAsWindingTest.cpp
@@ -9,9 +9,9 @@
#include "tests/PathOpsThreadedCommon.h"
#include "tests/Test.h"
-static SkPath build_squircle(SkPath::Verb verb, const SkRect& rect, SkPath::Direction dir) {
+static SkPath build_squircle(SkPath::Verb verb, const SkRect& rect, SkPathDirection dir) {
SkPath path;
- bool reverse = SkPath::kCCW_Direction == dir;
+ bool reverse = SkPathDirection::kCCW == dir;
switch (verb) {
case SkPath::kLine_Verb:
path.addRect(rect, dir);
@@ -119,8 +119,8 @@
const std::initializer_list<SkPoint> revBccw = {{1, 2}, {2, 2}, {2, 1}, {1, 1}};
const std::initializer_list<SkPoint> revBcw = {{2, 1}, {2, 2}, {1, 2}, {1, 1}};
for (bool aFirst : {false, true}) {
- for (auto dirA : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
- for (auto dirB : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dirA : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
+ for (auto dirB : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
test.reset();
test.setFillType(SkPath::kEvenOdd_FillType);
if (aFirst) {
@@ -140,7 +140,7 @@
if (dirA != dirB) {
test.addRect(rectB, dirB);
} else {
- test.addPoly(SkPath::kCW_Direction == dirA ? revBccw : revBcw, true);
+ test.addPoly(SkPathDirection::kCW == dirA ? revBccw : revBcw, true);
}
if (!aFirst) {
test.addRect(rectA, dirA);
@@ -156,8 +156,8 @@
// Test curve types with donuts. Create a donut with outer and hole in all directions.
// After converting to winding, all donuts should have a hole in the middle.
for (bool aFirst : {false, true}) {
- for (auto dirA : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
- for (auto dirB : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dirA : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
+ for (auto dirB : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (auto curveA : { SkPath::kLine_Verb, SkPath::kQuad_Verb,
SkPath::kConic_Verb, SkPath::kCubic_Verb } ) {
SkPath pathA = build_squircle(curveA, rectA, dirA);
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp
index 1d42010..86d4f49 100644
--- a/tests/PathOpsBuilderTest.cpp
+++ b/tests/PathOpsBuilderTest.cpp
@@ -26,25 +26,25 @@
SkPath rectPath;
rectPath.setFillType(SkPath::kEvenOdd_FillType);
- rectPath.addRect(0, 1, 2, 3, SkPath::kCW_Direction);
+ rectPath.addRect(0, 1, 2, 3, SkPathDirection::kCW);
builder.add(rectPath, kUnion_SkPathOp);
REPORTER_ASSERT(reporter, builder.resolve(&result));
bool closed;
- SkPath::Direction dir;
+ SkPathDirection dir;
REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
- REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction);
+ REPORTER_ASSERT(reporter, dir == SkPathDirection::kCCW);
int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result);
REPORTER_ASSERT(reporter, pixelDiff == 0);
rectPath.reset();
rectPath.setFillType(SkPath::kEvenOdd_FillType);
- rectPath.addRect(0, 1, 2, 3, SkPath::kCCW_Direction);
+ rectPath.addRect(0, 1, 2, 3, SkPathDirection::kCCW);
builder.add(rectPath, kUnion_SkPathOp);
REPORTER_ASSERT(reporter, builder.resolve(&result));
REPORTER_ASSERT(reporter, result.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
- REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction);
+ REPORTER_ASSERT(reporter, dir == SkPathDirection::kCCW);
REPORTER_ASSERT(reporter, rectPath == result);
builder.add(rectPath, kDifference_SkPathOp);
@@ -52,8 +52,8 @@
REPORTER_ASSERT(reporter, result.isEmpty());
SkPath rect2, rect3;
- rect2.addRect(2, 1, 4, 3, SkPath::kCW_Direction);
- rect3.addRect(4, 1, 5, 3, SkPath::kCCW_Direction);
+ rect2.addRect(2, 1, 4, 3, SkPathDirection::kCW);
+ rect3.addRect(4, 1, 5, 3, SkPathDirection::kCCW);
builder.add(rectPath, kUnion_SkPathOp);
builder.add(rect2, kUnion_SkPathOp);
builder.add(rect3, kUnion_SkPathOp);
@@ -65,9 +65,9 @@
REPORTER_ASSERT(reporter, result.getBounds() == expected);
SkPath circle1, circle2, circle3;
- circle1.addCircle(5, 6, 4, SkPath::kCW_Direction);
- circle2.addCircle(7, 4, 8, SkPath::kCCW_Direction);
- circle3.addCircle(6, 5, 6, SkPath::kCW_Direction);
+ circle1.addCircle(5, 6, 4, SkPathDirection::kCW);
+ circle2.addCircle(7, 4, 8, SkPathDirection::kCCW);
+ circle3.addCircle(6, 5, 6, SkPathDirection::kCW);
SkPath opCompare;
Op(circle1, circle2, kUnion_SkPathOp, &opCompare);
Op(opCompare, circle3, kDifference_SkPathOp, &opCompare);
@@ -139,11 +139,11 @@
DEF_TEST(BuilderIssue502792_2, reporter) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(2, 2, 3, 3, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(2, 2, 3, 3, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(3, 3, 4, 4, SkPath::kCW_Direction);
- pathB.addRect(3, 3, 4, 4, SkPath::kCW_Direction);
+ pathB.addRect(3, 3, 4, 4, SkPathDirection::kCW);
+ pathB.addRect(3, 3, 4, 4, SkPathDirection::kCW);
SkOpBuilder builder;
builder.add(path, kUnion_SkPathOp);
builder.add(pathB, kDifference_SkPathOp);
diff --git a/tests/PathOpsInverseTest.cpp b/tests/PathOpsInverseTest.cpp
index 6f0034b..9228f89 100644
--- a/tests/PathOpsInverseTest.cpp
+++ b/tests/PathOpsInverseTest.cpp
@@ -7,22 +7,22 @@
#include "tests/PathOpsExtendedTest.h"
DEF_TEST(PathOpsInverse, reporter) {
+ const SkPathDirection dirs[] = {SkPathDirection::kCW, SkPathDirection::kCCW};
SkPath one, two;
int testCount = 0;
for (int op = kDifference_SkPathOp; op <= kReverseDifference_SkPathOp; ++op) {
for (int oneFill = SkPath::kWinding_FillType; oneFill <= SkPath::kInverseEvenOdd_FillType;
++oneFill) {
- for (int oneDir = SkPath::kCW_Direction; oneDir != SkPath::kCCW_Direction; ++oneDir) {
+ for (auto oneDir : dirs) {
one.reset();
one.setFillType((SkPath::FillType) oneFill);
- one.addRect(0, 0, 6, 6, (SkPath::Direction) oneDir);
+ one.addRect(0, 0, 6, 6, oneDir);
for (int twoFill = SkPath::kWinding_FillType;
twoFill <= SkPath::kInverseEvenOdd_FillType; ++twoFill) {
- for (int twoDir = SkPath::kCW_Direction; twoDir != SkPath::kCCW_Direction;
- ++twoDir) {
+ for (auto twoDir : dirs) {
two.reset();
two.setFillType((SkPath::FillType) twoFill);
- two.addRect(3, 3, 9, 9, (SkPath::Direction) twoDir);
+ two.addRect(3, 3, 9, 9, twoDir);
SkString testName;
testName.printf("inverseTest%d", ++testCount);
testPathOp(reporter, one, two, (SkPathOp) op, testName.c_str());
diff --git a/tests/PathOpsOpCircleThreadedTest.cpp b/tests/PathOpsOpCircleThreadedTest.cpp
index cb99acd..9358c0c 100644
--- a/tests/PathOpsOpCircleThreadedTest.cpp
+++ b/tests/PathOpsOpCircleThreadedTest.cpp
@@ -27,10 +27,10 @@
SkPath pathA, pathB;
pathA.setFillType((SkPath::FillType) e);
pathA.addCircle(SkIntToScalar(state.fA), SkIntToScalar(state.fB), SkIntToScalar(state.fC),
- state.fD ? SkPath::kCW_Direction : SkPath::kCCW_Direction);
+ state.fD ? SkPathDirection::kCW : SkPathDirection::kCCW);
pathB.setFillType((SkPath::FillType) f);
pathB.addCircle(SkIntToScalar(a), SkIntToScalar(b), SkIntToScalar(c),
- d ? SkPath::kCW_Direction : SkPath::kCCW_Direction);
+ d ? SkPathDirection::kCW : SkPathDirection::kCCW);
for (int op = 0 ; op <= kXOR_SkPathOp; ++op) {
if (state.fReporter->verbose()) {
pathStr.printf("static void circlesOp%d(skiatest::Reporter* reporter,"
@@ -40,12 +40,12 @@
e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kEvenOdd_FillType
? "EvenOdd" : "?UNDEFINED");
pathStr.appendf(" path.addCircle(%d, %d, %d, %s);\n", state.fA, state.fB,
- state.fC, state.fD ? "SkPath::kCW_Direction" : "SkPath::kCCW_Direction");
+ state.fC, state.fD ? "SkPathDirection::kCW" : "SkPathDirection::kCCW");
pathStr.appendf(" pathB.setFillType(SkPath::k%s_FillType);\n",
f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kEvenOdd_FillType
? "EvenOdd" : "?UNDEFINED");
pathStr.appendf(" pathB.addCircle(%d, %d, %d, %s);\n", a, b,
- c, d ? "SkPath::kCW_Direction" : "SkPath::kCCW_Direction");
+ c, d ? "SkPathDirection::kCW" : "SkPathDirection::kCCW");
pathStr.appendf(" testPathOp(reporter, path, pathB, %s, filename);\n",
SkPathOpsDebug::OpStr((SkPathOp) op));
pathStr.appendf("}\n");
diff --git a/tests/PathOpsOpRectThreadedTest.cpp b/tests/PathOpsOpRectThreadedTest.cpp
index 059ece2..cb8ee6c 100644
--- a/tests/PathOpsOpRectThreadedTest.cpp
+++ b/tests/PathOpsOpRectThreadedTest.cpp
@@ -34,15 +34,15 @@
SkPath pathA, pathB;
pathA.setFillType((SkPath::FillType) e);
pathA.addRect(SkIntToScalar(state.fA), SkIntToScalar(state.fA), SkIntToScalar(state.fB),
- SkIntToScalar(state.fB), SkPath::kCW_Direction);
+ SkIntToScalar(state.fB), SkPathDirection::kCW);
pathA.addRect(SkIntToScalar(state.fC), SkIntToScalar(state.fC), SkIntToScalar(state.fD),
- SkIntToScalar(state.fD), SkPath::kCW_Direction);
+ SkIntToScalar(state.fD), SkPathDirection::kCW);
pathA.close();
pathB.setFillType((SkPath::FillType) f);
pathB.addRect(SkIntToScalar(a), SkIntToScalar(a), SkIntToScalar(b),
- SkIntToScalar(b), SkPath::kCW_Direction);
+ SkIntToScalar(b), SkPathDirection::kCW);
pathB.addRect(SkIntToScalar(c), SkIntToScalar(c), SkIntToScalar(d),
- SkIntToScalar(d), SkPath::kCW_Direction);
+ SkIntToScalar(d), SkPathDirection::kCW);
pathB.close();
for (int op = 0 ; op <= kXOR_SkPathOp; ++op) {
if (state.fReporter->verbose()) {
@@ -54,16 +54,16 @@
e == SkPath::kWinding_FillType ? "Winding" : e == SkPath::kEvenOdd_FillType
? "EvenOdd" : "?UNDEFINED");
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kCW_Direction);\n", state.fA, state.fA, state.fB, state.fB);
+ " SkPathDirection::kCW);\n", state.fA, state.fA, state.fB, state.fB);
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kCW_Direction);\n", state.fC, state.fC, state.fD, state.fD);
+ " SkPathDirection::kCW);\n", state.fC, state.fC, state.fD, state.fD);
pathStr.appendf(" pathB.setFillType(SkPath::k%s_FillType);\n",
f == SkPath::kWinding_FillType ? "Winding" : f == SkPath::kEvenOdd_FillType
? "EvenOdd" : "?UNDEFINED");
pathStr.appendf(" pathB.addRect(%d, %d, %d, %d,"
- " SkPath::kCW_Direction);\n", a, a, b, b);
+ " SkPathDirection::kCW);\n", a, a, b, b);
pathStr.appendf(" pathB.addRect(%d, %d, %d, %d,"
- " SkPath::kCW_Direction);\n", c, c, d, d);
+ " SkPathDirection::kCW);\n", c, c, d, d);
pathStr.appendf(" testPathOp(reporter, path, pathB, %s, filename);\n",
SkPathOpsDebug::OpStr((SkPathOp) op));
pathStr.appendf("}\n\n");
@@ -124,13 +124,13 @@
pathA.setFillType((SkPath::FillType) e);
if (a) {
pathA.addRect(SkIntToScalar(state.fA), SkIntToScalar(state.fA), SkIntToScalar(state.fB) + c,
- SkIntToScalar(state.fB), SkPath::kCW_Direction);
+ SkIntToScalar(state.fB), SkPathDirection::kCW);
}
pathA.close();
pathB.setFillType((SkPath::FillType) f);
if (b) {
pathB.addRect(SkIntToScalar(state.fC), SkIntToScalar(state.fC), SkIntToScalar(state.fD) + d,
- SkIntToScalar(state.fD), SkPath::kCW_Direction);
+ SkIntToScalar(state.fD), SkPathDirection::kCW);
}
pathB.close();
const char* fillTypeStr[] = { "Winding", "EvenOdd", "InverseWinding", "InverseEvenOdd" };
@@ -143,12 +143,12 @@
pathStr.appendf(" path.setFillType(SkPath::k%s_FillType);\n", fillTypeStr[e]);
if (a) {
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kCW_Direction);\n", state.fA, state.fA, state.fB + c, state.fB);
+ " SkPathDirection::kCW);\n", state.fA, state.fA, state.fB + c, state.fB);
}
pathStr.appendf(" path.setFillType(SkPath::k%s_FillType);\n", fillTypeStr[f]);
if (b) {
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kCW_Direction);\n", state.fC, state.fC, state.fD + d, state.fD);
+ " SkPathDirection::kCW);\n", state.fC, state.fC, state.fD + d, state.fD);
}
pathStr.appendf(" testPathOp(reporter, path, pathB, %s, filename);\n",
SkPathOpsDebug::OpStr((SkPathOp) op));
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 0f652c7..ef00b20 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -378,156 +378,156 @@
static void testIntersect1(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(3, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kIntersect_SkPathOp, filename);
}
static void testUnion1(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(3, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kUnion_SkPathOp, filename);
}
static void testDiff1(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(3, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kDifference_SkPathOp, filename);
}
static void testXor1(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(3, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(3, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kXOR_SkPathOp, filename);
}
static void testIntersect2(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(0, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kIntersect_SkPathOp, filename);
}
static void testUnion2(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(0, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kUnion_SkPathOp, filename);
}
static void testDiff2(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(0, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kDifference_SkPathOp, filename);
}
static void testXor2(skiatest::Reporter* reporter, const char* filename) {
SkPath one, two;
- one.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- two.addRect(0, 3, 9, 9, SkPath::kCW_Direction);
+ one.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ two.addRect(0, 3, 9, 9, SkPathDirection::kCW);
testPathOp(reporter, one, two, kXOR_SkPathOp, filename);
}
static void testOp1d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp2d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp3d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(1, 1, 2, 2, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp1u(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 3, 3, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
}
static void testOp4d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp5d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ path.addRect(0, 0, 3, 3, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp6d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 3, 3, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp7d(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void testOp2u(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
- pathB.addRect(1, 1, 2, 2, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 3, 3, SkPathDirection::kCW);
+ pathB.addRect(1, 1, 2, 2, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kUnion_SkPathOp, filename);
}
@@ -2025,22 +2025,22 @@
static void rectOp1i(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
}
static void rectOp2i(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 3, 3, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
}
@@ -3173,11 +3173,11 @@
static void cubicOp110(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 4, 4, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
}
@@ -3439,22 +3439,22 @@
static void rects3(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 4, 4, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 4, 4, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void rects4(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 2, 2, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 3, 3, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 3, 3, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
@@ -3522,21 +3522,21 @@
static void testRect1(skiatest::Reporter* reporter, const char* filename) {
SkPath path, path2;
- path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
- path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
-// path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCCW);
+ path.addRect(30, 20, 50, 50, SkPathDirection::kCCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+// path.addRect(32, 24, 36, 41, SkPathDirection::kCCW);
testPathOp(reporter, path, path2, kUnion_SkPathOp, filename);
}
static void testRect2(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(4, 4, 5, 5, SkPath::kCW_Direction);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(4, 4, 5, 5, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(0, 0, 2, 2, SkPath::kCW_Direction);
- pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 2, 2, SkPathDirection::kCW);
+ pathB.addRect(0, 0, 6, 6, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
@@ -3898,18 +3898,18 @@
static void circlesOp1(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
+ path.addCircle(0, 1, 2, SkPathDirection::kCCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addCircle(0, 1, 1, SkPath::kCW_Direction);
+ pathB.addCircle(0, 1, 1, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
static void circlesOp2(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addCircle(0, 1, 4, SkPath::kCCW_Direction);
+ path.addCircle(0, 1, 4, SkPathDirection::kCCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addCircle(0, 4, 3, SkPath::kCW_Direction);
+ pathB.addCircle(0, 4, 3, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
}
@@ -3971,11 +3971,11 @@
static void rects5(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
- path.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
+ path.addRect(5, 5, 6, 6, SkPathDirection::kCW);
+ path.addRect(5, 5, 6, 6, SkPathDirection::kCW);
pathB.setFillType(SkPath::kEvenOdd_FillType);
- pathB.addRect(0, 0, 6, 6, SkPath::kCW_Direction);
- pathB.addRect(5, 5, 6, 6, SkPath::kCW_Direction);
+ pathB.addRect(0, 0, 6, 6, SkPathDirection::kCW);
+ pathB.addRect(5, 5, 6, 6, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
@@ -4004,9 +4004,9 @@
static void circlesOp3(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
+ path.addCircle(0, 1, 2, SkPathDirection::kCCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addCircle(3, 5, 3, SkPath::kCW_Direction);
+ pathB.addCircle(3, 5, 3, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
@@ -5399,9 +5399,9 @@
static void circlesOp4(skiatest::Reporter* reporter, const char* filename) {
SkPath path, pathB;
path.setFillType(SkPath::kWinding_FillType);
- path.addCircle(0, 1, 5, SkPath::kCW_Direction);
+ path.addCircle(0, 1, 5, SkPathDirection::kCW);
pathB.setFillType(SkPath::kWinding_FillType);
- pathB.addCircle(0, 1, 0, SkPath::kCW_Direction);
+ pathB.addCircle(0, 1, 0, SkPathDirection::kCW);
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp
index e3b58a3..914eef1 100644
--- a/tests/PathOpsSimplifyRectThreadedTest.cpp
+++ b/tests/PathOpsSimplifyRectThreadedTest.cpp
@@ -22,13 +22,13 @@
SkASSERT(data);
PathOpsThreadState& state = *data;
int aShape = state.fA & 0x03;
- SkPath::Direction aCW = state.fA >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ SkPathDirection aCW = state.fA >> 2 ? SkPathDirection::kCCW : SkPathDirection::kCW;
int bShape = state.fB & 0x03;
- SkPath::Direction bCW = state.fB >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ SkPathDirection bCW = state.fB >> 2 ? SkPathDirection::kCCW : SkPathDirection::kCW;
int cShape = state.fC & 0x03;
- SkPath::Direction cCW = state.fC >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ SkPathDirection cCW = state.fC >> 2 ? SkPathDirection::kCCW : SkPathDirection::kCW;
int dShape = state.fD & 0x03;
- SkPath::Direction dCW = state.fD >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ SkPathDirection dCW = state.fD >> 2 ? SkPathDirection::kCCW : SkPathDirection::kCW;
for (int aXAlign = 0; aXAlign < 5; ++aXAlign) {
for (int aYAlign = 0; aYAlign < 5; ++aYAlign) {
for (int bXAlign = 0; bXAlign < 5; ++bXAlign) {
@@ -67,7 +67,8 @@
aCW);
if (state.fReporter->verbose()) {
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kC%sW_Direction);\n", l, t, r, b, aCW ? "C" : "");
+ " SkPathDirection::kC%sW);\n", l, t, r, b,
+ aCW == SkPathDirection::kCCW ? "C" : "");
}
} else {
aXAlign = 5;
@@ -98,7 +99,8 @@
bCW);
if (state.fReporter->verbose()) {
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kC%sW_Direction);\n", l, t, r, b, bCW ? "C" : "");
+ " SkPathDirection::kC%sW);\n", l, t, r, b,
+ bCW == SkPathDirection::kCCW ? "C" : "");
}
} else {
bXAlign = 5;
@@ -129,7 +131,8 @@
cCW);
if (state.fReporter->verbose()) {
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kC%sW_Direction);\n", l, t, r, b, cCW ? "C" : "");
+ " SkPathDirection::kC%sW);\n", l, t, r, b,
+ cCW == SkPathDirection::kCCW ? "C" : "");
}
} else {
cXAlign = 5;
@@ -160,7 +163,8 @@
dCW);
if (state.fReporter->verbose()) {
pathStr.appendf(" path.addRect(%d, %d, %d, %d,"
- " SkPath::kC%sW_Direction);\n", l, t, r, b, dCW ? "C" : "");
+ " SkPathDirection::kC%sW);\n", l, t, r, b,
+ dCW == SkPathDirection::kCCW ? "C" : "");
}
} else {
dXAlign = 5;
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index e95a902..3771141 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -441,134 +441,134 @@
static void testLine15(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine15x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine16(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 4, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine16x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 4, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine17(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine17x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine18(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 4, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 4, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine18x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 4, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 4, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine19(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 16, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 16, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine19x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 16, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 16, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine20(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 12, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine20x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 12, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine21(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 16, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 16, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine21x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 16, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 16, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine22(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine22x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine23(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine23x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
@@ -601,1081 +601,1081 @@
static void testLine24(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine24x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine25(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine25x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine26(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 12, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine26x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 12, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 12, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine27(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 8, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 8, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine27x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 8, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 8, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine28(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine28x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine29(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 12, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine29x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 18, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 18, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 12, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine30(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 4, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 4, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine30x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 4, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 4, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine31(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 4, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine31x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 4, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 4, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine32(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine32x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine33(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine33x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine34(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine34x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine35(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 0, 18, 18, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine35x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 0, 18, 18, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine36(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 10, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 12, 18, 18, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine36x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 10, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 12, 18, 18, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine37(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(18, 24, 30, 30, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine37x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(18, 24, 30, 30, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine38(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
- path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(6, 12, 18, 18, SkPathDirection::kCW);
+ path.addRect(12, 12, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine38x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(6, 12, 18, 18, SkPath::kCW_Direction);
- path.addRect(12, 12, 21, 21, SkPath::kCW_Direction);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(6, 12, 18, 18, SkPathDirection::kCW);
+ path.addRect(12, 12, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine40(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 18, 24, 24, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 18, 24, 24, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine40x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 18, 24, 24, SkPath::kCW_Direction);
- path.addRect(4, 16, 13, 13, SkPath::kCW_Direction);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 18, 24, 24, SkPathDirection::kCW);
+ path.addRect(4, 16, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine41(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(18, 24, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine41x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(18, 24, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(18, 24, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine42(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(8, 16, 17, 17, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(8, 16, 17, 17, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine42x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(8, 16, 17, 17, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(8, 16, 17, 17, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine43(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 24, 18, 18, SkPath::kCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 24, 18, 18, SkPathDirection::kCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine43x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 24, 18, 18, SkPath::kCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 24, 18, 18, SkPathDirection::kCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine44(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 32, 27, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine44x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 32, 27, 36, SkPath::kCCW_Direction);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 32, 27, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine45(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine45x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine46(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 0, 36, 36, SkPathDirection::kCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine46x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCW_Direction);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 0, 36, 36, SkPathDirection::kCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine47(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine47x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine48(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine48x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 6, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine49(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine49x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine50(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
+ path.addRect(10, 30, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine50x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
+ path.addRect(10, 30, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine51(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine51x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine52(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
+ path.addRect(0, 30, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 20, 18, 30, SkPathDirection::kCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine52x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
+ path.addRect(0, 30, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 20, 18, 30, SkPathDirection::kCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine53(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
+ path.addRect(10, 30, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 20, 24, 30, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine53x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
+ path.addRect(10, 30, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 20, 24, 30, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine54(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
- path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 0, 18, 18, SkPathDirection::kCW);
+ path.addRect(8, 4, 17, 17, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine54x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 0, 18, 18, SkPath::kCW_Direction);
- path.addRect(8, 4, 17, 17, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 0, 18, 18, SkPathDirection::kCW);
+ path.addRect(8, 4, 17, 17, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine55(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 6, 18, 18, SkPath::kCW_Direction);
- path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 6, 18, 18, SkPathDirection::kCW);
+ path.addRect(4, 4, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine55x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 6, 18, 18, SkPath::kCW_Direction);
- path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 6, 18, 18, SkPathDirection::kCW);
+ path.addRect(4, 4, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine56(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(18, 20, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(18, 20, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine56x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(18, 20, 30, 30, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(18, 20, 30, 30, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine57(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
- path.addRect(20, 0, 30, 40, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(20, 0, 40, 40, SkPathDirection::kCW);
+ path.addRect(20, 0, 30, 40, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine57x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
- path.addRect(20, 0, 30, 40, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(20, 0, 40, 40, SkPathDirection::kCW);
+ path.addRect(20, 0, 30, 40, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine58(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction);
- path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCCW);
+ path.addRect(0, 12, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine58x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 0, 12, 12, SkPath::kCCW_Direction);
- path.addRect(0, 12, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCCW);
+ path.addRect(0, 12, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine59(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction);
- path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 6, 18, 18, SkPathDirection::kCCW);
+ path.addRect(4, 4, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine59x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 6, 18, 18, SkPath::kCCW_Direction);
- path.addRect(4, 4, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 6, 18, 18, SkPathDirection::kCCW);
+ path.addRect(4, 4, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine60(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 12, 18, 18, SkPathDirection::kCCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine60x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(6, 12, 18, 18, SkPath::kCCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(6, 12, 18, 18, SkPathDirection::kCCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine61(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(12, 0, 24, 24, SkPathDirection::kCCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine61x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(12, 0, 24, 24, SkPathDirection::kCCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine62(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine62x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine63(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 10, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine63x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 10, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 6, 12, 12, SkPath::kCCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 10, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 6, 12, 12, SkPathDirection::kCCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine64(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 6, 30, 30, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 6, 30, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine64x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 6, 30, 30, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 6, 30, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine65(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
- path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 0, 36, 36, SkPathDirection::kCW);
+ path.addRect(32, 6, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine65x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 0, 36, 36, SkPath::kCW_Direction);
- path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 0, 36, 36, SkPathDirection::kCW);
+ path.addRect(32, 6, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine66(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
- path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 30, 20, 20, SkPathDirection::kCW);
+ path.addRect(12, 20, 24, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine66x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 30, 20, 20, SkPath::kCW_Direction);
- path.addRect(12, 20, 24, 30, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 30, 20, 20, SkPathDirection::kCW);
+ path.addRect(12, 20, 24, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine67(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine67x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68a(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
- path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCW);
+ path.addRect(1, 2, 4, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68ax(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
- path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCW);
+ path.addRect(1, 2, 4, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68b(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68bx(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68c(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
- path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCW);
+ path.addRect(1, 2, 4, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68cx(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCW_Direction);
- path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCW);
+ path.addRect(1, 2, 4, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68d(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 4, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68dx(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 4, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 4, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68e(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68ex(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68f(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68fx(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68g(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68gx(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68h(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine68hx(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 8, 8, SkPath::kCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(2, 2, 6, 6, SkPath::kCCW_Direction);
- path.addRect(1, 2, 2, 2, SkPath::kCW_Direction);
+ path.addRect(0, 0, 8, 8, SkPathDirection::kCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(2, 2, 6, 6, SkPathDirection::kCCW);
+ path.addRect(1, 2, 2, 2, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine69(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine69x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine70(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 24, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 24, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine70x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 24, 12, 12, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 24, 12, 12, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine71(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(12, 0, 24, 24, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(12, 0, 24, 24, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine71x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 20, 20, SkPath::kCW_Direction);
- path.addRect(12, 0, 24, 24, SkPath::kCW_Direction);
- path.addRect(12, 32, 21, 36, SkPath::kCW_Direction);
+ path.addRect(0, 0, 20, 20, SkPathDirection::kCW);
+ path.addRect(12, 0, 24, 24, SkPathDirection::kCW);
+ path.addRect(12, 32, 21, 36, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine72(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(6, 20, 18, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine72x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 40, 30, 30, SkPath::kCW_Direction);
- path.addRect(6, 20, 18, 30, SkPath::kCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 40, 30, 30, SkPathDirection::kCW);
+ path.addRect(6, 20, 18, 30, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine73(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 40, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 40, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine73x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(0, 40, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
- path.addRect(0, 0, 9, 9, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(0, 40, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCW);
+ path.addRect(0, 0, 9, 9, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine74(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(20, 30, 40, 40, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(20, 30, 40, 40, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(32, 24, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine74x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(20, 30, 40, 40, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(20, 30, 40, 40, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(32, 24, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine75(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction);
- path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCCW);
+ path.addRect(18, 0, 30, 30, SkPathDirection::kCCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine75x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCW_Direction);
- path.addRect(10, 0, 30, 30, SkPath::kCCW_Direction);
- path.addRect(18, 0, 30, 30, SkPath::kCCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCW);
+ path.addRect(10, 0, 30, 30, SkPathDirection::kCCW);
+ path.addRect(18, 0, 30, 30, SkPathDirection::kCCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine76(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(36, 0, 66, 60, SkPath::kCW_Direction);
- path.addRect(10, 20, 40, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(36, 0, 66, 60, SkPathDirection::kCW);
+ path.addRect(10, 20, 40, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(32, 6, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine76x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(36, 0, 66, 60, SkPath::kCW_Direction);
- path.addRect(10, 20, 40, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(36, 0, 66, 60, SkPathDirection::kCW);
+ path.addRect(10, 20, 40, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(32, 6, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine77(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
- path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
+ path.addRect(20, 0, 40, 40, SkPathDirection::kCW);
+ path.addRect(24, 6, 36, 36, SkPathDirection::kCCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine77x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(20, 0, 40, 40, SkPath::kCW_Direction);
- path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
+ path.addRect(20, 0, 40, 40, SkPathDirection::kCW);
+ path.addRect(24, 6, 36, 36, SkPathDirection::kCCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine78(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 30, 60, SkPath::kCW_Direction);
- path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction);
- path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 30, 60, SkPathDirection::kCW);
+ path.addRect(10, 20, 30, 30, SkPathDirection::kCCW);
+ path.addRect(18, 20, 30, 30, SkPathDirection::kCCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine78x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 30, 60, SkPath::kCW_Direction);
- path.addRect(10, 20, 30, 30, SkPath::kCCW_Direction);
- path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 30, 60, SkPathDirection::kCW);
+ path.addRect(10, 20, 30, 30, SkPathDirection::kCCW);
+ path.addRect(18, 20, 30, 30, SkPathDirection::kCCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine79(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 36, 60, 30, SkPath::kCW_Direction);
- path.addRect(10, 30, 40, 30, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 36, 60, 30, SkPathDirection::kCW);
+ path.addRect(10, 30, 40, 30, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine79x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 36, 60, 30, SkPath::kCW_Direction);
- path.addRect(10, 30, 40, 30, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(0, 36, 60, 30, SkPathDirection::kCW);
+ path.addRect(10, 30, 40, 30, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine81(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(-1, -1, 3, 3, SkPath::kCW_Direction);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(0, 0, 1, 1, SkPath::kCW_Direction);
- path.addRect(1, 1, 2, 2, SkPath::kCCW_Direction);
+ path.addRect(-1, -1, 3, 3, SkPathDirection::kCW);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(0, 0, 1, 1, SkPathDirection::kCW);
+ path.addRect(1, 1, 2, 2, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
@@ -2259,43 +2259,43 @@
static void testLine1a(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kWinding_FillType);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 0, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 0, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine1ax(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 0, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 0, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine2ax(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 20, 20, 20, SkPath::kCW_Direction);
- path.addRect(0, 20, 12, 30, SkPath::kCW_Direction);
- path.addRect(12, 0, 21, 21, SkPath::kCCW_Direction);
+ path.addRect(0, 20, 20, 20, SkPathDirection::kCW);
+ path.addRect(0, 20, 12, 30, SkPathDirection::kCW);
+ path.addRect(12, 0, 21, 21, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine3aax(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
- path.addRect(18, 20, 30, 30, SkPath::kCCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(10, 30, 30, 30, SkPathDirection::kCW);
+ path.addRect(18, 20, 30, 30, SkPathDirection::kCCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine4ax(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(10, 30, 30, 30, SkPath::kCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(0, 32, 9, 36, SkPath::kCCW_Direction);
+ path.addRect(10, 30, 30, 30, SkPathDirection::kCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(0, 32, 9, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
@@ -3403,109 +3403,109 @@
static void testLine82(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(20, 0, 40, 40, SkPath::kCCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(24, 32, 33, 36, SkPath::kCCW_Direction);
+ path.addRect(20, 0, 40, 40, SkPathDirection::kCCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(24, 32, 33, 36, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine82a(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine82b(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine82c(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine82d(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine82e(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine82f(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine82g(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine82h(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 6, 10, SkPath::kCCW_Direction);
- path.addRect(2, 2, 4, 4, SkPath::kCCW_Direction);
- path.addRect(2, 6, 4, 8, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 6, 10, SkPathDirection::kCCW);
+ path.addRect(2, 2, 4, 4, SkPathDirection::kCCW);
+ path.addRect(2, 6, 4, 8, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine83(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
-path.addRect(10, 30, 30, 40, SkPath::kCCW_Direction);
-path.addRect(0, 12, 12, 18, SkPath::kCCW_Direction);
-path.addRect(4, 13, 13, 16, SkPath::kCCW_Direction);
+path.addRect(10, 30, 30, 40, SkPathDirection::kCCW);
+path.addRect(0, 12, 12, 18, SkPathDirection::kCCW);
+path.addRect(4, 13, 13, 16, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine84(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 12, 60, 30, SkPath::kCCW_Direction);
- path.addRect(10, 20, 40, 30, SkPath::kCW_Direction);
- path.addRect(0, 12, 12, 12, SkPath::kCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCW_Direction);
+ path.addRect(0, 12, 60, 30, SkPathDirection::kCCW);
+ path.addRect(10, 20, 40, 30, SkPathDirection::kCW);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCW);
testSimplify(reporter, path, filename);
}
static void testLine84x(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 12, 60, 30, SkPath::kCCW_Direction);
- path.addRect(10, 20, 40, 30, SkPath::kCCW_Direction);
- path.addRect(0, 12, 12, 12, SkPath::kCCW_Direction);
- path.addRect(4, 12, 13, 13, SkPath::kCCW_Direction);
+ path.addRect(0, 12, 60, 30, SkPathDirection::kCCW);
+ path.addRect(10, 20, 40, 30, SkPathDirection::kCCW);
+ path.addRect(0, 12, 12, 12, SkPathDirection::kCCW);
+ path.addRect(4, 12, 13, 13, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testLine85(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(36, 0, 66, 60, SkPath::kCCW_Direction);
- path.addRect(20, 0, 40, 40, SkPath::kCCW_Direction);
- path.addRect(12, 0, 24, 24, SkPath::kCCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(36, 0, 66, 60, SkPathDirection::kCCW);
+ path.addRect(20, 0, 40, 40, SkPathDirection::kCCW);
+ path.addRect(12, 0, 24, 24, SkPathDirection::kCCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
@@ -3847,10 +3847,10 @@
static void testRect1s(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
- path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
- path.addRect(30, 20, 50, 50, SkPath::kCCW_Direction);
- path.addRect(24, 20, 36, 30, SkPath::kCCW_Direction);
- path.addRect(32, 24, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCCW);
+ path.addRect(30, 20, 50, 50, SkPathDirection::kCCW);
+ path.addRect(24, 20, 36, 30, SkPathDirection::kCCW);
+ path.addRect(32, 24, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
@@ -4674,20 +4674,20 @@
static void testRect3(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction);
- path.addRect(10, 30, 40, 30, SkPath::kCCW_Direction);
- path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction);
- path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 60, 60, SkPathDirection::kCCW);
+ path.addRect(10, 30, 40, 30, SkPathDirection::kCCW);
+ path.addRect(24, 6, 36, 36, SkPathDirection::kCCW);
+ path.addRect(32, 6, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
static void testRect4(skiatest::Reporter* reporter, const char* filename) {
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
- path.addRect(0, 0, 30, 60, SkPath::kCCW_Direction);
- path.addRect(10, 0, 40, 30, SkPath::kCCW_Direction);
- path.addRect(20, 0, 30, 40, SkPath::kCCW_Direction);
- path.addRect(32, 0, 36, 41, SkPath::kCCW_Direction);
+ path.addRect(0, 0, 30, 60, SkPathDirection::kCCW);
+ path.addRect(10, 0, 40, 30, SkPathDirection::kCCW);
+ path.addRect(20, 0, 30, 40, SkPathDirection::kCCW);
+ path.addRect(32, 0, 36, 41, SkPathDirection::kCCW);
testSimplify(reporter, path, filename);
}
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 1aec3b6..5c0d748 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1129,13 +1129,13 @@
// Test two donuts, each wound a different direction. Only the outer contour
// determines the cheap direction
path.reset();
- path.addCircle(0, 0, SkIntToScalar(2), SkPath::kCW_Direction);
- path.addCircle(0, 0, SkIntToScalar(1), SkPath::kCCW_Direction);
+ path.addCircle(0, 0, SkIntToScalar(2), SkPathDirection::kCW);
+ path.addCircle(0, 0, SkIntToScalar(1), SkPathDirection::kCCW);
check_direction(reporter, path, SkPathPriv::kCW_FirstDirection);
path.reset();
- path.addCircle(0, 0, SkIntToScalar(1), SkPath::kCW_Direction);
- path.addCircle(0, 0, SkIntToScalar(2), SkPath::kCCW_Direction);
+ path.addCircle(0, 0, SkIntToScalar(1), SkPathDirection::kCW);
+ path.addCircle(0, 0, SkIntToScalar(2), SkPathDirection::kCCW);
check_direction(reporter, path, SkPathPriv::kCCW_FirstDirection);
// triangle with one point really far from the origin.
@@ -1155,7 +1155,7 @@
path.lineTo(1, 1e7f);
path.lineTo(1e7f, 2e7f);
path.close();
- REPORTER_ASSERT(reporter, SkPath::kConvex_Convexity == path.getConvexity());
+ REPORTER_ASSERT(reporter, path.isConvex());
check_direction(reporter, path, SkPathPriv::kCCW_FirstDirection);
}
@@ -1317,9 +1317,9 @@
}
static void check_convexity(skiatest::Reporter* reporter, const SkPath& path,
- SkPath::Convexity expected) {
+ SkPathConvexityType expected) {
SkPath copy(path); // we make a copy so that we don't cache the result on the passed in path.
- SkPath::Convexity c = copy.getConvexity();
+ SkPathConvexityType c = copy.getConvexityType();
REPORTER_ASSERT(reporter, c == expected);
// test points-by-array interface
@@ -1335,7 +1335,7 @@
(void) path.getPoints(&points.front(), points.size());
int skip = initialMoves - 1;
bool isConvex = SkPathPriv::IsConvex(&points.front() + skip, points.size() - skip);
- REPORTER_ASSERT(reporter, isConvex == (SkPath::kConvex_Convexity == expected));
+ REPORTER_ASSERT(reporter, isConvex == (SkPathConvexityType::kConvex == expected));
}
}
@@ -1346,10 +1346,10 @@
tinyConvexPolygon.lineTo(600.148962f, 800.142338f);
tinyConvexPolygon.lineTo(600.134891f, 800.137724f);
tinyConvexPolygon.close();
- tinyConvexPolygon.getConvexity();
+ tinyConvexPolygon.getConvexityType();
// This is convex, but so small that it fails many of our checks, and the three "backwards"
// bends convince the checker that it's concave. That's okay though, we draw it correctly.
- check_convexity(reporter, tinyConvexPolygon, SkPath::kConcave_Convexity);
+ check_convexity(reporter, tinyConvexPolygon, SkPathConvexityType::kConcave);
check_direction(reporter, tinyConvexPolygon, SkPathPriv::kCW_FirstDirection);
SkPath platTriangle;
@@ -1357,7 +1357,7 @@
platTriangle.lineTo(200, 0);
platTriangle.lineTo(100, 0.04f);
platTriangle.close();
- platTriangle.getConvexity();
+ platTriangle.getConvexityType();
check_direction(reporter, platTriangle, SkPathPriv::kCW_FirstDirection);
platTriangle.reset();
@@ -1365,7 +1365,7 @@
platTriangle.lineTo(200, 0);
platTriangle.lineTo(100, 0.03f);
platTriangle.close();
- platTriangle.getConvexity();
+ platTriangle.getConvexityType();
check_direction(reporter, platTriangle, SkPathPriv::kCW_FirstDirection);
}
@@ -1373,14 +1373,14 @@
SkPath pt;
pt.moveTo(0, 0);
pt.close();
- check_convexity(reporter, pt, SkPath::kConvex_Convexity);
+ check_convexity(reporter, pt, SkPathConvexityType::kConvex);
check_direction(reporter, pt, SkPathPriv::kUnknown_FirstDirection);
SkPath line;
line.moveTo(12*SK_Scalar1, 20*SK_Scalar1);
line.lineTo(-12*SK_Scalar1, -20*SK_Scalar1);
line.close();
- check_convexity(reporter, line, SkPath::kConvex_Convexity);
+ check_convexity(reporter, line, SkPathConvexityType::kConvex);
check_direction(reporter, line, SkPathPriv::kUnknown_FirstDirection);
SkPath triLeft;
@@ -1388,7 +1388,7 @@
triLeft.lineTo(SK_Scalar1, 0);
triLeft.lineTo(SK_Scalar1, SK_Scalar1);
triLeft.close();
- check_convexity(reporter, triLeft, SkPath::kConvex_Convexity);
+ check_convexity(reporter, triLeft, SkPathConvexityType::kConvex);
check_direction(reporter, triLeft, SkPathPriv::kCW_FirstDirection);
SkPath triRight;
@@ -1396,7 +1396,7 @@
triRight.lineTo(-SK_Scalar1, 0);
triRight.lineTo(SK_Scalar1, SK_Scalar1);
triRight.close();
- check_convexity(reporter, triRight, SkPath::kConvex_Convexity);
+ check_convexity(reporter, triRight, SkPathConvexityType::kConvex);
check_direction(reporter, triRight, SkPathPriv::kCCW_FirstDirection);
SkPath square;
@@ -1405,7 +1405,7 @@
square.lineTo(SK_Scalar1, SK_Scalar1);
square.lineTo(0, SK_Scalar1);
square.close();
- check_convexity(reporter, square, SkPath::kConvex_Convexity);
+ check_convexity(reporter, square, SkPathConvexityType::kConvex);
check_direction(reporter, square, SkPathPriv::kCW_FirstDirection);
SkPath redundantSquare;
@@ -1422,7 +1422,7 @@
redundantSquare.lineTo(0, SK_Scalar1);
redundantSquare.lineTo(0, SK_Scalar1);
redundantSquare.close();
- check_convexity(reporter, redundantSquare, SkPath::kConvex_Convexity);
+ check_convexity(reporter, redundantSquare, SkPathConvexityType::kConvex);
check_direction(reporter, redundantSquare, SkPathPriv::kCW_FirstDirection);
SkPath bowTie;
@@ -1439,7 +1439,7 @@
bowTie.lineTo(0, SK_Scalar1);
bowTie.lineTo(0, SK_Scalar1);
bowTie.close();
- check_convexity(reporter, bowTie, SkPath::kConcave_Convexity);
+ check_convexity(reporter, bowTie, SkPathConvexityType::kConcave);
check_direction(reporter, bowTie, kDontCheckDir);
SkPath spiral;
@@ -1451,7 +1451,7 @@
spiral.lineTo(50*SK_Scalar1, 50*SK_Scalar1);
spiral.lineTo(50*SK_Scalar1, 75*SK_Scalar1);
spiral.close();
- check_convexity(reporter, spiral, SkPath::kConcave_Convexity);
+ check_convexity(reporter, spiral, SkPathConvexityType::kConcave);
check_direction(reporter, spiral, kDontCheckDir);
SkPath dent;
@@ -1461,7 +1461,7 @@
dent.lineTo(-50*SK_Scalar1, 200*SK_Scalar1);
dent.lineTo(-200*SK_Scalar1, 100*SK_Scalar1);
dent.close();
- check_convexity(reporter, dent, SkPath::kConcave_Convexity);
+ check_convexity(reporter, dent, SkPathConvexityType::kConcave);
check_direction(reporter, dent, SkPathPriv::kCW_FirstDirection);
// https://bug.skia.org/2235
@@ -1478,7 +1478,7 @@
SkStrokeRec stroke(SkStrokeRec::kFill_InitStyle);
stroke.setStrokeStyle(2 * SK_Scalar1);
stroke.applyToPath(&strokedSin, strokedSin);
- check_convexity(reporter, strokedSin, SkPath::kConcave_Convexity);
+ check_convexity(reporter, strokedSin, SkPathConvexityType::kConcave);
check_direction(reporter, strokedSin, kDontCheckDir);
// http://crbug.com/412640
@@ -1489,7 +1489,7 @@
degenerateConcave.lineTo(41.446522f, 376.25f);
degenerateConcave.lineTo(-55.971577f, 460.0f);
degenerateConcave.lineTo(41.446522f, 376.25f);
- check_convexity(reporter, degenerateConcave, SkPath::kConcave_Convexity);
+ check_convexity(reporter, degenerateConcave, SkPathConvexityType::kConcave);
check_direction(reporter, degenerateConcave, SkPathPriv::kUnknown_FirstDirection);
// http://crbug.com/433683
@@ -1504,7 +1504,7 @@
badFirstVector.lineTo(504.912292f, 316.389648f);
badFirstVector.lineTo(501.087708f, 319.610352f);
badFirstVector.close();
- check_convexity(reporter, badFirstVector, SkPath::kConcave_Convexity);
+ check_convexity(reporter, badFirstVector, SkPathConvexityType::kConcave);
// http://crbug.com/993330
SkPath falseBackEdge;
@@ -1519,30 +1519,30 @@
-151.46727226799754f, -419.98027663161537f,
-217.83430557928145f, -382.14948768484857f);
falseBackEdge.close();
- check_convexity(reporter, falseBackEdge, SkPath::kConcave_Convexity);
+ check_convexity(reporter, falseBackEdge, SkPathConvexityType::kConcave);
}
static void test_convexity_doubleback(skiatest::Reporter* reporter) {
SkPath doubleback;
doubleback.lineTo(1, 1);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.lineTo(2, 2);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.reset();
doubleback.lineTo(1, 0);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.lineTo(2, 0);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.lineTo(1, 0);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.reset();
doubleback.quadTo(1, 1, 2, 2);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.reset();
doubleback.quadTo(1, 0, 2, 0);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
doubleback.quadTo(1, 0, 0, 0);
- check_convexity(reporter, doubleback, SkPath::kConvex_Convexity);
+ check_convexity(reporter, doubleback, SkPathConvexityType::kConvex);
}
static void check_convex_bounds(skiatest::Reporter* reporter, const SkPath& p,
@@ -1582,39 +1582,39 @@
static void test_convexity(skiatest::Reporter* reporter) {
SkPath path;
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
path.addCircle(0, 0, SkIntToScalar(10));
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
path.addCircle(0, 0, SkIntToScalar(10)); // 2nd circle
- check_convexity(reporter, path, SkPath::kConcave_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConcave);
path.reset();
- path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPath::kCCW_Direction);
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPathDirection::kCCW);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCCW_FirstDirection));
path.reset();
- path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPath::kCW_Direction);
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ path.addRect(0, 0, SkIntToScalar(10), SkIntToScalar(10), SkPathDirection::kCW);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection));
path.reset();
path.quadTo(100, 100, 50, 50); // This from GM:convexpaths
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
static const struct {
const char* fPathStr;
- SkPath::Convexity fExpectedConvexity;
+ SkPathConvexityType fExpectedConvexity;
SkPathPriv::FirstDirection fExpectedDirection;
} gRec[] = {
- { "", SkPath::kConvex_Convexity, SkPathPriv::kUnknown_FirstDirection },
- { "0 0", SkPath::kConvex_Convexity, SkPathPriv::kUnknown_FirstDirection },
- { "0 0 10 10", SkPath::kConvex_Convexity, SkPathPriv::kUnknown_FirstDirection },
- { "0 0 10 10 20 20 0 0 10 10", SkPath::kConcave_Convexity, SkPathPriv::kUnknown_FirstDirection },
- { "0 0 10 10 10 20", SkPath::kConvex_Convexity, SkPathPriv::kCW_FirstDirection },
- { "0 0 10 10 10 0", SkPath::kConvex_Convexity, SkPathPriv::kCCW_FirstDirection },
- { "0 0 10 10 10 0 0 10", SkPath::kConcave_Convexity, kDontCheckDir },
- { "0 0 10 0 0 10 -10 -10", SkPath::kConcave_Convexity, SkPathPriv::kCW_FirstDirection },
+ { "", SkPathConvexityType::kConvex, SkPathPriv::kUnknown_FirstDirection },
+ { "0 0", SkPathConvexityType::kConvex, SkPathPriv::kUnknown_FirstDirection },
+ { "0 0 10 10", SkPathConvexityType::kConvex, SkPathPriv::kUnknown_FirstDirection },
+ { "0 0 10 10 20 20 0 0 10 10", SkPathConvexityType::kConcave, SkPathPriv::kUnknown_FirstDirection },
+ { "0 0 10 10 10 20", SkPathConvexityType::kConvex, SkPathPriv::kCW_FirstDirection },
+ { "0 0 10 10 10 0", SkPathConvexityType::kConvex, SkPathPriv::kCCW_FirstDirection },
+ { "0 0 10 10 10 0 0 10", SkPathConvexityType::kConcave, kDontCheckDir },
+ { "0 0 10 0 0 10 -10 -10", SkPathConvexityType::kConcave, SkPathPriv::kCW_FirstDirection },
};
for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
@@ -1632,7 +1632,7 @@
REPORTER_ASSERT(reporter, !foundDir || gRec[i].fExpectedDirection == dir);
check_convexity(reporter, copy, gRec[i].fExpectedConvexity);
}
- REPORTER_ASSERT(reporter, gRec[i].fExpectedConvexity == path.getConvexity());
+ REPORTER_ASSERT(reporter, gRec[i].fExpectedConvexity == path.getConvexityType());
check_direction(reporter, path, gRec[i].fExpectedDirection);
}
@@ -1681,7 +1681,7 @@
case 11: path.cubicTo(nonFinitePts[i], axisAlignedPts[f], axisAlignedPts[g]); break;
case 12: path.moveTo(nonFinitePts[i]); break;
}
- check_convexity(reporter, path, SkPath::kUnknown_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kUnknown);
}
for (int index = 0; index < (int) (11 * axisAlignedPtsCount); ++index) {
@@ -1703,12 +1703,12 @@
case 10: path.cubicTo(axisAlignedPts[g], axisAlignedPts[f], axisAlignedPts[g]); break;
}
if (curveSelect == 0 || curveSelect == 1 || curveSelect == 2 || curveSelect == 5) {
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
} else {
SkPath copy(path); // we make a copy so that we don't cache the result on the passed in path.
- SkPath::Convexity c = copy.getConvexity();
- REPORTER_ASSERT(reporter, SkPath::kUnknown_Convexity == c
- || SkPath::kConcave_Convexity == c);
+ SkPathConvexityType c = copy.getConvexityType();
+ REPORTER_ASSERT(reporter, SkPathConvexityType::kUnknown == c
+ || SkPathConvexityType::kConcave == c);
}
}
@@ -1738,12 +1738,12 @@
case 10: path.cubicTo(diagonalPts[g], axisAlignedPts[f], diagonalPts[g]); break;
}
if (curveSelect == 0) {
- check_convexity(reporter, path, SkPath::kConvex_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConvex);
} else {
SkPath copy(path); // we make a copy so that we don't cache the result on the passed in path.
- SkPath::Convexity c = copy.getConvexity();
- REPORTER_ASSERT(reporter, SkPath::kUnknown_Convexity == c
- || SkPath::kConcave_Convexity == c);
+ SkPathConvexityType c = copy.getConvexityType();
+ REPORTER_ASSERT(reporter, SkPathConvexityType::kUnknown == c
+ || SkPathConvexityType::kConcave == c);
}
}
@@ -1756,7 +1756,7 @@
path.lineTo(SkBits2Float(0xbe917378), SkBits2Float(0xbd7ee1a9)); // -0.284084f, -0.0622269f
path.lineTo(SkBits2Float(0xbe9171db), SkBits2Float(0xbd7eeb5d)); // -0.284072f, -0.0622362f
path.close();
- check_convexity(reporter, path, SkPath::kConcave_Convexity);
+ check_convexity(reporter, path, SkPathConvexityType::kConcave);
}
@@ -1912,7 +1912,7 @@
swap(qRect.fTop, qRect.fBottom);
}
for (int d = 0; d < 2; ++d) {
- SkPath::Direction dir = d ? SkPath::kCCW_Direction : SkPath::kCW_Direction;
+ SkPathDirection dir = d ? SkPathDirection::kCCW : SkPathDirection::kCW;
path.reset();
path.addRect(kBaseRect, dir);
REPORTER_ASSERT(reporter, kQueries[q].fInRect ==
@@ -2156,7 +2156,7 @@
if (tests[testIndex].fIsRect) {
SkRect computed, expected;
bool isClosed;
- SkPath::Direction direction;
+ SkPathDirection direction;
SkPathPriv::FirstDirection cheapDirection;
int pointCount = tests[testIndex].fPointCount - (d2 == tests[testIndex].fPoints);
expected.setBounds(tests[testIndex].fPoints, pointCount);
@@ -2169,9 +2169,9 @@
SkRect computed;
computed.setLTRB(123, 456, 789, 1011);
for (auto c : {true, false})
- for (auto d : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto d : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
bool isClosed = c;
- SkPath::Direction direction = d;
+ SkPathDirection direction = d;
REPORTER_ASSERT(reporter, !path.isRect(&computed, &isClosed, &direction));
REPORTER_ASSERT(reporter, computed.fLeft == 123 && computed.fTop == 456);
REPORTER_ASSERT(reporter, computed.fRight == 789 && computed.fBottom == 1011);
@@ -2238,9 +2238,9 @@
}
static void check_simple_closed_rect(skiatest::Reporter* reporter, const SkPath& path,
- const SkRect& rect, SkPath::Direction dir, unsigned start) {
+ const SkRect& rect, SkPathDirection dir, unsigned start) {
SkRect r = SkRect::MakeEmpty();
- SkPath::Direction d = SkPath::kCCW_Direction;
+ SkPathDirection d = SkPathDirection::kCCW;
unsigned s = ~0U;
REPORTER_ASSERT(reporter, SkPathPriv::IsSimpleClosedRect(path, &r, &d, &s));
@@ -2252,14 +2252,14 @@
static void test_is_simple_closed_rect(skiatest::Reporter* reporter) {
using std::swap;
SkRect r = SkRect::MakeEmpty();
- SkPath::Direction d = SkPath::kCCW_Direction;
+ SkPathDirection d = SkPathDirection::kCCW;
unsigned s = ~0U;
const SkRect testRect = SkRect::MakeXYWH(10, 10, 50, 70);
const SkRect emptyRect = SkRect::MakeEmpty();
SkPath path;
for (int start = 0; start < 4; ++start) {
- for (auto dir : {SkPath::kCCW_Direction, SkPath::kCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCCW, SkPathDirection::kCW}) {
SkPath path;
path.addRect(testRect, dir, start);
check_simple_closed_rect(reporter, path, testRect, dir, start);
@@ -2316,9 +2316,9 @@
path2.addRect(degenRect, dir, start);
REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleClosedRect(path2, &r, &d, &s));
// An inverted rect makes a rect path, but changes the winding dir and start point.
- SkPath::Direction swapDir = (dir == SkPath::kCW_Direction)
- ? SkPath::kCCW_Direction
- : SkPath::kCW_Direction;
+ SkPathDirection swapDir = (dir == SkPathDirection::kCW)
+ ? SkPathDirection::kCCW
+ : SkPathDirection::kCW;
static constexpr unsigned kXSwapStarts[] = { 1, 0, 3, 2 };
static constexpr unsigned kYSwapStarts[] = { 3, 2, 1, 0 };
SkRect swapRect = testRect;
@@ -2340,7 +2340,7 @@
path.lineTo(1, 1);
path.lineTo(0, 1);
SkRect rect;
- SkPath::Direction dir;
+ SkPathDirection dir;
unsigned start;
path.close();
REPORTER_ASSERT(reporter, !SkPathPriv::IsSimpleClosedRect(path, &rect, &dir, &start));
@@ -2443,7 +2443,7 @@
for (size_t testIndex = 0; testIndex < testCount; ++testIndex) {
SkPath path;
if (rectFirst) {
- path.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
+ path.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
path.moveTo(tests[testIndex].fPoints[0].fX, tests[testIndex].fPoints[0].fY);
for (index = 1; index < tests[testIndex].fPointCount; ++index) {
@@ -2453,14 +2453,14 @@
path.close();
}
if (!rectFirst) {
- path.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
+ path.addRect(-1, -1, 2, 2, SkPathDirection::kCCW);
}
REPORTER_ASSERT(reporter,
tests[testIndex].fIsNestedRect == SkPathPriv::IsNestedFillRects(path, nullptr));
if (tests[testIndex].fIsNestedRect) {
SkRect expected[2], computed[2];
SkPathPriv::FirstDirection expectedDirs[2];
- SkPath::Direction computedDirs[2];
+ SkPathDirection computedDirs[2];
SkRect testBounds;
testBounds.setBounds(tests[testIndex].fPoints, tests[testIndex].fPointCount);
expected[0] = SkRect::MakeLTRB(-1, -1, 2, 2);
@@ -2482,7 +2482,7 @@
// fail, close then line
SkPath path1;
if (rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
path1.moveTo(r1[0].fX, r1[0].fY);
for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
@@ -2491,14 +2491,14 @@
path1.close();
path1.lineTo(1, 0);
if (!rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCCW);
}
REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
// fail, move in the middle
path1.reset();
if (rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
path1.moveTo(r1[0].fX, r1[0].fY);
for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
@@ -2509,14 +2509,14 @@
}
path1.close();
if (!rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCCW);
}
REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
// fail, move on the edge
path1.reset();
if (rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
path1.moveTo(r1[index - 1].fX, r1[index - 1].fY);
@@ -2524,14 +2524,14 @@
}
path1.close();
if (!rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCCW);
}
REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
// fail, quad
path1.reset();
if (rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
path1.moveTo(r1[0].fX, r1[0].fY);
for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
@@ -2542,14 +2542,14 @@
}
path1.close();
if (!rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCCW);
}
REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
// fail, cubic
path1.reset();
if (rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
path1.moveTo(r1[0].fX, r1[0].fY);
for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
@@ -2560,14 +2560,14 @@
}
path1.close();
if (!rectFirst) {
- path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction);
+ path1.addRect(-1, -1, 2, 2, SkPathDirection::kCCW);
}
REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
// fail, not nested
path1.reset();
- path1.addRect(1, 1, 3, 3, SkPath::kCW_Direction);
- path1.addRect(2, 2, 4, 4, SkPath::kCW_Direction);
+ path1.addRect(1, 1, 3, 3, SkPathDirection::kCW);
+ path1.addRect(2, 2, 4, 4, SkPathDirection::kCW);
REPORTER_ASSERT(reporter, !SkPathPriv::IsNestedFillRects(path1, nullptr));
}
@@ -2587,7 +2587,7 @@
// pass, stroke rect
SkPath src, dst;
- src.addRect(1, 1, 7, 7, SkPath::kCW_Direction);
+ src.addRect(1, 1, 7, 7, SkPathDirection::kCW);
SkPaint strokePaint;
strokePaint.setStyle(SkPaint::kStroke_Style);
strokePaint.setStrokeWidth(2);
@@ -2609,11 +2609,11 @@
reader.readPath(&readBack);
REPORTER_ASSERT(reporter, readBack == p);
- REPORTER_ASSERT(reporter, readBack.getConvexityOrUnknown() ==
- p.getConvexityOrUnknown());
+ REPORTER_ASSERT(reporter, readBack.getConvexityTypeOrUnknown() ==
+ p.getConvexityTypeOrUnknown());
SkRect oval0, oval1;
- SkPath::Direction dir0, dir1;
+ SkPathDirection dir0, dir1;
unsigned start0, start1;
REPORTER_ASSERT(reporter, readBack.isOval(nullptr) == p.isOval(nullptr));
if (SkPathPriv::IsOval(p, &oval0, &dir0, &start0) &&
@@ -2755,7 +2755,7 @@
}
p.reset();
- p.addCircle(0, 0, 1, SkPath::kCW_Direction);
+ p.addCircle(0, 0, 1, SkPathDirection::kCW);
{
SkMatrix matrix;
@@ -3285,7 +3285,7 @@
SkPathPriv::FirstDirection expectedDir) {
SkRect rect = SkRect::MakeEmpty();
REPORTER_ASSERT(reporter, path.isOval(&rect) == expectedCircle);
- SkPath::Direction isOvalDir;
+ SkPathDirection isOvalDir;
unsigned isOvalStart;
if (SkPathPriv::IsOval(path, &rect, &isOvalDir, &isOvalStart)) {
REPORTER_ASSERT(reporter, rect.height() == rect.width());
@@ -3405,7 +3405,7 @@
}
static void test_circle_with_direction(skiatest::Reporter* reporter,
- SkPath::Direction inDir) {
+ SkPathDirection inDir) {
const SkPathPriv::FirstDirection dir = SkPathPriv::AsFirstDirection(inDir);
SkPath path;
@@ -3452,12 +3452,12 @@
SkPath rect;
SkPath empty;
- const SkPath::Direction kCircleDir = SkPath::kCW_Direction;
- const SkPath::Direction kCircleDirOpposite = SkPath::kCCW_Direction;
+ const SkPathDirection kCircleDir = SkPathDirection::kCW;
+ const SkPathDirection kCircleDirOpposite = SkPathDirection::kCCW;
circle.addCircle(0, 0, SkIntToScalar(10), kCircleDir);
rect.addRect(SkIntToScalar(5), SkIntToScalar(5),
- SkIntToScalar(20), SkIntToScalar(20), SkPath::kCW_Direction);
+ SkIntToScalar(20), SkIntToScalar(20), SkPathDirection::kCW);
SkMatrix translate;
translate.setTranslate(SkIntToScalar(12), SkIntToScalar(12));
@@ -3483,24 +3483,24 @@
}
static void test_circle(skiatest::Reporter* reporter) {
- test_circle_with_direction(reporter, SkPath::kCW_Direction);
- test_circle_with_direction(reporter, SkPath::kCCW_Direction);
+ test_circle_with_direction(reporter, SkPathDirection::kCW);
+ test_circle_with_direction(reporter, SkPathDirection::kCCW);
// multiple addCircle()
SkPath path;
- path.addCircle(0, 0, SkIntToScalar(10), SkPath::kCW_Direction);
- path.addCircle(0, 0, SkIntToScalar(20), SkPath::kCW_Direction);
+ path.addCircle(0, 0, SkIntToScalar(10), SkPathDirection::kCW);
+ path.addCircle(0, 0, SkIntToScalar(20), SkPathDirection::kCW);
check_for_circle(reporter, path, false, SkPathPriv::kCW_FirstDirection);
// some extra lineTo() would make isOval() fail
path.reset();
- path.addCircle(0, 0, SkIntToScalar(10), SkPath::kCW_Direction);
+ path.addCircle(0, 0, SkIntToScalar(10), SkPathDirection::kCW);
path.lineTo(0, 0);
check_for_circle(reporter, path, false, SkPathPriv::kCW_FirstDirection);
// not back to the original point
path.reset();
- path.addCircle(0, 0, SkIntToScalar(10), SkPath::kCW_Direction);
+ path.addCircle(0, 0, SkIntToScalar(10), SkPathDirection::kCW);
path.setLastPt(SkIntToScalar(5), SkIntToScalar(5));
check_for_circle(reporter, path, false, SkPathPriv::kCW_FirstDirection);
@@ -3508,7 +3508,7 @@
// test negative radius
path.reset();
- path.addCircle(0, 0, -1, SkPath::kCW_Direction);
+ path.addCircle(0, 0, -1, SkPathDirection::kCW);
REPORTER_ASSERT(reporter, path.isEmpty());
}
@@ -3517,7 +3517,7 @@
SkMatrix m;
SkPath path;
unsigned start = 0;
- SkPath::Direction dir = SkPath::kCCW_Direction;
+ SkPathDirection dir = SkPathDirection::kCCW;
rect = SkRect::MakeWH(SkIntToScalar(30), SkIntToScalar(50));
path.addOval(rect);
@@ -3532,7 +3532,7 @@
// is unchanged.
REPORTER_ASSERT(reporter, SkPathPriv::IsOval(tmp, nullptr, &dir, &start));
REPORTER_ASSERT(reporter, 2 == start);
- REPORTER_ASSERT(reporter, SkPath::kCW_Direction == dir);
+ REPORTER_ASSERT(reporter, SkPathDirection::kCW == dir);
m.reset();
m.setRotate(SkIntToScalar(30));
@@ -3571,7 +3571,7 @@
tmp.addOval(rect);
path = tmp;
REPORTER_ASSERT(reporter, SkPathPriv::IsOval(path, nullptr, &dir, &start));
- REPORTER_ASSERT(reporter, SkPath::kCW_Direction == dir);
+ REPORTER_ASSERT(reporter, SkPathDirection::kCW == dir);
REPORTER_ASSERT(reporter, 1 == start);
}
@@ -3590,20 +3590,20 @@
}
static void test_rrect_is_convex(skiatest::Reporter* reporter, SkPath* path,
- SkPath::Direction dir) {
+ SkPathDirection dir) {
REPORTER_ASSERT(reporter, path->isConvex());
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(*path, SkPathPriv::AsFirstDirection(dir)));
- path->setConvexity(SkPath::kUnknown_Convexity);
+ path->setConvexityType(SkPathConvexityType::kUnknown);
REPORTER_ASSERT(reporter, path->isConvex());
path->reset();
}
static void test_rrect_convexity_is_unknown(skiatest::Reporter* reporter, SkPath* path,
- SkPath::Direction dir) {
+ SkPathDirection dir) {
REPORTER_ASSERT(reporter, path->isConvex());
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(*path, SkPathPriv::AsFirstDirection(dir)));
- path->setConvexity(SkPath::kUnknown_Convexity);
- REPORTER_ASSERT(reporter, path->getConvexity() == SkPath::kConcave_Convexity);
+ path->setConvexityType(SkPathConvexityType::kUnknown);
+ REPORTER_ASSERT(reporter, path->getConvexityType() == SkPathConvexityType::kConcave);
path->reset();
}
@@ -3614,45 +3614,45 @@
SkRect r = {10, 20, 30, 40};
rr.setRectRadii(r, radii);
p.addRRect(rr);
- test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
- p.addRRect(rr, SkPath::kCCW_Direction);
- test_rrect_is_convex(reporter, &p, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
+ p.addRRect(rr, SkPathDirection::kCCW);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCCW);
p.addRoundRect(r, &radii[0].fX);
- test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
- p.addRoundRect(r, &radii[0].fX, SkPath::kCCW_Direction);
- test_rrect_is_convex(reporter, &p, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
+ p.addRoundRect(r, &radii[0].fX, SkPathDirection::kCCW);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCCW);
p.addRoundRect(r, radii[1].fX, radii[1].fY);
- test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
- p.addRoundRect(r, radii[1].fX, radii[1].fY, SkPath::kCCW_Direction);
- test_rrect_is_convex(reporter, &p, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
+ p.addRoundRect(r, radii[1].fX, radii[1].fY, SkPathDirection::kCCW);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCCW);
for (size_t i = 0; i < SK_ARRAY_COUNT(radii); ++i) {
SkVector save = radii[i];
radii[i].set(0, 0);
rr.setRectRadii(r, radii);
p.addRRect(rr);
- test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
radii[i] = save;
}
p.addRoundRect(r, 0, 0);
SkRect returnedRect;
REPORTER_ASSERT(reporter, p.isRect(&returnedRect));
REPORTER_ASSERT(reporter, returnedRect == r);
- test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
SkVector zeroRadii[] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
rr.setRectRadii(r, zeroRadii);
p.addRRect(rr);
bool closed;
- SkPath::Direction dir;
+ SkPathDirection dir;
REPORTER_ASSERT(reporter, p.isRect(nullptr, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
- REPORTER_ASSERT(reporter, SkPath::kCW_Direction == dir);
- test_rrect_is_convex(reporter, &p, SkPath::kCW_Direction);
- p.addRRect(rr, SkPath::kCW_Direction);
- p.addRRect(rr, SkPath::kCW_Direction);
+ REPORTER_ASSERT(reporter, SkPathDirection::kCW == dir);
+ test_rrect_is_convex(reporter, &p, SkPathDirection::kCW);
+ p.addRRect(rr, SkPathDirection::kCW);
+ p.addRRect(rr, SkPathDirection::kCW);
REPORTER_ASSERT(reporter, !p.isConvex());
p.reset();
- p.addRRect(rr, SkPath::kCCW_Direction);
- p.addRRect(rr, SkPath::kCCW_Direction);
+ p.addRRect(rr, SkPathDirection::kCCW);
+ p.addRRect(rr, SkPathDirection::kCCW);
REPORTER_ASSERT(reporter, !p.isConvex());
p.reset();
SkRect emptyR = {10, 20, 10, 30};
@@ -3665,7 +3665,7 @@
SkRect largeR = {0, 0, SK_ScalarMax, SK_ScalarMax};
rr.setRectRadii(largeR, radii);
p.addRRect(rr);
- test_rrect_convexity_is_unknown(reporter, &p, SkPath::kCW_Direction);
+ test_rrect_convexity_is_unknown(reporter, &p, SkPathDirection::kCW);
// we check for non-finites
SkRect infR = {0, 0, SK_ScalarMax, SK_ScalarInfinity};
@@ -3675,7 +3675,7 @@
// We consider any path with very small (numerically unstable) edges to be concave.
SkRect tinyR = {0, 0, 1e-9f, 1e-9f};
p.addRoundRect(tinyR, 5e-11f, 5e-11f);
- test_rrect_convexity_is_unknown(reporter, &p, SkPath::kCW_Direction);
+ test_rrect_convexity_is_unknown(reporter, &p, SkPathDirection::kCW);
}
static void test_arc(skiatest::Reporter* reporter) {
@@ -3695,7 +3695,7 @@
REPORTER_ASSERT(reporter, p == cwOval);
p.reset();
SkPath ccwOval;
- ccwOval.addOval(oval, SkPath::kCCW_Direction);
+ ccwOval.addOval(oval, SkPathDirection::kCCW);
p.addArc(oval, 0, -360);
REPORTER_ASSERT(reporter, p == ccwOval);
p.reset();
@@ -3703,10 +3703,10 @@
// diagonal colinear points make arc convex
// TODO: one way to keep it concave would be to introduce interpolated on curve points
// between control points and computing the on curve point at scan conversion time
- REPORTER_ASSERT(reporter, p.getConvexity() == SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(reporter, p.getConvexityType() == SkPathConvexityType::kConvex);
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(p, SkPathPriv::kCW_FirstDirection));
- p.setConvexity(SkPath::kUnknown_Convexity);
- REPORTER_ASSERT(reporter, p.getConvexity() == SkPath::kConvex_Convexity);
+ p.setConvexityType(SkPathConvexityType::kUnknown);
+ REPORTER_ASSERT(reporter, p.getConvexityType() == SkPathConvexityType::kConvex);
}
static inline SkScalar oval_start_index_to_angle(unsigned start) {
@@ -3737,7 +3737,7 @@
static void check_oval_arc(skiatest::Reporter* reporter, SkScalar start, SkScalar sweep,
const SkPath& path) {
SkRect r = SkRect::MakeEmpty();
- SkPath::Direction d = SkPath::kCCW_Direction;
+ SkPathDirection d = SkPathDirection::kCCW;
unsigned s = ~0U;
bool isOval = SkPathPriv::IsOval(path, &r, &d, &s);
REPORTER_ASSERT(reporter, isOval);
@@ -3745,7 +3745,7 @@
recreatedPath.addOval(r, d, s);
REPORTER_ASSERT(reporter, path == recreatedPath);
REPORTER_ASSERT(reporter, oval_start_index_to_angle(s) == canonical_start_angle(start));
- REPORTER_ASSERT(reporter, (SkPath::kCW_Direction == d) == (sweep > 0.f));
+ REPORTER_ASSERT(reporter, (SkPathDirection::kCW == d) == (sweep > 0.f));
}
static void test_arc_ovals(skiatest::Reporter* reporter) {
@@ -5487,8 +5487,8 @@
};
static bool conditional_convex(const SkPath& path, bool is_convex) {
- SkPath::Convexity c = path.getConvexityOrUnknown();
- return is_convex ? (c == SkPath::kConvex_Convexity) : (c != SkPath::kConvex_Convexity);
+ SkPathConvexityType c = path.getConvexityTypeOrUnknown();
+ return is_convex ? (c == SkPathConvexityType::kConvex) : (c != SkPathConvexityType::kConvex);
}
// expect axis-aligned shape to survive assignment, identity and scale/translate matrices
@@ -5497,22 +5497,22 @@
ISA isa_proc) {
REPORTER_ASSERT(reporter, isa_proc(*path));
// force the issue (computing convexity) the first time.
- REPORTER_ASSERT(reporter, path->getConvexity() == SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(reporter, path->getConvexityType() == SkPathConvexityType::kConvex);
SkPath path2;
// a path's isa and convexity should survive assignment
path2 = *path;
REPORTER_ASSERT(reporter, isa_proc(path2));
- REPORTER_ASSERT(reporter, path2.getConvexityOrUnknown() == SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(reporter, path2.getConvexityTypeOrUnknown() == SkPathConvexityType::kConvex);
// a path's isa and convexity should identity transform
path->transform(x.fIM, &path2);
path->transform(x.fIM);
REPORTER_ASSERT(reporter, isa_proc(path2));
- REPORTER_ASSERT(reporter, path2.getConvexityOrUnknown() == SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(reporter, path2.getConvexityTypeOrUnknown() == SkPathConvexityType::kConvex);
REPORTER_ASSERT(reporter, isa_proc(*path));
- REPORTER_ASSERT(reporter, path->getConvexityOrUnknown() == SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(reporter, path->getConvexityTypeOrUnknown() == SkPathConvexityType::kConvex);
// a path's isa should survive translation, convexity depends on axis alignment
path->transform(x.fTM, &path2);
@@ -5532,15 +5532,15 @@
// For security, post-rotation, we can't assume we're still convex. It might prove to be,
// in fact, still be convex, be we can't have cached that setting, hence the call to
- // getConvexityOrUnknown() instead of getConvexity().
+ // getConvexityTypeOrUnknown() instead of getConvexityType().
path->transform(x.fRM, &path2);
path->transform(x.fRM);
if (isAxisAligned) {
REPORTER_ASSERT(reporter, !isa_proc(path2));
REPORTER_ASSERT(reporter, !isa_proc(*path));
}
- REPORTER_ASSERT(reporter, path2.getConvexityOrUnknown() != SkPath::kConvex_Convexity);
- REPORTER_ASSERT(reporter, path->getConvexityOrUnknown() != SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(reporter, path2.getConvexityTypeOrUnknown() != SkPathConvexityType::kConvex);
+ REPORTER_ASSERT(reporter, path->getConvexityTypeOrUnknown() != SkPathConvexityType::kConvex);
}
DEF_TEST(Path_survive_transform, r) {
@@ -5561,7 +5561,7 @@
// make a trapazoid; definitely convex, but not marked as axis-aligned (e.g. oval, rrect)
path.reset();
path.moveTo(0, 0).lineTo(100, 0).lineTo(70, 100).lineTo(30, 100);
- REPORTER_ASSERT(r, path.getConvexity() == SkPath::kConvex_Convexity);
+ REPORTER_ASSERT(r, path.getConvexityType() == SkPathConvexityType::kConvex);
survive(&path, x, false, r, [](const SkPath& p) { return true; });
}
diff --git a/tests/RRectInPathTest.cpp b/tests/RRectInPathTest.cpp
index a25ad45..c36a5ba 100644
--- a/tests/RRectInPathTest.cpp
+++ b/tests/RRectInPathTest.cpp
@@ -12,7 +12,7 @@
#include "tests/Test.h"
static SkRRect path_contains_rrect(skiatest::Reporter* reporter, const SkPath& path,
- SkPath::Direction* dir, unsigned* start) {
+ SkPathDirection* dir, unsigned* start) {
SkRRect out;
REPORTER_ASSERT(reporter, SkPathPriv::IsRRect(path, &out, dir, start));
SkPath recreatedPath;
@@ -30,7 +30,7 @@
SkPath xformed;
path.transform(m, &xformed);
SkRRect xrr = SkRRect::MakeRect(SkRect::MakeEmpty());
- SkPath::Direction xd = SkPath::kCCW_Direction;
+ SkPathDirection xd = SkPathDirection::kCCW;
unsigned xs = ~0U;
REPORTER_ASSERT(reporter, SkPathPriv::IsRRect(xformed, &xrr, &xd, &xs));
recreatedPath.reset();
@@ -41,7 +41,7 @@
}
static SkRRect inner_path_contains_rrect(skiatest::Reporter* reporter, const SkRRect& in,
- SkPath::Direction dir, unsigned start) {
+ SkPathDirection dir, unsigned start) {
switch (in.getType()) {
case SkRRect::kEmpty_Type:
case SkRRect::kRect_Type:
@@ -52,7 +52,7 @@
}
SkPath path;
path.addRRect(in, dir, start);
- SkPath::Direction outDir;
+ SkPathDirection outDir;
unsigned outStart;
SkRRect rrect = path_contains_rrect(reporter, path, &outDir, &outStart);
REPORTER_ASSERT(reporter, outDir == dir && outStart == start);
@@ -60,7 +60,7 @@
}
static void path_contains_rrect_check(skiatest::Reporter* reporter, const SkRRect& in,
- SkPath::Direction dir, unsigned start) {
+ SkPathDirection dir, unsigned start) {
SkRRect out = inner_path_contains_rrect(reporter, in, dir, start);
if (in != out) {
SkDebugf("");
@@ -69,7 +69,7 @@
}
static void path_contains_rrect_nocheck(skiatest::Reporter* reporter, const SkRRect& in,
- SkPath::Direction dir, unsigned start) {
+ SkPathDirection dir, unsigned start) {
SkRRect out = inner_path_contains_rrect(reporter, in, dir, start);
if (in == out) {
SkDebugf("");
@@ -77,7 +77,7 @@
}
static void path_contains_rrect_check(skiatest::Reporter* reporter, const SkRect& r,
- SkVector v[4], SkPath::Direction dir, unsigned start) {
+ SkVector v[4], SkPathDirection dir, unsigned start) {
SkRRect rrect;
rrect.setRectRadii(r, v);
path_contains_rrect_check(reporter, rrect, dir, start);
@@ -85,15 +85,15 @@
class ForceIsRRect_Private {
public:
- ForceIsRRect_Private(SkPath* path, SkPath::Direction dir, unsigned start) {
- path->fPathRef->setIsRRect(true, dir == SkPath::kCCW_Direction, start);
+ ForceIsRRect_Private(SkPath* path, SkPathDirection dir, unsigned start) {
+ path->fPathRef->setIsRRect(true, dir == SkPathDirection::kCCW, start);
}
};
static void force_path_contains_rrect(skiatest::Reporter* reporter, SkPath& path,
- SkPath::Direction dir, unsigned start) {
+ SkPathDirection dir, unsigned start) {
ForceIsRRect_Private force_rrect(&path, dir, start);
- SkPath::Direction outDir;
+ SkPathDirection outDir;
unsigned outStart;
path_contains_rrect(reporter, path, &outDir, &outStart);
REPORTER_ASSERT(reporter, outDir == dir && outStart == start);
@@ -124,7 +124,7 @@
path.lineTo(3.5f, 66);
path.conicTo(0, 66, 0, 62.5, weight);
path.close();
- force_path_contains_rrect(reporter, path, SkPath::kCW_Direction, 6);
+ force_path_contains_rrect(reporter, path, SkPathDirection::kCW, 6);
path.reset();
path.moveTo(0, 81.5f);
@@ -137,7 +137,7 @@
path.lineTo(3.5f, 85);
path.conicTo(0, 85, 0, 81.5f, weight);
path.close();
- force_path_contains_rrect(reporter, path, SkPath::kCW_Direction, 6);
+ force_path_contains_rrect(reporter, path, SkPathDirection::kCW, 6);
path.reset();
path.moveTo(14, 1189);
@@ -150,7 +150,7 @@
path.lineTo(21, 1196);
path.conicTo(14, 1196, 14, 1189, weight);
path.close();
- force_path_contains_rrect(reporter, path, SkPath::kCW_Direction, 6);
+ force_path_contains_rrect(reporter, path, SkPathDirection::kCW, 6);
path.reset();
path.moveTo(14, 1743);
@@ -163,14 +163,14 @@
path.lineTo(21, 1750);
path.conicTo(14, 1750, 14, 1743, weight);
path.close();
- force_path_contains_rrect(reporter, path, SkPath::kCW_Direction, 6);
+ force_path_contains_rrect(reporter, path, SkPathDirection::kCW, 6);
}
static const SkScalar kWidth = 100.0f;
static const SkScalar kHeight = 100.0f;
static void test_tricky_radii(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
{
// crbug.com/458522
@@ -197,7 +197,7 @@
}
static void test_empty_crbug_458524(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
SkRRect rr;
const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
@@ -215,7 +215,7 @@
}
static void test_inset(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
SkRRect rr, rr2;
SkRect r = { 0, 0, 100, 100 };
@@ -244,7 +244,7 @@
const SkRect& rect,
SkScalar l, SkScalar t, SkScalar r, SkScalar b,
bool checkRadii) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
SkRRect rr;
rr.setNinePatch(rect, l, t, r, b);
@@ -268,7 +268,7 @@
// Test out the basic API entry points
static void test_round_rect_basic(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
//----
SkRect rect = SkRect::MakeLTRB(0, 0, kWidth, kHeight);
@@ -342,7 +342,7 @@
// Test out the cases when the RR degenerates to a rect
static void test_round_rect_rects(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
//----
SkRect rect = SkRect::MakeLTRB(0, 0, kWidth, kHeight);
@@ -371,7 +371,7 @@
// Test out the cases when the RR degenerates to an oval
static void test_round_rect_ovals(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
//----
SkRect rect = SkRect::MakeLTRB(0, 0, kWidth, kHeight);
@@ -385,7 +385,7 @@
// Test out the non-degenerate RR cases
static void test_round_rect_general(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
//----
SkRect rect = SkRect::MakeLTRB(0, 0, kWidth, kHeight);
@@ -406,7 +406,7 @@
}
static void test_round_rect_iffy_parameters(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
SkRect rect = SkRect::MakeLTRB(0, 0, kWidth, kHeight);
SkPoint radii[4] = { { 50, 100 }, { 100, 50 }, { 50, 100 }, { 100, 50 } };
@@ -432,7 +432,7 @@
const SkRect rectx = SkRect::MakeLTRB(min, min, max, big);
const SkRect recty = SkRect::MakeLTRB(min, min, big, max);
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
SkVector radii[4];
for (int i = 0; i < 4; ++i) {
@@ -445,7 +445,7 @@
}
static void test_mix(skiatest::Reporter* reporter) {
- for (auto dir : {SkPath::kCW_Direction, SkPath::kCCW_Direction}) {
+ for (auto dir : {SkPathDirection::kCW, SkPathDirection::kCCW}) {
for (int start = 0; start < 8; ++start) {
// Test out mixed degenerate and non-degenerate geometry with Conics
const SkVector radii[4] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 100, 100 } };