Index: tests/PathTest.cpp |
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp |
index 68eb67722f9ba9dc32994562de2815a18331e3b3..cd9e8847a1fde0f357da1ef3c1d83ec5d104b00e 100644 |
--- a/tests/PathTest.cpp |
+++ b/tests/PathTest.cpp |
@@ -314,7 +314,7 @@ static void test_bad_cubic_crbug229478() { |
SkPath dst; |
// Before the fix, this would infinite-recurse, and run out of stack |
// because we would keep trying to subdivide a degenerate cubic segment. |
- paint.getFillPath(path, &dst, NULL); |
+ paint.getFillPath(path, &dst, nullptr); |
} |
static void build_path_170666(SkPath& path) { |
@@ -485,27 +485,27 @@ static void test_addrect(skiatest::Reporter* reporter) { |
SkPath path; |
path.lineTo(0, 0); |
path.addRect(SkRect::MakeWH(50, 100)); |
- REPORTER_ASSERT(reporter, path.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, path.isRect(nullptr)); |
path.reset(); |
path.lineTo(FLT_EPSILON, FLT_EPSILON); |
path.addRect(SkRect::MakeWH(50, 100)); |
- REPORTER_ASSERT(reporter, !path.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr)); |
path.reset(); |
path.quadTo(0, 0, 0, 0); |
path.addRect(SkRect::MakeWH(50, 100)); |
- REPORTER_ASSERT(reporter, !path.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr)); |
path.reset(); |
path.conicTo(0, 0, 0, 0, 0.5f); |
path.addRect(SkRect::MakeWH(50, 100)); |
- REPORTER_ASSERT(reporter, !path.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr)); |
path.reset(); |
path.cubicTo(0, 0, 0, 0, 0, 0); |
path.addRect(SkRect::MakeWH(50, 100)); |
- REPORTER_ASSERT(reporter, !path.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isRect(nullptr)); |
} |
// Make sure we stay non-finite once we get there (unless we reset or rewind). |
@@ -926,7 +926,7 @@ static void check_direction(skiatest::Reporter* reporter, const SkPath& path, |
static void test_direction(skiatest::Reporter* reporter) { |
size_t i; |
SkPath path; |
- REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, NULL)); |
+ REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr)); |
REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection)); |
REPORTER_ASSERT(reporter, !SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCCW_FirstDirection)); |
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kUnknown_FirstDirection)); |
@@ -943,7 +943,7 @@ static void test_direction(skiatest::Reporter* reporter) { |
path.reset(); |
bool valid = SkParsePath::FromSVGString(gDegen[i], &path); |
REPORTER_ASSERT(reporter, valid); |
- REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, NULL)); |
+ REPORTER_ASSERT(reporter, !SkPathPriv::CheapComputeFirstDirection(path, nullptr)); |
} |
static const char* gCW[] = { |
@@ -1361,7 +1361,7 @@ static void setFromString(SkPath* path, const char str[]) { |
while (str) { |
SkScalar x, y; |
str = SkParse::FindScalar(str, &x); |
- if (NULL == str) { |
+ if (nullptr == str) { |
break; |
} |
str = SkParse::FindScalar(str, &y); |
@@ -1507,7 +1507,7 @@ static void test_isLine(skiatest::Reporter* reporter) { |
SkPoint pts[2]; |
const SkScalar value = SkIntToScalar(5); |
- REPORTER_ASSERT(reporter, !path.isLine(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr)); |
// set some non-zero values |
pts[0].set(value, value); |
@@ -1522,7 +1522,7 @@ static void test_isLine(skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, value != moveX && value != moveY); |
path.moveTo(moveX, moveY); |
- REPORTER_ASSERT(reporter, !path.isLine(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr)); |
REPORTER_ASSERT(reporter, !path.isLine(pts)); |
// check that pts was untouched |
REPORTER_ASSERT(reporter, pts[0].equals(value, value)); |
@@ -1533,7 +1533,7 @@ static void test_isLine(skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, value != lineX && value != lineY); |
path.lineTo(lineX, lineY); |
- REPORTER_ASSERT(reporter, path.isLine(NULL)); |
+ REPORTER_ASSERT(reporter, path.isLine(nullptr)); |
REPORTER_ASSERT(reporter, !pts[0].equals(moveX, moveY)); |
REPORTER_ASSERT(reporter, !pts[1].equals(lineX, lineY)); |
@@ -1542,14 +1542,14 @@ static void test_isLine(skiatest::Reporter* reporter) { |
REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY)); |
path.lineTo(0, 0); // too many points/verbs |
- REPORTER_ASSERT(reporter, !path.isLine(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr)); |
REPORTER_ASSERT(reporter, !path.isLine(pts)); |
REPORTER_ASSERT(reporter, pts[0].equals(moveX, moveY)); |
REPORTER_ASSERT(reporter, pts[1].equals(lineX, lineY)); |
path.reset(); |
path.quadTo(1, 1, 2, 2); |
- REPORTER_ASSERT(reporter, !path.isLine(NULL)); |
+ REPORTER_ASSERT(reporter, !path.isLine(nullptr)); |
} |
static void test_conservativelyContains(skiatest::Reporter* reporter) { |
@@ -1771,7 +1771,7 @@ static void test_isRect_open_close(skiatest::Reporter* reporter) { |
path.moveTo(0, 0); path.lineTo(1, 0); path.lineTo(1, 1); path.lineTo(0, 1); |
path.close(); |
- REPORTER_ASSERT(reporter, path.isRect(NULL, &isClosed, NULL)); |
+ REPORTER_ASSERT(reporter, path.isRect(nullptr, &isClosed, nullptr)); |
REPORTER_ASSERT(reporter, isClosed); |
} |
@@ -1875,7 +1875,7 @@ static void test_isRect(skiatest::Reporter* reporter) { |
if (tests[testIndex].fClose) { |
path.close(); |
} |
- REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, tests[testIndex].fIsRect == path.isRect(nullptr)); |
if (tests[testIndex].fIsRect) { |
SkRect computed, expected; |
@@ -1909,7 +1909,7 @@ static void test_isRect(skiatest::Reporter* reporter) { |
} |
path1.close(); |
path1.lineTo(1, 0); |
- REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); |
// fail, move in the middle |
path1.reset(); |
@@ -1921,7 +1921,7 @@ static void test_isRect(skiatest::Reporter* reporter) { |
path1.lineTo(r1[index].fX, r1[index].fY); |
} |
path1.close(); |
- REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); |
// fail, move on the edge |
path1.reset(); |
@@ -1930,7 +1930,7 @@ static void test_isRect(skiatest::Reporter* reporter) { |
path1.lineTo(r1[index].fX, r1[index].fY); |
} |
path1.close(); |
- REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); |
// fail, quad |
path1.reset(); |
@@ -1942,7 +1942,7 @@ static void test_isRect(skiatest::Reporter* reporter) { |
path1.lineTo(r1[index].fX, r1[index].fY); |
} |
path1.close(); |
- REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); |
// fail, cubic |
path1.reset(); |
@@ -1954,7 +1954,7 @@ static void test_isRect(skiatest::Reporter* reporter) { |
path1.lineTo(r1[index].fX, r1[index].fY); |
} |
path1.close(); |
- REPORTER_ASSERT(reporter, !path1.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isRect(nullptr)); |
} |
static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
@@ -2042,7 +2042,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
path.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
} |
REPORTER_ASSERT(reporter, |
- tests[testIndex].fIsNestedRect == path.isNestedFillRects(NULL)); |
+ tests[testIndex].fIsNestedRect == path.isNestedFillRects(nullptr)); |
if (tests[testIndex].fIsNestedRect) { |
SkRect expected[2], computed[2]; |
SkPathPriv::FirstDirection expectedDirs[2]; |
@@ -2079,7 +2079,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
if (!rectFirst) { |
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
} |
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); |
// fail, move in the middle |
path1.reset(); |
@@ -2097,7 +2097,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
if (!rectFirst) { |
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
} |
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); |
// fail, move on the edge |
path1.reset(); |
@@ -2112,7 +2112,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
if (!rectFirst) { |
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
} |
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); |
// fail, quad |
path1.reset(); |
@@ -2130,7 +2130,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
if (!rectFirst) { |
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
} |
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); |
// fail, cubic |
path1.reset(); |
@@ -2148,13 +2148,13 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
if (!rectFirst) { |
path1.addRect(-1, -1, 2, 2, SkPath::kCCW_Direction); |
} |
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); |
// fail, not nested |
path1.reset(); |
path1.addRect(1, 1, 3, 3, SkPath::kCW_Direction); |
path1.addRect(2, 2, 4, 4, SkPath::kCW_Direction); |
- REPORTER_ASSERT(reporter, !path1.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, !path1.isNestedFillRects(nullptr)); |
} |
// pass, constructed explicitly from manually closed rects specified as moves/lines. |
@@ -2169,7 +2169,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
path.lineTo(9, 9); |
path.lineTo(1, 9); |
path.lineTo(1, 1); |
- REPORTER_ASSERT(reporter, path.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, path.isNestedFillRects(nullptr)); |
// pass, stroke rect |
SkPath src, dst; |
@@ -2178,7 +2178,7 @@ static void test_isNestedFillRects(skiatest::Reporter* reporter) { |
strokePaint.setStyle(SkPaint::kStroke_Style); |
strokePaint.setStrokeWidth(2); |
strokePaint.getFillPath(src, &dst); |
- REPORTER_ASSERT(reporter, dst.isNestedFillRects(NULL)); |
+ REPORTER_ASSERT(reporter, dst.isNestedFillRects(nullptr)); |
} |
static void write_and_read_back(skiatest::Reporter* reporter, |
@@ -2198,7 +2198,7 @@ static void write_and_read_back(skiatest::Reporter* reporter, |
REPORTER_ASSERT(reporter, readBack.getConvexityOrUnknown() == |
p.getConvexityOrUnknown()); |
- REPORTER_ASSERT(reporter, readBack.isOval(NULL) == p.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, readBack.isOval(nullptr) == p.isOval(nullptr)); |
const SkRect& origBounds = p.getBounds(); |
const SkRect& readBackBounds = readBack.getBounds(); |
@@ -2225,7 +2225,7 @@ static void test_flattening(skiatest::Reporter* reporter) { |
// create a buffer that should be much larger than the path so we don't |
// kill our stack if writer goes too far. |
char buffer[1024]; |
- size_t size1 = p.writeToMemory(NULL); |
+ size_t size1 = p.writeToMemory(nullptr); |
size_t size2 = p.writeToMemory(buffer); |
REPORTER_ASSERT(reporter, size1 == size2); |
@@ -2315,7 +2315,7 @@ static void test_transform(skiatest::Reporter* reporter) { |
p.transform(matrix, &p1); |
REPORTER_ASSERT(reporter, matrix.invert(&matrix)); |
- p1.transform(matrix, NULL); |
+ p1.transform(matrix, nullptr); |
SkRect pBounds = p.getBounds(); |
SkRect p1Bounds = p1.getBounds(); |
REPORTER_ASSERT(reporter, SkScalarNearlyEqual(pBounds.fLeft, p1Bounds.fLeft)); |
@@ -3089,51 +3089,51 @@ static void test_oval(skiatest::Reporter* reporter) { |
rect = SkRect::MakeWH(SkIntToScalar(30), SkIntToScalar(50)); |
path.addOval(rect); |
- REPORTER_ASSERT(reporter, path.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, path.isOval(nullptr)); |
m.setRotate(SkIntToScalar(90)); |
SkPath tmp; |
path.transform(m, &tmp); |
// an oval rotated 90 degrees is still an oval. |
- REPORTER_ASSERT(reporter, tmp.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, tmp.isOval(nullptr)); |
m.reset(); |
m.setRotate(SkIntToScalar(30)); |
tmp.reset(); |
path.transform(m, &tmp); |
// an oval rotated 30 degrees is not an oval anymore. |
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); |
// since empty path being transformed. |
path.reset(); |
tmp.reset(); |
m.reset(); |
path.transform(m, &tmp); |
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); |
// empty path is not an oval |
tmp.reset(); |
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); |
// only has moveTo()s |
tmp.reset(); |
tmp.moveTo(0, 0); |
tmp.moveTo(SkIntToScalar(10), SkIntToScalar(10)); |
- REPORTER_ASSERT(reporter, !tmp.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, !tmp.isOval(nullptr)); |
// mimic WebKit's calling convention, |
// call moveTo() first and then call addOval() |
path.reset(); |
path.moveTo(0, 0); |
path.addOval(rect); |
- REPORTER_ASSERT(reporter, path.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, path.isOval(nullptr)); |
// copy path |
path.reset(); |
tmp.reset(); |
tmp.addOval(rect); |
path = tmp; |
- REPORTER_ASSERT(reporter, path.isOval(NULL)); |
+ REPORTER_ASSERT(reporter, path.isOval(nullptr)); |
} |
static void test_empty(skiatest::Reporter* reporter, const SkPath& p) { |
@@ -3204,7 +3204,7 @@ static void test_rrect(skiatest::Reporter* reporter) { |
p.addRRect(rr); |
bool closed; |
SkPath::Direction dir; |
- REPORTER_ASSERT(reporter, p.isRect(NULL, &closed, &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); |
@@ -3494,12 +3494,12 @@ static void test_get_point(skiatest::Reporter* reporter) { |
SkPath p; |
SkPoint pt = p.getPoint(0); |
REPORTER_ASSERT(reporter, pt == SkPoint::Make(0, 0)); |
- REPORTER_ASSERT(reporter, !p.getLastPt(NULL)); |
+ REPORTER_ASSERT(reporter, !p.getLastPt(nullptr)); |
REPORTER_ASSERT(reporter, !p.getLastPt(&pt) && pt == SkPoint::Make(0, 0)); |
p.setLastPt(10, 10); |
pt = p.getPoint(0); |
REPORTER_ASSERT(reporter, pt == SkPoint::Make(10, 10)); |
- REPORTER_ASSERT(reporter, p.getLastPt(NULL)); |
+ REPORTER_ASSERT(reporter, p.getLastPt(nullptr)); |
p.rMoveTo(10, 10); |
REPORTER_ASSERT(reporter, p.getLastPt(&pt) && pt == SkPoint::Make(20, 20)); |
} |
@@ -3615,7 +3615,7 @@ public: |
} |
{ |
- SkScalar* weights = NULL; |
+ SkScalar* weights = nullptr; |
ed.growForRepeatedVerb(SkPath::kConic_Verb, kRepeatCnt, &weights); |
REPORTER_ASSERT(reporter, kRepeatCnt == pathRef->countVerbs()); |
REPORTER_ASSERT(reporter, 2*kRepeatCnt == pathRef->countPoints()); |
@@ -3671,7 +3671,7 @@ static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool |
if (strlen(str) > 0) { |
REPORTER_ASSERT(reporter, !memcmp(data->data(), str, strlen(str))); |
} else { |
- REPORTER_ASSERT(reporter, data->data() == NULL || !memcmp(data->data(), str, strlen(str))); |
+ REPORTER_ASSERT(reporter, data->data() == nullptr || !memcmp(data->data(), str, strlen(str))); |
} |
} |
@@ -3842,8 +3842,8 @@ DEF_TEST(Paths, reporter) { |
REPORTER_ASSERT(reporter, !(p == empty)); |
// do getPoints and getVerbs return the right result |
- REPORTER_ASSERT(reporter, p.getPoints(NULL, 0) == 4); |
- REPORTER_ASSERT(reporter, p.getVerbs(NULL, 0) == 5); |
+ REPORTER_ASSERT(reporter, p.getPoints(nullptr, 0) == 4); |
+ REPORTER_ASSERT(reporter, p.getVerbs(nullptr, 0) == 5); |
SkPoint pts[4]; |
int count = p.getPoints(pts, 4); |
REPORTER_ASSERT(reporter, count == 4); |
@@ -3863,7 +3863,7 @@ DEF_TEST(Paths, reporter) { |
p.offset(SK_Scalar1*3, SK_Scalar1*4); |
REPORTER_ASSERT(reporter, bounds == p.getBounds()); |
- REPORTER_ASSERT(reporter, p.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, p.isRect(nullptr)); |
bounds2.setEmpty(); |
REPORTER_ASSERT(reporter, p.isRect(&bounds2)); |
REPORTER_ASSERT(reporter, bounds == bounds2); |
@@ -3871,7 +3871,7 @@ DEF_TEST(Paths, reporter) { |
// now force p to not be a rect |
bounds.set(0, 0, SK_Scalar1/2, SK_Scalar1/2); |
p.addRect(bounds); |
- REPORTER_ASSERT(reporter, !p.isRect(NULL)); |
+ REPORTER_ASSERT(reporter, !p.isRect(nullptr)); |
// Test an edge case w.r.t. the bound returned by isRect (i.e., the |
// path has a trailing moveTo. Please see crbug.com\445368) |