add guard to switch to SkPathTypes
Change-Id: I44d8b5ae8a5172d11a6d4cd9d994373dd3816d6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241278
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/samplecode/SampleAAClip.cpp b/samplecode/SampleAAClip.cpp
index 46e4fe2..b762066 100644
--- a/samplecode/SampleAAClip.cpp
+++ b/samplecode/SampleAAClip.cpp
@@ -70,7 +70,7 @@
// path.addRect(bounds);
// path.addOval(bounds);
- path.addRoundRect(bounds, 4, 4);
+ path.addRRect(SkRRect::MakeRectXY(bounds, 4, 4));
aaclip.setPath(path);
canvas->translate(30, 30);
drawClip(canvas, aaclip);
diff --git a/samplecode/SampleAndroidShadows.cpp b/samplecode/SampleAndroidShadows.cpp
index 71eb22a..7ee80b0 100644
--- a/samplecode/SampleAndroidShadows.cpp
+++ b/samplecode/SampleAndroidShadows.cpp
@@ -51,9 +51,8 @@
fCirclePath.addCircle(0, 0, 50);
fRectPath.addRect(SkRect::MakeXYWH(-100, -50, 200, 100));
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);
+ fFunkyRRPath.addRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(-50, -50, 100, 100), 40, 20),
+ 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/SampleClip.cpp b/samplecode/SampleClip.cpp
index e931881..cbc76e9 100644
--- a/samplecode/SampleClip.cpp
+++ b/samplecode/SampleClip.cpp
@@ -114,7 +114,7 @@
SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) };
SkPath clipPath;
r.inset(SK_Scalar1 / 4, SK_Scalar1 / 4);
- clipPath.addRoundRect(r, SkIntToScalar(20), SkIntToScalar(20));
+ clipPath.addRRect(SkRRect::MakeRectXY(r, 20, 20));
// clipPath.toggleInverseFillType();
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/SampleComplexClip.cpp b/samplecode/SampleComplexClip.cpp
index 4e811a0..d903148 100644
--- a/samplecode/SampleComplexClip.cpp
+++ b/samplecode/SampleComplexClip.cpp
@@ -34,7 +34,7 @@
path.quadTo(SkIntToScalar(150), SkIntToScalar(150), SkIntToScalar(125), SkIntToScalar(150));
path.lineTo(SkIntToScalar(50), SkIntToScalar(150));
path.close();
- path.setFillType(SkPath::kEvenOdd_FillType);
+ path.setFillType(SkPathFillType::kEvenOdd);
SkColor pathColor = SK_ColorBLACK;
SkPaint pathPaint;
pathPaint.setAntiAlias(true);
@@ -99,8 +99,8 @@
}
canvas->save();
// set clip
- clipA.setFillType(invA ? SkPath::kInverseEvenOdd_FillType :
- SkPath::kEvenOdd_FillType);
+ clipA.setFillType(invA ? SkPathFillType::kInverseEvenOdd :
+ SkPathFillType::kEvenOdd);
canvas->clipPath(clipA);
canvas->clipPath(clipB, gOps[op].fOp);
diff --git a/samplecode/SampleFillType.cpp b/samplecode/SampleFillType.cpp
index 58e954a..2678491 100644
--- a/samplecode/SampleFillType.cpp
+++ b/samplecode/SampleFillType.cpp
@@ -27,7 +27,7 @@
protected:
virtual SkString name() { return SkString("FillType"); }
- void showPath(SkCanvas* canvas, int x, int y, SkPath::FillType ft,
+ void showPath(SkCanvas* canvas, int x, int y, SkPathFillType ft,
SkScalar scale, const SkPaint& paint) {
const SkRect r = { 0, 0, SkIntToScalar(150), SkIntToScalar(150) };
@@ -45,14 +45,10 @@
}
void showFour(SkCanvas* canvas, SkScalar scale, const SkPaint& paint) {
- showPath(canvas, 0, 0, SkPath::kWinding_FillType,
- scale, paint);
- showPath(canvas, 200, 0, SkPath::kEvenOdd_FillType,
- scale, paint);
- showPath(canvas, 00, 200, SkPath::kInverseWinding_FillType,
- scale, paint);
- showPath(canvas, 200, 200, SkPath::kInverseEvenOdd_FillType,
- scale, paint);
+ showPath(canvas, 0, 0, SkPathFillType::kWinding, scale, paint);
+ showPath(canvas, 200, 0, SkPathFillType::kEvenOdd, scale, paint);
+ showPath(canvas, 00, 200, SkPathFillType::kInverseWinding, scale, paint);
+ showPath(canvas, 200, 200, SkPathFillType::kInverseEvenOdd, scale, paint);
}
virtual void onDrawContent(SkCanvas* canvas) {
diff --git a/samplecode/SampleFilterQuality.cpp b/samplecode/SampleFilterQuality.cpp
index 54fe4af..f18a1a6 100644
--- a/samplecode/SampleFilterQuality.cpp
+++ b/samplecode/SampleFilterQuality.cpp
@@ -42,7 +42,7 @@
canvas->drawColor(SK_ColorWHITE);
SkPath path;
- path.setFillType(SkPath::kEvenOdd_FillType);
+ path.setFillType(SkPathFillType::kEvenOdd);
path.addRect(SkRect::MakeWH(N/2, N));
path.addRect(SkRect::MakeWH(N, N/2));
diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp
index 4e7b1dd..dcfdc0a 100644
--- a/samplecode/SampleIdentityScale.cpp
+++ b/samplecode/SampleIdentityScale.cpp
@@ -56,7 +56,7 @@
SkRect r = { 100, 100, 356, 356 };
SkPath clipPath;
- clipPath.addRoundRect(r, SkIntToScalar(5), SkIntToScalar(5));
+ clipPath.addRRect(SkRRect::MakeRectXY(r, 5, 5));
canvas->clipPath(clipPath, kIntersect_SkClipOp, true);
text = "Scaled = 0";
}
diff --git a/samplecode/SampleLayerMask.cpp b/samplecode/SampleLayerMask.cpp
index 9785e88..546c6c4 100644
--- a/samplecode/SampleLayerMask.cpp
+++ b/samplecode/SampleLayerMask.cpp
@@ -42,7 +42,7 @@
} else {
SkPath p;
p.addOval(r);
- p.setFillType(SkPath::kInverseWinding_FillType);
+ p.setFillType(SkPathFillType::kInverseWinding);
paint.setBlendMode(SkBlendMode::kDstOut);
canvas->drawPath(p, paint);
}
diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp
index ccdc541..8666940 100644
--- a/samplecode/SamplePathEffects.cpp
+++ b/samplecode/SamplePathEffects.cpp
@@ -99,7 +99,7 @@
SkRect oval;
oval.setLTRB(20, 30, 100, 60);
oval.offset(x, 0);
- fPath.addRoundRect(oval, SkIntToScalar(8), SkIntToScalar(8));
+ fPath.addRRect(SkRRect::MakeRectXY(oval, 8, 8));
}
fClickPt.set(SkIntToScalar(200), SkIntToScalar(200));
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 72dfabc..6b679e2 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -488,7 +488,7 @@
paint.setColor(0x3f0f1f3f);
canvas->drawPath(path, paint);
path.reset();
- path.setFillType(SkPath::kEvenOdd_FillType);
+ path.setFillType(SkPathFillType::kEvenOdd);
path.addCircle(center.fX, center.fY, maxSide + width / 2);
SkRect outside = SkRect::MakeXYWH(center.fX - maxSide - width, center.fY - maxSide - width,
(maxSide + width) * 2, (maxSide + width) * 2);
@@ -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..7adb9ef 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -30,9 +30,7 @@
SkScalar dy = 20;
SkPath path;
- path.addRect(0.0f, 0.0f,
- SkIntToScalar(width), SkIntToScalar(height),
- SkPath::kCW_Direction);
+ path.addRect({0.0f, 0.0f, SkIntToScalar(width), SkIntToScalar(height)}, SkPathDirection::kCW);
SkRect r = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
SkCanvas c(bitmap);
diff --git a/samplecode/SampleShadowUtils.cpp b/samplecode/SampleShadowUtils.cpp
index 86151c1..b3023fa 100644
--- a/samplecode/SampleShadowUtils.cpp
+++ b/samplecode/SampleShadowUtils.cpp
@@ -42,7 +42,7 @@
protected:
void onOnceBeforeDraw() override {
- fConvexPaths.push_back().addRoundRect(SkRect::MakeWH(50, 50), 10, 10);
+ fConvexPaths.push_back().addRRect(SkRRect::MakeRectXY(SkRect::MakeWH(50, 50), 10, 10));
SkRRect oddRRect;
oddRRect.setNinePatch(SkRect::MakeWH(50, 50), 9, 13, 6, 16);
fConvexPaths.push_back().addRRect(oddRRect);
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..b22ba8d 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);
@@ -192,11 +192,11 @@
fPath.offset(100, 0);
#endif
- fPath.setFillType(SkPath::kWinding_FillType);
+ fPath.setFillType(SkPathFillType::kWinding);
drawSet(canvas, &paint);
canvas->translate(0, fPath.getBounds().height() * 5 / 4);
- fPath.setFillType(SkPath::kEvenOdd_FillType);
+ fPath.setFillType(SkPathFillType::kEvenOdd);
drawSet(canvas, &paint);
}
diff --git a/samplecode/SampleTextEffects.cpp b/samplecode/SampleTextEffects.cpp
index 2303288..8e57750 100644
--- a/samplecode/SampleTextEffects.cpp
+++ b/samplecode/SampleTextEffects.cpp
@@ -82,7 +82,7 @@
virtual bool onFilterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const override {
*dst = src;
- dst->setFillType(SkPath::kInverseWinding_FillType);
+ dst->setFillType(SkPathFillType::kInverseWinding);
return true;
}