Replace SK_ARRAY_COUNT with std::size() for skia/tests
Change-Id: I4f0321dbf5c03adc7219ca2cfb6dbfbbaecc1e4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/553582
Commit-Queue: Herb Derby <[email protected]>
Reviewed-by: John Stiles <[email protected]>
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index 2671723..350b631 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -386,12 +386,12 @@
static const SkScalar gSafeX[] = {
0, SK_Scalar1/1000, SK_Scalar1/100, SK_Scalar1/10,
};
- did_dx_affect(reporter, gSafeX, SK_ARRAY_COUNT(gSafeX), false);
+ did_dx_affect(reporter, gSafeX, std::size(gSafeX), false);
static const SkScalar gUnsafeX[] = {
SK_Scalar1/4, SK_Scalar1/3,
};
- did_dx_affect(reporter, gUnsafeX, SK_ARRAY_COUNT(gUnsafeX), true);
+ did_dx_affect(reporter, gUnsafeX, std::size(gUnsafeX), true);
}
static void test_regressions() {
diff --git a/tests/BackendAllocationTest.cpp b/tests/BackendAllocationTest.cpp
index f12350c..2e338c4 100644
--- a/tests/BackendAllocationTest.cpp
+++ b/tests/BackendAllocationTest.cpp
@@ -597,7 +597,7 @@
{ kR8_unorm_SkColorType, { .25f, 0, 0, 1 } },
};
- static_assert(kLastEnum_SkColorType == SK_ARRAY_COUNT(combinations));
+ static_assert(kLastEnum_SkColorType == std::size(combinations));
for (auto combo : combinations) {
SkColorType colorType = combo.fColorType;
diff --git a/tests/BadIcoTest.cpp b/tests/BadIcoTest.cpp
index 024c6ab..41aaa3e 100644
--- a/tests/BadIcoTest.cpp
+++ b/tests/BadIcoTest.cpp
@@ -33,7 +33,7 @@
const char* badImagesFolder = "invalid_images";
- for (size_t i = 0; i < SK_ARRAY_COUNT(badImages); ++i) {
+ for (size_t i = 0; i < std::size(badImages); ++i) {
SkString resourcePath = SkOSPath::Join(badImagesFolder, badImages[i]);
std::unique_ptr<SkStream> stream(GetResourceAsStream(resourcePath.c_str()));
std::unique_ptr<SkCodec> codec(SkCodec::MakeFromStream(std::move(stream)));
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 88c39bf..5996277 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -82,7 +82,7 @@
DEF_TEST(BitmapCopy_extractSubset, reporter) {
const int W = 20;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gPairs); i++) {
+ for (size_t i = 0; i < std::size(gPairs); i++) {
SkBitmap srcOpaque, srcPremul;
setup_src_bitmaps(&srcOpaque, &srcPremul, gPairs[i].fColorType);
@@ -99,7 +99,7 @@
REPORTER_ASSERT(reporter, subset.alphaType() == bitmap.alphaType());
// Test copying an extracted subset.
- for (size_t j = 0; j < SK_ARRAY_COUNT(gPairs); j++) {
+ for (size_t j = 0; j < std::size(gPairs); j++) {
SkBitmap copy;
bool success = ToolUtils::copy_to(©, gPairs[j].fColorType, subset);
if (!success) {
@@ -186,7 +186,7 @@
{ false, {-1,-1 }, { 1, 1 }, { 0, 0 }, { 0, 0, 0, 0 } },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
+ for (size_t i = 0; i < std::size(gRec); ++i) {
clear_4x4_pixels(dstPixels);
dstInfo = dstInfo.makeDimensions(gRec[i].fRequestedDstSize);
diff --git a/tests/BitmapGetColorTest.cpp b/tests/BitmapGetColorTest.cpp
index c27cb2f..64885e2 100644
--- a/tests/BitmapGetColorTest.cpp
+++ b/tests/BitmapGetColorTest.cpp
@@ -34,7 +34,7 @@
const SkColor initColor = 0xFF0000FF;
const SkIRect area = { 1, 1, 3, 3 };
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
+ for (size_t i = 0; i < std::size(gRec); i++) {
SkImageInfo info = SkImageInfo::Make(2, 2, gRec[i].fColorType,
kPremul_SkAlphaType);
SkBitmap bm;
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index ddcc3f7..1e2c6d1 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -133,7 +133,7 @@
for (bool respectCTM : { false, true }) {
paint.setMaskFilter(SkMaskFilter::MakeBlur(blurStyle, sigma, respectCTM));
- for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) {
+ for (size_t test = 0; test < std::size(tests); ++test) {
SkPath path;
tests[test].addPath(&path);
SkPath strokedPath;
@@ -323,7 +323,7 @@
{ 2.3f, 50.3f } // a little divet to throw off the rect special case
};
SkPath polyPath;
- polyPath.addPoly(polyPts, SK_ARRAY_COUNT(polyPts), true);
+ polyPath.addPoly(polyPts, std::size(polyPts), true);
int rectSpecialCaseResult[kSize];
int generalCaseResult[kSize];
@@ -367,9 +367,9 @@
// Test asABlur for SkBlurMaskFilter
//
- for (size_t i = 0; i < SK_ARRAY_COUNT(styles); ++i) {
+ for (size_t i = 0; i < std::size(styles); ++i) {
const SkBlurStyle style = styles[i];
- for (size_t j = 0; j < SK_ARRAY_COUNT(sigmas); ++j) {
+ for (size_t j = 0; j < std::size(sigmas); ++j) {
const SkScalar sigma = sigmas[j];
for (bool respectCTM : { false, true }) {
sk_sp<SkMaskFilter> mf(SkMaskFilter::MakeBlur(style, sigma, respectCTM));
@@ -404,7 +404,7 @@
SkEmbossMaskFilter::Light light = {
{ 1, 1, 1 }, 0, 127, 127
};
- for (size_t j = 0; j < SK_ARRAY_COUNT(sigmas); ++j) {
+ for (size_t j = 0; j < std::size(sigmas); ++j) {
const SkScalar sigma = sigmas[j];
auto mf(SkEmbossMaskFilter::Make(sigma, light));
if (mf) {
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 586393f..c666368 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -96,7 +96,7 @@
kN32_SkColorType,
kRGB_565_SkColorType
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(testTypes); ++i) {
+ for (size_t i = 0; i < std::size(testTypes); ++i) {
TestImageGenerator::TestType test = testTypes[i];
for (const SkColorType testColorType : testColorTypes) {
auto gen = std::make_unique<TestImageGenerator>(test, r, testColorType);
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index 8101dc8..ad1d970 100644
--- a/tests/CanvasStateTest.cpp
+++ b/tests/CanvasStateTest.cpp
@@ -141,7 +141,7 @@
return;
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(colorTypes); ++i) {
+ for (size_t i = 0; i < std::size(colorTypes); ++i) {
sk_sp<SkImage> images[2];
for (int j = 0; j < 2; ++j) {
auto surf = SkSurface::MakeRaster(SkImageInfo::Make(WIDTH, HEIGHT,
@@ -151,7 +151,7 @@
canvas->drawColor(SK_ColorRED);
- for (size_t k = 0; k < SK_ARRAY_COUNT(layerAlpha); ++k) {
+ for (size_t k = 0; k < std::size(layerAlpha); ++k) {
SkTLazy<SkPaint> paint;
if (layerAlpha[k] != 0xFF) {
paint.init()->setAlpha(layerAlpha[k]);
@@ -247,7 +247,7 @@
SkPaint paint;
paint.setAlpha(128);
- for (size_t j = 0; j < SK_ARRAY_COUNT(clipOps); ++j) {
+ for (size_t j = 0; j < std::size(clipOps); ++j) {
SkRect layerBounds = SkRect::Make(layerRect);
canvas->saveLayer(SkCanvas::SaveLayerRec(&layerBounds, &paint));
diff --git a/tests/ChecksumTest.cpp b/tests/ChecksumTest.cpp
index 78c5904..30c5c6b 100644
--- a/tests/ChecksumTest.cpp
+++ b/tests/ChecksumTest.cpp
@@ -16,7 +16,7 @@
const size_t kBytes = SkAlign4(128);
SkRandom rand;
uint32_t data[kBytes/4], tweaked[kBytes/4];
- for (size_t i = 0; i < SK_ARRAY_COUNT(tweaked); ++i) {
+ for (size_t i = 0; i < std::size(tweaked); ++i) {
data[i] = tweaked[i] = rand.nextU();
}
@@ -28,7 +28,7 @@
REPORTER_ASSERT(r, hash == SkOpts::hash(data, kBytes));
// Changing any single element should change the hash.
- for (size_t j = 0; j < SK_ARRAY_COUNT(tweaked); ++j) {
+ for (size_t j = 0; j < std::size(tweaked); ++j) {
const uint32_t saved = tweaked[j];
tweaked[j] = rand.nextU();
const uint32_t tweakedHash = SkOpts::hash(tweaked, kBytes);
diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp
index 0fd6480..fda6024 100644
--- a/tests/ClipStackTest.cpp
+++ b/tests/ClipStackTest.cpp
@@ -149,7 +149,7 @@
{ 60, 60, 100, 100 }
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) {
+ for (size_t i = 0; i < std::size(gRects); i++) {
// the difference op will prevent these from being fused together
stack.clipRect(gRects[i], SkMatrix::I(), SkClipOp::kDifference, false);
}
@@ -249,7 +249,7 @@
int testCase = 0;
int numBitTests = SkClipStack::Element::DeviceSpaceType::kPath == primType ? 4 : 1;
for (int invBits = 0; invBits < numBitTests; ++invBits) {
- for (size_t op = 0; op < SK_ARRAY_COUNT(gOps); ++op) {
+ for (size_t op = 0; op < std::size(gOps); ++op) {
stack.save();
bool doInvA = SkToBool(invBits & 1);
@@ -860,7 +860,7 @@
{ 0, 0, 1000, 1000 },
{ 0, 0, 75, 75 }
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRects); i++) {
+ for (size_t i = 0; i < std::size(gRects); i++) {
stack.clipDevRect(gRects[i], SkClipOp::kIntersect);
}
diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp
index 043f634..1771821 100644
--- a/tests/ClipperTest.cpp
+++ b/tests/ClipperTest.cpp
@@ -97,7 +97,7 @@
{ R, T }, { R + 10, T - 10 },
{ R, B }, { R + 10, B + 10 },
};
- for (i = 0; i < SK_ARRAY_COUNT(gEmpty); i += 2) {
+ for (i = 0; i < std::size(gEmpty); i += 2) {
bool valid = SkLineClipper::IntersectLine(&gEmpty[i], gR, dst);
if (valid) {
SkDebugf("----- [%zu] %g %g -> %g %g\n",
@@ -122,7 +122,7 @@
{ L, T }, { R, T },
{ L, B }, { R, B },
};
- for (i = 0; i < SK_ARRAY_COUNT(gFull); i += 2) {
+ for (i = 0; i < std::size(gFull); i += 2) {
bool valid = SkLineClipper::IntersectLine(&gFull[i], gR, dst);
if (!valid || 0 != memcmp(&gFull[i], dst, sizeof(dst))) {
SkDebugf("++++ [%zu] %g %g -> %g %g\n",
@@ -142,7 +142,7 @@
{ L - 10, T }, { R + 10, T }, { L, T }, { R, T },
{ L - 10, B }, { R + 10, B }, { L, B }, { R, B },
};
- for (i = 0; i < SK_ARRAY_COUNT(gPartial); i += 4) {
+ for (i = 0; i < std::size(gPartial); i += 4) {
bool valid = SkLineClipper::IntersectLine(&gPartial[i], gR, dst);
if (!valid || 0 != memcmp(&gPartial[i+2], dst, sizeof(dst))) {
SkDebugf("++++ [%zu] %g %g -> %g %g\n",
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index cd55b14..55fa7eb 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -274,7 +274,7 @@
"JPG", "JPEG", "PNG", "WEBP"
};
- for (uint32_t i = 0; i < SK_ARRAY_COUNT(exts); i++) {
+ for (uint32_t i = 0; i < std::size(exts); i++) {
if (SkStrEndsWith(path, exts[i])) {
return true;
}
@@ -790,7 +790,7 @@
};
png_set_keep_unknown_chunks(png, PNG_HANDLE_CHUNK_ALWAYS, (png_byte*)"npOl\0npLb\0npTc\0", 3);
- png_set_unknown_chunks(png, info, gUnknowns, SK_ARRAY_COUNT(gUnknowns));
+ png_set_unknown_chunks(png, info, gUnknowns, std::size(gUnknowns));
#if PNG_LIBPNG_VER < 10600
/* Deal with unknown chunk location bug in 1.5.x and earlier */
png_set_unknown_chunk_location(png, info, 0, PNG_HAVE_IHDR);
@@ -815,7 +815,7 @@
}
bool readChunk(const char tag[], const void* data, size_t length) override {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gUnknowns); ++i) {
+ for (size_t i = 0; i < std::size(gUnknowns); ++i) {
if (!strcmp(tag, (const char*) gUnknowns[i].name)) {
// Tag matches. This should have been the first time we see it.
REPORTER_ASSERT(fReporter, !fSeen[i]);
diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp
index 379cd31..045a9dc 100644
--- a/tests/DashPathEffectTest.cpp
+++ b/tests/DashPathEffectTest.cpp
@@ -74,7 +74,7 @@
mats[2].setTranslate(10.0f, 10.0f);
for (int i = 0; i < kNumMats; ++i) {
- for (int j = 0; j < (int)SK_ARRAY_COUNT(testCases); ++j) {
+ for (int j = 0; j < (int)std::size(testCases); ++j) {
for (int k = 0; k < 2; ++k) { // exercise alternating endpoints
SkPathEffectBase::PointData results;
SkPath src;
@@ -121,7 +121,7 @@
// force the bounds to outset by a large amount
p.setStrokeWidth(5.0e10f);
const SkScalar intervals[] = { 1, 1 };
- p.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ p.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
canvas->drawLine(1, 1, 1, 5.0e10f, p);
}
@@ -129,7 +129,7 @@
// trying to substract a smal value from a large one in floats.
DEF_TEST(DashCrazy_crbug_875494, r) {
SkScalar vals[] = { 98, 94, 2888458849.f, 227, 0, 197 };
- const int N = SK_ARRAY_COUNT(vals);
+ const int N = std::size(vals);
SkRect cull = SkRect::MakeXYWH(43,236,57,149);
SkPath path;
diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp
index ad4f124..ba9c4be 100644
--- a/tests/DataRefTest.cpp
+++ b/tests/DataRefTest.cpp
@@ -57,7 +57,7 @@
static void test_simpletable(skiatest::Reporter* reporter) {
const int idata[] = { 1, 4, 9, 16, 25, 63 };
- int icount = SK_ARRAY_COUNT(idata);
+ int icount = std::size(idata);
sk_sp<SkDataTable> itable(SkDataTable::MakeCopyArray(idata, sizeof(idata[0]), icount));
REPORTER_ASSERT(reporter, itable->count() == icount);
for (int i = 0; i < icount; ++i) {
@@ -72,8 +72,8 @@
const char* str[] = {
"", "a", "be", "see", "deigh", "ef", "ggggggggggggggggggggggggggg"
};
- int count = SK_ARRAY_COUNT(str);
- size_t sizes[SK_ARRAY_COUNT(str)];
+ int count = std::size(str);
+ size_t sizes[std::size(str)];
for (int i = 0; i < count; ++i) {
sizes[i] = strlen(str[i]) + 1;
}
@@ -97,7 +97,7 @@
static const int gData[] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};
- int count = SK_ARRAY_COUNT(gData);
+ int count = std::size(gData);
sk_sp<SkDataTable> table(
SkDataTable::MakeArrayProc(gData, sizeof(gData[0]), count, nullptr, nullptr));
@@ -216,7 +216,7 @@
SkData::MakeWithProc(nullptr, 0, [](const void*, void*){}, nullptr),
SkData::MakeWithoutCopy(nullptr, 0),
};
- constexpr int N = SK_ARRAY_COUNT(array);
+ constexpr int N = std::size(array);
for (int i = 0; i < N; ++i) {
REPORTER_ASSERT(reporter, array[i]->size() == 0);
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index de882ef..c489dbf 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -190,7 +190,7 @@
{ 0x7f, 0xFFFF }, // should draw, test max height
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
+ for (size_t i = 0; i < std::size(gTests); ++i) {
test_wacky_bitmapshader(reporter,
gTests[i].fWidth, gTests[i].fHeight);
}
diff --git a/tests/DrawTextTest.cpp b/tests/DrawTextTest.cpp
index 981b6f6..4ce283f 100644
--- a/tests/DrawTextTest.cpp
+++ b/tests/DrawTextTest.cpp
@@ -96,7 +96,7 @@
paint.setStrokeWidth(2);
constexpr SkScalar bigInterval = 10000;
static constexpr SkScalar intervals[] = { 1, bigInterval };
- paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 2));
+ paint.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 2));
drawDashedTextCanvas.drawColor(SK_ColorWHITE);
drawDashedTextCanvas.drawString("A", point.fX, point.fY, font, paint);
diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp
index 38b819b..e3c2f26 100644
--- a/tests/EmptyPathTest.cpp
+++ b/tests/EmptyPathTest.cpp
@@ -77,9 +77,9 @@
SkPaint::kStroke_Style,
SkPaint::kStrokeAndFill_Style
};
- for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
- for (size_t join = 0; join < SK_ARRAY_COUNT(gJoins); ++join) {
- for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ for (size_t cap = 0; cap < std::size(gCaps); ++cap) {
+ for (size_t join = 0; join < std::size(gJoins); ++join) {
+ for (size_t style = 0; style < std::size(gStyles); ++style) {
if (drawCaps && SkPaint::kButt_Cap != gCaps[cap]
&& SkPaint::kFill_Style != gStyles[style]) {
continue;
@@ -133,7 +133,7 @@
SkPathFillType::kInverseEvenOdd
};
for (int doClose = 0; doClose < 2; ++doClose) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gMakeProc); ++i) {
+ for (size_t i = 0; i < std::size(gMakeProc); ++i) {
SkPath path;
gMakeProc[i](&path);
if (doClose) {
@@ -143,7 +143,7 @@
bool allowCaps = make_L == gMakeProc[i] || make_Q == gMakeProc[i]
|| make_C == gMakeProc[i] || make_MZM == gMakeProc[i];
allowCaps |= SkToBool(doClose);
- for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
+ for (size_t fill = 0; fill < std::size(gFills); ++fill) {
path.setFillType(gFills[fill]);
bool shouldDraw = path.isInverseFillType();
iter_paint(reporter, path, shouldDraw, allowCaps ? kDrawCaps : kDontDrawCaps);
diff --git a/tests/ExtendedSkColorTypeTests.cpp b/tests/ExtendedSkColorTypeTests.cpp
index ddc2cde..f341c75 100644
--- a/tests/ExtendedSkColorTypeTests.cpp
+++ b/tests/ExtendedSkColorTypeTests.cpp
@@ -299,7 +299,7 @@
}
DEF_TEST(ExtendedSkColorTypeTests_raster, reporter) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
+ for (size_t i = 0; i < std::size(gTests); ++i) {
raster_tests(reporter, gTests[i]);
}
}
@@ -307,7 +307,7 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ExtendedSkColorTypeTests_gpu, reporter, ctxInfo) {
auto context = ctxInfo.directContext();
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
+ for (size_t i = 0; i < std::size(gTests); ++i) {
gpu_tests(context, reporter, gTests[i]);
}
}
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index 0b7346d..c8d1d89 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -87,7 +87,7 @@
SkDebugf("[%d:%d] '%s'\n", ttcIndex, i, str.c_str());
#endif
size_t size = SkFontStream::GetTableSize(stream, ttcIndex, array[i]);
- for (size_t j = 0; j < SK_ARRAY_COUNT(gKnownTableSizes); ++j) {
+ for (size_t j = 0; j < std::size(gKnownTableSizes); ++j) {
if (gKnownTableSizes[j].fTag == array[i]) {
REPORTER_ASSERT(reporter, gKnownTableSizes[j].fSize == size);
}
@@ -152,7 +152,7 @@
SkDebugf("%s %d\n", name, size);
#endif
- for (size_t j = 0; j < SK_ARRAY_COUNT(gKnownTableSizes); ++j) {
+ for (size_t j = 0; j < std::size(gKnownTableSizes); ++j) {
if (gKnownTableSizes[j].fTag == tags[i]) {
REPORTER_ASSERT(reporter, gKnownTableSizes[j].fSize == size);
}
@@ -180,7 +180,7 @@
"Hiragino Mincho ProN", "MS PGothic",
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); ++i) {
+ for (size_t i = 0; i < std::size(gNames); ++i) {
sk_sp<SkTypeface> face(SkTypeface::MakeFromName(gNames[i], SkFontStyle()));
if (face) {
#ifdef DUMP_TABLES
@@ -235,15 +235,15 @@
char const * const txt = "long.text.with.lots.of.dots.";
size_t textLen = strlen(txt);
- for (size_t i = 0; i < SK_ARRAY_COUNT(faces); i++) {
+ for (size_t i = 0; i < std::size(faces); i++) {
font.setTypeface(SkTypeface::MakeFromName(faces[i], SkFontStyle()));
- for (size_t j = 0; j < SK_ARRAY_COUNT(settings); j++) {
+ for (size_t j = 0; j < std::size(settings); j++) {
font.setHinting(settings[j].hinting);
font.setLinearMetrics(settings[j].linear);
font.setSubpixel(settings[j].subpixel);
- for (size_t k = 0; k < SK_ARRAY_COUNT(gScaleRec); ++k) {
+ for (size_t k = 0; k < std::size(gScaleRec); ++k) {
font.setScaleX(gScaleRec[k].fScaleX);
font.setSkewX(gScaleRec[k].fSkewX);
diff --git a/tests/FontMgrAndroidParserTest.cpp b/tests/FontMgrAndroidParserTest.cpp
index 149c175..13b8830 100644
--- a/tests/FontMgrAndroidParserTest.cpp
+++ b/tests/FontMgrAndroidParserTest.cpp
@@ -323,7 +323,7 @@
SkFontArguments::VariationPosition::Coordinate
coordinates[] = {{tag, styleValue}};
SkFontArguments::VariationPosition
- position = {coordinates, SK_ARRAY_COUNT(coordinates)};
+ position = {coordinates, std::size(coordinates)};
SkFont fontStream(
fontMgr->makeFromStream(distortableStream->duplicate(),
diff --git a/tests/FontMgrFontConfigTest.cpp b/tests/FontMgrFontConfigTest.cpp
index bed4dbc..9124961 100644
--- a/tests/FontMgrFontConfigTest.cpp
+++ b/tests/FontMgrFontConfigTest.cpp
@@ -103,7 +103,7 @@
SkFontArguments::VariationPosition::Coordinate
coordinates[] = {{tag, styleValue}};
SkFontArguments::VariationPosition
- position = {coordinates, SK_ARRAY_COUNT(coordinates)};
+ position = {coordinates, std::size(coordinates)};
SkFont fontStream(
fontMgr->makeFromStream(distortableStream->duplicate(),
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 95cf956..7b8d03c 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -38,7 +38,7 @@
for (const auto glyph : glyphs) { REPORTER_ASSERT(reporter, glyph == 0); }
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs,
- SK_ARRAY_COUNT(glyphs)) == count);
+ std::size(glyphs)) == count);
for (int i = 0; i < count; ++i) {
REPORTER_ASSERT(reporter, 0 != glyphs[i]);
@@ -62,7 +62,7 @@
"sans", "sans-serif", "serif", "monospace", "times", "helvetica"
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(inNames); ++i) {
+ for (size_t i = 0; i < std::size(inNames); ++i) {
sk_sp<SkTypeface> first(SkTypeface::MakeFromName(inNames[i], SkFontStyle()));
if (nullptr == first.get()) {
continue;
diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp
index ee7f648..0ffa292 100644
--- a/tests/GeometryTest.cpp
+++ b/tests/GeometryTest.cpp
@@ -57,16 +57,16 @@
// Ensure an odd number of T values so we exercise the single chop code at the end of
// SkChopCubicAt form multiple T.
- static_assert(SK_ARRAY_COUNT(chopTs) % 2 == 1);
- static_assert(SK_ARRAY_COUNT(ones) % 2 == 1);
+ static_assert(std::size(chopTs) % 2 == 1);
+ static_assert(std::size(ones) % 2 == 1);
SkRandom rand;
for (int iterIdx = 0; iterIdx < 5; ++iterIdx) {
SkPoint pts[4] = {{rand.nextF(), rand.nextF()}, {rand.nextF(), rand.nextF()},
{rand.nextF(), rand.nextF()}, {rand.nextF(), rand.nextF()}};
- SkPoint allChops[4 + SK_ARRAY_COUNT(chopTs)*3];
- SkChopCubicAt(pts, allChops, chopTs, SK_ARRAY_COUNT(chopTs));
+ SkPoint allChops[4 + std::size(chopTs)*3];
+ SkChopCubicAt(pts, allChops, chopTs, std::size(chopTs));
int i = 3;
for (float chopT : chopTs) {
// Ensure we chop at approximately the correct points when we chop an entire list.
@@ -105,12 +105,12 @@
}
// Now test what happens when SkChopCubicAt does 0/0 and gets NaN values.
- SkPoint oneChops[4 + SK_ARRAY_COUNT(ones)*3];
- SkChopCubicAt(pts, oneChops, ones, SK_ARRAY_COUNT(ones));
+ SkPoint oneChops[4 + std::size(ones)*3];
+ SkChopCubicAt(pts, oneChops, ones, std::size(ones));
REPORTER_ASSERT(reporter, oneChops[0] == pts[0]);
REPORTER_ASSERT(reporter, oneChops[1] == pts[1]);
REPORTER_ASSERT(reporter, oneChops[2] == pts[2]);
- for (size_t index = 3; index < SK_ARRAY_COUNT(oneChops); ++index) {
+ for (size_t index = 3; index < std::size(oneChops); ++index) {
REPORTER_ASSERT(reporter, oneChops[index] == pts[3]);
}
}
@@ -193,7 +193,7 @@
{10, 20}, {15, 25}, {20, 30},
{10, 20}, {20, 30}, {20, 30},
};
- int count = (int) SK_ARRAY_COUNT(pts) / 3;
+ int count = (int) std::size(pts) / 3;
for (int index = 0; index < count; ++index) {
SkConic conic(&pts[index * 3], 0.707f);
SkVector start = SkEvalQuadTangentAt(&pts[index * 3], 0);
@@ -213,7 +213,7 @@
{ 10, 20}, {15, 25}, {20, 30},
{ 10, 20}, {20, 30}, {20, 30}
};
- int count = (int) SK_ARRAY_COUNT(pts) / 3;
+ int count = (int) std::size(pts) / 3;
for (int index = 0; index < count; ++index) {
SkConic conic(&pts[index * 3], 0.707f);
SkVector start = conic.evalTangentAt(0);
@@ -269,7 +269,7 @@
{ 10, 20}, {15, 25}, {20, 30}, {30, 40},
{ 10, 20}, {20, 30}, {30, 40}, {30, 40},
};
- int count = (int) SK_ARRAY_COUNT(pts) / 4;
+ int count = (int) std::size(pts) / 4;
for (int index = 0; index < count; ++index) {
SkConic conic(&pts[index * 3], 0.707f);
SkVector start, mid, end;
@@ -472,7 +472,7 @@
static void test_chop_cubic_at_midtangent(skiatest::Reporter* reporter, const SkPoint pts[4],
SkCubicType cubicType) {
constexpr float kTolerance = 1e-3f;
- int n = SK_ARRAY_COUNT(kSkewMatrices);
+ int n = std::size(kSkewMatrices);
if (cubicType == SkCubicType::kLocalCusp || cubicType == SkCubicType::kLineOrPoint) {
// FP precision isn't always enough to get the exact correct T value of the mid-tangent on
// cusps and lines. Only test the identity matrix and the matrix with all 1's.
diff --git a/tests/GrMemoryPoolTest.cpp b/tests/GrMemoryPoolTest.cpp
index 23b9df3..ae871cb 100644
--- a/tests/GrMemoryPoolTest.cpp
+++ b/tests/GrMemoryPoolTest.cpp
@@ -129,14 +129,14 @@
public:
E() {}
void setValues(int v) override {
- for (size_t i = 0; i < SK_ARRAY_COUNT(fIntArray); ++i) {
+ for (size_t i = 0; i < std::size(fIntArray); ++i) {
fIntArray[i] = v;
}
this->INHERITED::setValues(v);
}
bool checkValues(int v) override {
bool ok = true;
- for (size_t i = 0; ok && i < SK_ARRAY_COUNT(fIntArray); ++i) {
+ for (size_t i = 0; ok && i < std::size(fIntArray); ++i) {
if (fIntArray[i] != v) {
ok = false;
}
@@ -192,10 +192,10 @@
static const int kCheckPeriod = 500;
SkRandom r;
- for (size_t s = 0; s < SK_ARRAY_COUNT(gSizes); ++s) {
+ for (size_t s = 0; s < std::size(gSizes); ++s) {
A::SetAllocator(gSizes[s][0], gSizes[s][1]);
A::ValidatePool();
- for (size_t c = 0; c < SK_ARRAY_COUNT(gCreateFraction); ++c) {
+ for (size_t c = 0; c < std::size(gCreateFraction); ++c) {
SkTDArray<Rec> instanceRecs;
for (int i = 0; i < kNumIters; ++i) {
float createOrDestroy = r.nextUScalar1();
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index f708609..b2bd663 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -73,7 +73,7 @@
private:
PipelineDynamicStateTestProcessor() : INHERITED(kGrPipelineDynamicStateTestProcessor_ClassID) {
- this->setVertexAttributesWithImplicitOffsets(kAttributes, SK_ARRAY_COUNT(kAttributes));
+ this->setVertexAttributesWithImplicitOffsets(kAttributes, std::size(kAttributes));
}
const Attribute& inVertex() const { return kAttributes[0]; }
diff --git a/tests/GrQuadBufferTest.cpp b/tests/GrQuadBufferTest.cpp
index f8f0a5b..a3d5628 100644
--- a/tests/GrQuadBufferTest.cpp
+++ b/tests/GrQuadBufferTest.cpp
@@ -89,8 +89,8 @@
GrQuad::Type::kGeneral, GrQuad::Type::kGeneral, GrQuad::Type::kRectilinear,
GrQuad::Type::kRectilinear, GrQuad::Type::kAxisAligned, GrQuad::Type::kAxisAligned
};
- static_assert(SK_ARRAY_COUNT(kDeviceTypes) == kQuadCount, "device quad count");
- static_assert(SK_ARRAY_COUNT(kLocalTypes) == kQuadCount, "local quad count");
+ static_assert(std::size(kDeviceTypes) == kQuadCount, "device quad count");
+ static_assert(std::size(kLocalTypes) == kQuadCount, "local quad count");
std::vector<GrQuad> expectedDeviceQuads = generate_quads(1.f, kQuadCount, kDeviceTypes);
std::vector<GrQuad> expectedLocalQuads = generate_quads(2.f, kQuadCount, kLocalTypes);
@@ -134,8 +134,8 @@
static const int kQuadCount = 2;
static const GrQuad::Type kTypesA[] = { GrQuad::Type::kAxisAligned, GrQuad::Type::kRectilinear };
static const GrQuad::Type kTypesB[] = { GrQuad::Type::kGeneral, GrQuad::Type::kPerspective };
- static_assert(SK_ARRAY_COUNT(kTypesA) == kQuadCount, "quadsA count");
- static_assert(SK_ARRAY_COUNT(kTypesB) == kQuadCount, "quadsB count");
+ static_assert(std::size(kTypesA) == kQuadCount, "quadsA count");
+ static_assert(std::size(kTypesB) == kQuadCount, "quadsB count");
std::vector<GrQuad> quadsA = generate_quads(1.f, kQuadCount, kTypesA);
std::vector<GrQuad> quadsB = generate_quads(2.f, kQuadCount, kTypesB);
diff --git a/tests/GrRenderTaskClusterTest.cpp b/tests/GrRenderTaskClusterTest.cpp
index a5f0cfb..789d106 100644
--- a/tests/GrRenderTaskClusterTest.cpp
+++ b/tests/GrRenderTaskClusterTest.cpp
@@ -128,7 +128,7 @@
create_graph3
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(tests); ++i) {
+ for (size_t i = 0; i < std::size(tests); ++i) {
SkTArray<sk_sp<GrMockRenderTask>> graph;
SkTArray<sk_sp<GrMockRenderTask>> expectedOutput;
diff --git a/tests/GrStyledShapeTest.cpp b/tests/GrStyledShapeTest.cpp
index ab1d1d9..5518d8c 100644
--- a/tests/GrStyledShapeTest.cpp
+++ b/tests/GrStyledShapeTest.cpp
@@ -759,12 +759,12 @@
static sk_sp<SkPathEffect> make_dash() {
static const SkScalar kIntervals[] = { 0.25, 3.f, 0.5, 2.f };
static const SkScalar kPhase = 0.75;
- return SkDashPathEffect::Make(kIntervals, SK_ARRAY_COUNT(kIntervals), kPhase);
+ return SkDashPathEffect::Make(kIntervals, std::size(kIntervals), kPhase);
}
static sk_sp<SkPathEffect> make_null_dash() {
static const SkScalar kNullIntervals[] = {0, 0, 0, 0, 0, 0};
- return SkDashPathEffect::Make(kNullIntervals, SK_ARRAY_COUNT(kNullIntervals), 0.f);
+ return SkDashPathEffect::Make(kNullIntervals, std::size(kNullIntervals), 0.f);
}
// We make enough TestCases, and they're large enough, that on Google3 builds we exceed
@@ -1664,7 +1664,7 @@
strokeRecs[kStrokeAndFill].setStrokeParams(SkPaint::kButt_Cap, SkPaint::kBevel_Join, 1.f);
sk_sp<SkPathEffect> dashEffect = make_dash();
- static constexpr Style kStyleCnt = static_cast<Style>(SK_ARRAY_COUNT(strokeRecs));
+ static constexpr Style kStyleCnt = static_cast<Style>(std::size(strokeRecs));
auto index = [](bool inverted,
SkPathDirection dir,
@@ -2001,10 +2001,10 @@
DEF_TEST(GrStyledShape_stroked_lines, r) {
static constexpr SkScalar kIntervals1[] = {1.f, 0.f};
- auto dash1 = SkDashPathEffect::Make(kIntervals1, SK_ARRAY_COUNT(kIntervals1), 0.f);
+ auto dash1 = SkDashPathEffect::Make(kIntervals1, std::size(kIntervals1), 0.f);
REPORTER_ASSERT(r, dash1);
static constexpr SkScalar kIntervals2[] = {10.f, 0.f, 5.f, 0.f};
- auto dash2 = SkDashPathEffect::Make(kIntervals2, SK_ARRAY_COUNT(kIntervals2), 10.f);
+ auto dash2 = SkDashPathEffect::Make(kIntervals2, std::size(kIntervals2), 10.f);
REPORTER_ASSERT(r, dash2);
sk_sp<SkPathEffect> pathEffects[] = {nullptr, std::move(dash1), std::move(dash2)};
@@ -2290,7 +2290,7 @@
roundStrokeAndFill.setStrokeStyle(2.f, true);
static constexpr SkScalar kIntervals[] = {1, 2};
- auto dash = SkDashPathEffect::Make(kIntervals, SK_ARRAY_COUNT(kIntervals), 1.5f);
+ auto dash = SkDashPathEffect::Make(kIntervals, std::size(kIntervals), 1.5f);
SkTArray<GrStyle> styles;
styles.push_back(GrStyle::SimpleFill());
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index 53e9480..f5d5c77 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -171,7 +171,7 @@
static const SkScalar gRad[] = { SkIntToScalar(1), SkIntToScalar(2) };
GradRec rec;
- rec.fColorCount = SK_ARRAY_COUNT(gColors);
+ rec.fColorCount = std::size(gColors);
rec.fColors = gColors;
rec.fPos = gPos;
rec.fPoint = gPts;
@@ -187,7 +187,7 @@
conical_gradproc,
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gProcs); ++i) {
+ for (size_t i = 0; i < std::size(gProcs); ++i) {
gProcs[i](reporter, rec, rec);
}
}
@@ -246,13 +246,13 @@
SkTileMode::kClamp, SkTileMode::kRepeat, SkTileMode::kMirror,
// TODO: add kDecal_TileMode when it is implemented
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gProcInfo); ++i) {
+ for (size_t i = 0; i < std::size(gProcInfo); ++i) {
for (auto mode : modes) {
if (gProcInfo[i].fIsClampRestricted && mode != SkTileMode::kClamp) {
continue;
}
- for (size_t t = 0; t < SK_ARRAY_COUNT(gTests); ++t) {
+ for (size_t t = 0; t < std::size(gTests); ++t) {
GradRec rec;
rec.fColorCount = gTests[t].fCount;
rec.fColors = gTests[t].fCol;
@@ -327,7 +327,7 @@
p.setShader(SkGradientShader::MakeTwoPointConical(
SkPoint::Make(2.5f, 2.5f), 0,
SkPoint::Make(3.0f, 3.0f), 10,
- colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp));
+ colors, nullptr, std::size(colors), SkTileMode::kClamp));
surface->getCanvas()->drawPaint(p);
// r == 0 for the center pixel.
@@ -444,7 +444,7 @@
{{0, -2.752941f}, {0, 0}},
gColors0,
nullptr,
- SK_ARRAY_COUNT(gColors0),
+ std::size(gColors0),
SkTileMode::kClamp,
0,
gMatrix0,
@@ -454,7 +454,7 @@
{{4.42539023e-39f, -4.42539023e-39f}, {9.78041162e-15f, 4.42539023e-39f}},
gColors1,
gPos1,
- SK_ARRAY_COUNT(gColors1),
+ std::size(gColors1),
SkTileMode::kClamp,
0,
nullptr,
@@ -464,7 +464,7 @@
{{4.42539023e-39f, 6.40969056e-10f}, {6.40969056e-10f, 1.49237238e-19f}},
gColors1,
gPos1,
- SK_ARRAY_COUNT(gColors1),
+ std::size(gColors1),
SkTileMode::kClamp,
0,
nullptr,
@@ -474,7 +474,7 @@
{{6.40969056e-10f, 6.40969056e-10f}, {6.40969056e-10f, -0.688235283f}},
gColors0,
nullptr,
- SK_ARRAY_COUNT(gColors0),
+ std::size(gColors0),
SkTileMode::kClamp,
0,
gMatrix3,
@@ -544,7 +544,7 @@
{ 0, 0 },
gColors0,
gPos0,
- SK_ARRAY_COUNT(gColors0),
+ std::size(gColors0),
gMatrix0
},
};
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index 44f7762..2abe392 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -271,7 +271,7 @@
sk_sp<SkImage> image1(surface->makeImageSnapshot());
REPORTER_ASSERT(reporter, image1->readPixels(nullptr, dstInfo, pixels, dstRowBytes, 0, 0));
- for (size_t i = 0; i < SK_ARRAY_COUNT(pixels); ++i) {
+ for (size_t i = 0; i < std::size(pixels); ++i) {
REPORTER_ASSERT(reporter, pixels[i] == green);
}
@@ -311,7 +311,7 @@
{ make_bitmap_immutable, true, true, false },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
+ for (size_t i = 0; i < std::size(rec); ++i) {
SkBitmap bm;
rec[i].fMakeProc(&bm);
diff --git a/tests/InfRectTest.cpp b/tests/InfRectTest.cpp
index afabca8..df05449 100644
--- a/tests/InfRectTest.cpp
+++ b/tests/InfRectTest.cpp
@@ -32,7 +32,7 @@
REPORTER_ASSERT(reporter, rect.isFinite());
const SkScalar invalid[] = { nan, inf, -inf };
- for (size_t i = 0; i < SK_ARRAY_COUNT(invalid); ++i) {
+ for (size_t i = 0; i < std::size(invalid); ++i) {
check_invalid(reporter, small, small, big, invalid[i]);
check_invalid(reporter, small, small, invalid[i], big);
check_invalid(reporter, small, invalid[i], big, big);
diff --git a/tests/JSONTest.cpp b/tests/JSONTest.cpp
index 610a9e8..1cd9093 100644
--- a/tests/JSONTest.cpp
+++ b/tests/JSONTest.cpp
@@ -378,7 +378,7 @@
check_value<ArrayValue>(reporter, v9, "[]");
const Value values0[] = { v0, v3, v9 };
- const auto v10 = ArrayValue(values0, SK_ARRAY_COUNT(values0), alloc);
+ const auto v10 = ArrayValue(values0, std::size(values0), alloc);
check_value<ArrayValue>(reporter, v10, "[null,0,[]]");
const auto v11 = ObjectValue(nullptr, 0, alloc);
@@ -389,7 +389,7 @@
{ StringValue("key_1", 5, alloc), v4 },
{ StringValue("key_2", 5, alloc), v11 },
};
- const auto v12 = ObjectValue(members0, SK_ARRAY_COUNT(members0), alloc);
+ const auto v12 = ObjectValue(members0, std::size(members0), alloc);
check_value<ObjectValue>(reporter, v12, "{"
"\"key_0\":true,"
"\"key_1\":42,"
@@ -397,7 +397,7 @@
"}");
const Value values1[] = { v2, v6, v12 };
- const auto v13 = ArrayValue(values1, SK_ARRAY_COUNT(values1), alloc);
+ const auto v13 = ArrayValue(values1, std::size(values1), alloc);
check_value<ArrayValue>(reporter, v13, "["
"false,"
"\"\","
@@ -413,7 +413,7 @@
{ StringValue("key_01", 6, alloc), v7 },
{ StringValue("key_02", 6, alloc), v13 },
};
- const auto v14 = ObjectValue(members1, SK_ARRAY_COUNT(members1), alloc);
+ const auto v14 = ObjectValue(members1, std::size(members1), alloc);
check_value<ObjectValue>(reporter, v14, "{"
"\"key_00\":42.75,"
"\"key_01\":\" foo \","
diff --git a/tests/MD5Test.cpp b/tests/MD5Test.cpp
index cf03d4f..27528b7 100644
--- a/tests/MD5Test.cpp
+++ b/tests/MD5Test.cpp
@@ -9,7 +9,7 @@
#include "tests/Test.h"
static bool digests_equal(const SkMD5::Digest& expectedDigest, const SkMD5::Digest& computedDigest) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(expectedDigest.data); ++i) {
+ for (size_t i = 0; i < std::size(expectedDigest.data); ++i) {
if (expectedDigest.data[i] != computedDigest.data[i]) {
return false;
}
@@ -58,7 +58,7 @@
};
DEF_TEST(MD5, reporter) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(md5_tests); ++i) {
+ for (size_t i = 0; i < std::size(md5_tests); ++i) {
md5_test(md5_tests[i].message, md5_tests[i].digest, reporter);
}
}
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 7883926..171b430 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -88,7 +88,7 @@
0, 1, 1.1f, 1.01f, 1.001f, 1.0001f, 1.00001f, 1.000001f, 1.0000001f
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gVals); ++i) {
+ for (size_t i = 0; i < std::size(gVals); ++i) {
test_floor_value(reporter, gVals[i]);
// test_floor_value(reporter, -gVals[i]);
}
@@ -202,7 +202,7 @@
-0.f, -1.f, -0.5f, -0.499999f, -0.5000001f, -1.f/3
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gFloats); ++i) {
+ for (size_t i = 0; i < std::size(gFloats); ++i) {
SkHalf h = SkFloatToHalf(gFloats[i]);
float f = SkHalfToFloat(h);
REPORTER_ASSERT(reporter, SkScalarNearlyEqual(f, gFloats[i]));
@@ -375,7 +375,7 @@
-1, 1, 1,
-1, -1, -1,
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTriples); i += 3) {
+ for (size_t i = 0; i < std::size(gTriples); i += 3) {
REPORTER_ASSERT(reporter,
SkCopySign32(gTriples[i], gTriples[i+1]) == gTriples[i+2]);
float x = (float)gTriples[i];
@@ -639,13 +639,13 @@
REPORTER_ASSERT(reporter, 0x11223344 == SkTEndianSwap32<0x44332211>::value);
REPORTER_ASSERT(reporter, 0x1122334455667788ULL == SkTEndianSwap64<0x8877665544332211ULL>::value);
- for (size_t i = 0; i < SK_ARRAY_COUNT(g16); ++i) {
+ for (size_t i = 0; i < std::size(g16); ++i) {
REPORTER_ASSERT(reporter, g16[i].fYang == SkEndianSwap16(g16[i].fYin));
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(g32); ++i) {
+ for (size_t i = 0; i < std::size(g32); ++i) {
REPORTER_ASSERT(reporter, g32[i].fYang == SkEndianSwap32(g32[i].fYin));
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(g64); ++i) {
+ for (size_t i = 0; i < std::size(g64); ++i) {
REPORTER_ASSERT(reporter, g64[i].fYang == SkEndianSwap64(g64[i].fYin));
}
}
@@ -667,7 +667,7 @@
{(T)-17, (T)-4},
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(kEdgeCases); i++) {
+ for (size_t i = 0; i < std::size(kEdgeCases); i++) {
const T numer = kEdgeCases[i].numer;
const T denom = kEdgeCases[i].denom;
T div, mod;
@@ -856,7 +856,7 @@
DEF_TEST(unit_floats, r) {
// pick a non-trivial, non-pow-2 value, to test the loop
float v[13];
- constexpr int N = SK_ARRAY_COUNT(v);
+ constexpr int N = std::size(v);
// empty array reports true
REPORTER_ASSERT(r, sk_floats_are_unit(v, 0));
diff --git a/tests/MatrixClipCollapseTest.cpp b/tests/MatrixClipCollapseTest.cpp
index e52fefd..8993ba6 100644
--- a/tests/MatrixClipCollapseTest.cpp
+++ b/tests/MatrixClipCollapseTest.cpp
@@ -665,9 +665,9 @@
PFEmitMC gMCs[] = { emit_clip_and_mat, emit_mat_and_clip,
emit_double_mat_and_clip, emit_mat_clip_clip };
- for (size_t i = 0; i < SK_ARRAY_COUNT(gStructure); ++i) {
- for (size_t j = 0; j < SK_ARRAY_COUNT(gBody); ++j) {
- for (size_t k = 0; k < SK_ARRAY_COUNT(gMCs); ++k) {
+ for (size_t i = 0; i < std::size(gStructure); ++i) {
+ for (size_t j = 0; j < std::size(gBody); ++j) {
+ for (size_t k = 0; k < std::size(gMCs); ++k) {
for (int l = 0; l < kMatTypeCount; ++l) {
for (int m = 0; m < kClipTypeCount; ++m) {
for (int n = 0; n < kNonSaveLayerDrawOpTypeCount; ++n) {
diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp
index edc7f26..88f8dce 100644
--- a/tests/MatrixTest.cpp
+++ b/tests/MatrixTest.cpp
@@ -250,10 +250,10 @@
SkMatrix baseMats[] = {scale, rot90Scale, rotate,
translate, perspX, perspY};
- SkMatrix mats[2*SK_ARRAY_COUNT(baseMats)];
- for (size_t i = 0; i < SK_ARRAY_COUNT(baseMats); ++i) {
+ SkMatrix mats[2*std::size(baseMats)];
+ for (size_t i = 0; i < std::size(baseMats); ++i) {
mats[i] = baseMats[i];
- bool invertible = mats[i].invert(&mats[i + SK_ARRAY_COUNT(baseMats)]);
+ bool invertible = mats[i].invert(&mats[i + std::size(baseMats)]);
REPORTER_ASSERT(reporter, invertible);
}
SkRandom rand;
@@ -261,7 +261,7 @@
SkMatrix mat;
mat.reset();
for (int i = 0; i < 4; ++i) {
- int x = rand.nextU() % SK_ARRAY_COUNT(mats);
+ int x = rand.nextU() % std::size(mats);
mat.postConcat(mats[x]);
}
@@ -285,7 +285,7 @@
static const SkScalar gCloseScaleTol = (97 * SK_Scalar1) / 100;
SkScalar max = 0, min = SK_ScalarMax;
SkVector vectors[1000];
- for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) {
+ for (size_t i = 0; i < std::size(vectors); ++i) {
vectors[i].fX = rand.nextSScalar1();
vectors[i].fY = rand.nextSScalar1();
if (!vectors[i].normalize()) {
@@ -293,8 +293,8 @@
continue;
}
}
- mat.mapVectors(vectors, SK_ARRAY_COUNT(vectors));
- for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) {
+ mat.mapVectors(vectors, std::size(vectors));
+ for (size_t i = 0; i < std::size(vectors); ++i) {
SkScalar d = vectors[i].length();
REPORTER_ASSERT(reporter, d / maxScale < gVectorScaleTol);
REPORTER_ASSERT(reporter, minScale / d < gVectorScaleTol);
@@ -909,7 +909,7 @@
{ 1, 1, 1, 1, false }
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRectStaysRectSamples); i++) {
+ for (size_t i = 0; i < std::size(gRectStaysRectSamples); i++) {
SkMatrix m;
m.reset();
diff --git a/tests/MetaDataTest.cpp b/tests/MetaDataTest.cpp
index 7f3f9fc..b47c020 100644
--- a/tests/MetaDataTest.cpp
+++ b/tests/MetaDataTest.cpp
@@ -54,7 +54,7 @@
while ((name = iter.next(&t, &count)) != nullptr)
{
int match = 0;
- for (unsigned i = 0; i < SK_ARRAY_COUNT(gElems); i++)
+ for (unsigned i = 0; i < std::size(gElems); i++)
{
if (!strcmp(name, gElems[i].fName))
{
@@ -66,7 +66,7 @@
REPORTER_ASSERT(reporter, match == 1);
loop += 1;
}
- REPORTER_ASSERT(reporter, loop == SK_ARRAY_COUNT(gElems));
+ REPORTER_ASSERT(reporter, loop == std::size(gElems));
REPORTER_ASSERT(reporter, m1.removeS32("int"));
REPORTER_ASSERT(reporter, m1.removeScalar("scalar"));
diff --git a/tests/OpChainTest.cpp b/tests/OpChainTest.cpp
index 171b653..43617ed 100644
--- a/tests/OpChainTest.cpp
+++ b/tests/OpChainTest.cpp
@@ -27,7 +27,7 @@
static constexpr int kNumOpPositions = 4;
static constexpr Range kRanges[] = {{0, 4,}, {1, 2}};
-static constexpr int kNumRanges = (int)SK_ARRAY_COUNT(kRanges);
+static constexpr int kNumRanges = (int)std::size(kRanges);
static constexpr int kNumRepeats = 2;
static constexpr int kNumOps = kNumRepeats * kNumOpPositions * kNumRanges;
diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp
index 53b1015..f8d4cf6 100644
--- a/tests/PDFJpegEmbedTest.cpp
+++ b/tests/PDFJpegEmbedTest.cpp
@@ -118,7 +118,7 @@
{"images/grayscale.jpg", true, SkJFIFInfo::kGrayscale},
{"images/mandrill_512_q075.jpg", true, SkJFIFInfo::kYCbCr},
{"images/randPixels.jpg", true, SkJFIFInfo::kYCbCr}};
- for (size_t i = 0; i < SK_ARRAY_COUNT(kTests); ++i) {
+ for (size_t i = 0; i < std::size(kTests); ++i) {
sk_sp<SkData> data(load_resource(r, "JpegIdentification", kTests[i].path));
if (!data) {
continue;
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 1728241..3f68f48 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -97,7 +97,7 @@
};
#define FOR_SETUP(index, array, setter) \
- for (size_t index = 0; index < SK_ARRAY_COUNT(array); ++index) { \
+ for (size_t index = 0; index < std::size(array); ++index) { \
paint.setter(array[index]);
SkPaint paint;
diff --git a/tests/ParsePathTest.cpp b/tests/ParsePathTest.cpp
index 0192385..cdff300 100644
--- a/tests/ParsePathTest.cpp
+++ b/tests/ParsePathTest.cpp
@@ -42,7 +42,7 @@
};
DEF_TEST(ParsePath, reporter) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
+ for (size_t i = 0; i < std::size(gRec); i++) {
SkPath path;
bool success = SkParsePath::FromSVGString(gRec[i].fStr, &path);
REPORTER_ASSERT(reporter, success);
@@ -122,7 +122,7 @@
};
SkPath path;
- for (size_t i = 0; i < SK_ARRAY_COUNT(gTests); ++i) {
+ for (size_t i = 0; i < std::size(gTests); ++i) {
REPORTER_ASSERT(r, SkParsePath::FromSVGString(gTests[i].fStr, &path));
REPORTER_ASSERT(r, path.countVerbs() == gTests[i].fVerbs);
REPORTER_ASSERT(r, path.countPoints() == gTests[i].fPoints);
diff --git a/tests/PathBuilderTest.cpp b/tests/PathBuilderTest.cpp
index 40939fa..21d0baf 100644
--- a/tests/PathBuilderTest.cpp
+++ b/tests/PathBuilderTest.cpp
@@ -102,14 +102,14 @@
const SkPoint pts0[] = {
{0, 0}, {10, 10}, {20, 30},
};
- REPORTER_ASSERT(reporter, check_points(b.snapshot(), pts0, SK_ARRAY_COUNT(pts0)));
+ REPORTER_ASSERT(reporter, check_points(b.snapshot(), pts0, std::size(pts0)));
b.reset().moveTo(20, 20).lineTo(10, 10).lineTo(20, 30).close().lineTo(60, 60);
const SkPoint pts1[] = {
{20, 20}, {10, 10}, {20, 30},
{20, 20}, {60, 60},
};
- REPORTER_ASSERT(reporter, check_points(b.snapshot(), pts1, SK_ARRAY_COUNT(pts1)));
+ REPORTER_ASSERT(reporter, check_points(b.snapshot(), pts1, std::size(pts1)));
}
DEF_TEST(pathbuilder_addRect, reporter) {
@@ -281,7 +281,7 @@
};
for (bool isClosed : {false, true}) {
- for (size_t i = 0; i <= SK_ARRAY_COUNT(pts); ++i) {
+ for (size_t i = 0; i <= std::size(pts); ++i) {
auto path0 = SkPathBuilder().addPolygon(pts, i, isClosed).detach();
auto path1 = addpoly(pts, i, isClosed);
REPORTER_ASSERT(reporter, path0 == path1);
@@ -331,7 +331,7 @@
const SkPoint pts[] = {
{0, 1}, {2, 3}, {4, 5},
};
- constexpr int N = (int)SK_ARRAY_COUNT(pts);
+ constexpr int N = (int)std::size(pts);
for (int ctrCount = 1; ctrCount < 4; ++ctrCount) {
const int lastMoveToIndex = (ctrCount - 1) * N;
diff --git a/tests/PathCoverageTest.cpp b/tests/PathCoverageTest.cpp
index 877591e..9defb5c 100644
--- a/tests/PathCoverageTest.cpp
+++ b/tests/PathCoverageTest.cpp
@@ -148,11 +148,11 @@
static void TestQuadPointCount(skiatest::Reporter* reporter) {
- one_d_pe(gXY, SK_ARRAY_COUNT(gXY), reporter);
- one_d_pe(gSawtooth, SK_ARRAY_COUNT(gSawtooth), reporter);
- one_d_pe(gOvalish, SK_ARRAY_COUNT(gOvalish), reporter);
- one_d_pe(gSharpSawtooth, SK_ARRAY_COUNT(gSharpSawtooth), reporter);
- one_d_pe(gRibbon, SK_ARRAY_COUNT(gRibbon), reporter);
+ one_d_pe(gXY, std::size(gXY), reporter);
+ one_d_pe(gSawtooth, std::size(gSawtooth), reporter);
+ one_d_pe(gOvalish, std::size(gOvalish), reporter);
+ one_d_pe(gSharpSawtooth, std::size(gSharpSawtooth), reporter);
+ one_d_pe(gRibbon, std::size(gRibbon), reporter);
}
DEF_TEST(PathCoverage, reporter) {
diff --git a/tests/PathMeasureTest.cpp b/tests/PathMeasureTest.cpp
index 55be331..c3867b4 100644
--- a/tests/PathMeasureTest.cpp
+++ b/tests/PathMeasureTest.cpp
@@ -18,7 +18,7 @@
};
path.moveTo(pts[0]);
- for (size_t i = 1; i < SK_ARRAY_COUNT(pts); i += 3) {
+ for (size_t i = 1; i < std::size(pts); i += 3) {
path.cubicTo(pts[i], pts[i + 1], pts[i + 2]);
}
@@ -35,7 +35,7 @@
};
path.moveTo(pts[0]);
- for (size_t i = 1; i < SK_ARRAY_COUNT(pts); i += 2) {
+ for (size_t i = 1; i < std::size(pts); i += 2) {
path.quadTo(pts[i], pts[i + 1]);
}
SkPathMeasure meas(path, false);
@@ -53,7 +53,7 @@
};
path.moveTo(pts[0]);
- for (size_t i = 1; i < SK_ARRAY_COUNT(pts); ++i) {
+ for (size_t i = 1; i < std::size(pts); ++i) {
path.lineTo(pts[i]);
}
SkPathMeasure meas(path, false);
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index 0b3623c..1b0bc54 100644
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -267,7 +267,7 @@
{ bounds.fRight - quad[0].fX, bounds.fBottom - quad[0].fY }
};
double max = 0;
- for (unsigned index = 0; index < SK_ARRAY_COUNT(corner); ++index) {
+ for (unsigned index = 0; index < std::size(corner); ++index) {
max = std::max(max, corner[index].length());
}
return max;
@@ -481,7 +481,7 @@
double maxWidth = 0;
bool useIntersect = false;
double smallestTs[] = {1, 1};
- for (unsigned index = 0; index < SK_ARRAY_COUNT(quads); ++index) {
+ for (unsigned index = 0; index < std::size(quads); ++index) {
const SkDQuad& q = *quads[index];
midSpokes[index] = q.ptAtT(0.5) - origin;
minX = std::min(std::min(std::min(minX, origin.fX), q[1].fX), q[2].fX);
@@ -561,7 +561,7 @@
{{{939.4808349609375, 914.355224609375}, {-357.7921142578125, 590.842529296875}, {736.8936767578125, -350.717529296875}}},
{{{939.4808349609375, 914.355224609375}, {-182.85418701171875, 634.4552001953125}, {-509.62615966796875, 576.1182861328125}}}
};
- for (int index = 0; index < (int) SK_ARRAY_COUNT(quads); index += 2) {
+ for (int index = 0; index < (int) std::size(quads); index += 2) {
SkDQuad quad0, quad1;
quad0.debugSet(quads[index].fPts);
quad1.debugSet(quads[index + 1].fPts);
@@ -657,8 +657,8 @@
{{{598.857421875, 846.345458984375}, {715.7142333984375, 955.3599853515625}, {-919.9478759765625, 691.611328125}}},
};
TRange lowerRange, upperRange;
- SkDQuad quads[SK_ARRAY_COUNT(qPts)];
- for (int index = 0; index < (int) SK_ARRAY_COUNT(qPts); ++index) {
+ SkDQuad quads[std::size(qPts)];
+ for (int index = 0; index < (int) std::size(qPts); ++index) {
quads[index].debugSet(qPts[index].fPts);
}
bruteMinT(reporter, quads[0], quads[1], &lowerRange, &upperRange);
@@ -807,7 +807,7 @@
return;
}
double maxR = SK_ScalarMax;
- for (int index = 0; index < (int) SK_ARRAY_COUNT(extremeTests); ++index) {
+ for (int index = 0; index < (int) std::size(extremeTests); ++index) {
const QuadPts& qu1 = extremeTests[index][0];
const QuadPts& qu2 = extremeTests[index][1];
SkDQuad quad1, quad2;
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index 80a10f6..8c5cbfc 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -173,7 +173,7 @@
if (gDisableAngleTests) {
return;
}
- for (int index = 0; index < (int) SK_ARRAY_COUNT(slopTests); ++index) {
+ for (int index = 0; index < (int) std::size(slopTests); ++index) {
const double* slopTest = slopTests[index];
double x = slopTest[0];
double y = slopTest[1];
@@ -235,7 +235,7 @@
{320.05078125, 227.58743286132812}}}, 3, {} },
};
-static const int circleDataSetSize = (int) SK_ARRAY_COUNT(circleDataSet);
+static const int circleDataSetSize = (int) std::size(circleDataSet);
DEF_TEST(PathOpsAngleCircle, reporter) {
SkSTArenaAlloc<4096> allocator;
@@ -414,7 +414,7 @@
};
#undef I
-#define I(x) (int) SK_ARRAY_COUNT(intersectDataSet##x)
+#define I(x) (int) std::size(intersectDataSet##x)
static const int intersectDataSetSizes[] = {
I(1), I(2), I(3), I(4), I(5), I(6), I(7), I(8), I(9), I(10),
@@ -423,7 +423,7 @@
#undef I
-static const int intersectDataSetsSize = (int) SK_ARRAY_COUNT(intersectDataSetSizes);
+static const int intersectDataSetsSize = (int) std::size(intersectDataSetSizes);
struct FourPoints {
SkPoint pts[4];
diff --git a/tests/PathOpsAsWindingTest.cpp b/tests/PathOpsAsWindingTest.cpp
index f122678..addb70b 100644
--- a/tests/PathOpsAsWindingTest.cpp
+++ b/tests/PathOpsAsWindingTest.cpp
@@ -76,7 +76,7 @@
// if test has only one contour
test.reset();
SkPoint ell[] = {{0, 0}, {4, 0}, {4, 1}, {1, 1}, {1, 4}, {0, 4}};
- test.addPoly(ell, SK_ARRAY_COUNT(ell), true);
+ test.addPoly(ell, std::size(ell), true);
test.setFillType(SkPathFillType::kEvenOdd);
REPORTER_ASSERT(reporter, AsWinding(test, &result));
REPORTER_ASSERT(reporter, !result.isConvex());
@@ -91,7 +91,7 @@
REPORTER_ASSERT(reporter, test == result);
// test two contours that do not overlap but share bounds
test.reset();
- test.addPoly(ell, SK_ARRAY_COUNT(ell), true);
+ test.addPoly(ell, std::size(ell), true);
test.addRect({2, 2, 3, 3});
test.setFillType(SkPathFillType::kEvenOdd);
REPORTER_ASSERT(reporter, AsWinding(test, &result));
diff --git a/tests/PathOpsBattles.cpp b/tests/PathOpsBattles.cpp
index a3b76e6..3875128 100644
--- a/tests/PathOpsBattles.cpp
+++ b/tests/PathOpsBattles.cpp
@@ -11115,7 +11115,7 @@
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
diff --git a/tests/PathOpsBoundsTest.cpp b/tests/PathOpsBoundsTest.cpp
index aa64436..785a4c2 100644
--- a/tests/PathOpsBoundsTest.cpp
+++ b/tests/PathOpsBoundsTest.cpp
@@ -20,14 +20,14 @@
{{2, 0, 4, 1}, {4, 1, 5, 2}}, // touching just on a corner is OK
};
-static const size_t sectTestsCount = SK_ARRAY_COUNT(sectTests);
+static const size_t sectTestsCount = std::size(sectTests);
static const SkRect noSectTests[][2] = {
{{2, 0, 4, 1}, {5, 0, 6, 1}},
{{2, 0, 4, 1}, {3, 2, 5, 2}},
};
-static const size_t noSectTestsCount = SK_ARRAY_COUNT(noSectTests);
+static const size_t noSectTestsCount = std::size(noSectTests);
DEF_TEST(PathOpsBounds, reporter) {
for (size_t index = 0; index < sectTestsCount; ++index) {
diff --git a/tests/PathOpsBuildUseTest.cpp b/tests/PathOpsBuildUseTest.cpp
index 9128f85..feb36c5 100644
--- a/tests/PathOpsBuildUseTest.cpp
+++ b/tests/PathOpsBuildUseTest.cpp
@@ -2419,7 +2419,7 @@
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
diff --git a/tests/PathOpsChalkboardTest.cpp b/tests/PathOpsChalkboardTest.cpp
index 83cd02a..8f58713 100644
--- a/tests/PathOpsChalkboardTest.cpp
+++ b/tests/PathOpsChalkboardTest.cpp
@@ -178,7 +178,7 @@
TEST(chalkboard_threaded),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
DEF_TEST(PathOpsChalkboard, reporter) {
diff --git a/tests/PathOpsConicIntersectionTest.cpp b/tests/PathOpsConicIntersectionTest.cpp
index d8b9895..89b5528 100644
--- a/tests/PathOpsConicIntersectionTest.cpp
+++ b/tests/PathOpsConicIntersectionTest.cpp
@@ -42,7 +42,7 @@
};
-const int testSetCount = (int) SK_ARRAY_COUNT(testSet);
+const int testSetCount = (int) std::size(testSet);
static void chopCompare(const SkConic chopped[2], const SkDConic dChopped[2]) {
SkASSERT(roughly_equal(chopped[0].fW, dChopped[0].fWeight));
@@ -229,16 +229,16 @@
frame0, frame1, frame2, frame3, frame4, frame5, frame6
};
-const int frameSizes[] = { (int) SK_ARRAY_COUNT(frame0), (int) SK_ARRAY_COUNT(frame1),
- (int) SK_ARRAY_COUNT(frame2), (int) SK_ARRAY_COUNT(frame3),
- (int) SK_ARRAY_COUNT(frame4), (int) SK_ARRAY_COUNT(frame5),
- (int) SK_ARRAY_COUNT(frame6),
+const int frameSizes[] = { (int) std::size(frame0), (int) std::size(frame1),
+ (int) std::size(frame2), (int) std::size(frame3),
+ (int) std::size(frame4), (int) std::size(frame5),
+ (int) std::size(frame6),
};
static void writeFrames() {
const int scale = 5;
- for (int index = 0; index < (int) SK_ARRAY_COUNT(frameSizes); ++index) {
+ for (int index = 0; index < (int) std::size(frameSizes); ++index) {
SkDRect bounds;
bool boundsSet = false;
int frameSize = frameSizes[index];
diff --git a/tests/PathOpsConicLineIntersectionTest.cpp b/tests/PathOpsConicLineIntersectionTest.cpp
index 1106213..18749fc 100644
--- a/tests/PathOpsConicLineIntersectionTest.cpp
+++ b/tests/PathOpsConicLineIntersectionTest.cpp
@@ -29,7 +29,7 @@
},
};
-static size_t lineConicTests_count = SK_ARRAY_COUNT(lineConicTests);
+static size_t lineConicTests_count = std::size(lineConicTests);
static int doIntersect(SkIntersections& intersections, const SkDConic& conic, const SkDLine& line,
bool& flipped) {
@@ -68,7 +68,7 @@
{{{25.6499996,20.6499996}, {45.6500015,20.6499996}}}}
};
-static size_t oneOffs_count = SK_ARRAY_COUNT(oneOffs);
+static size_t oneOffs_count = std::size(oneOffs);
static void testOneOffs(skiatest::Reporter* reporter) {
bool flipped = false;
diff --git a/tests/PathOpsConicQuadIntersectionTest.cpp b/tests/PathOpsConicQuadIntersectionTest.cpp
index fd46f18..3515b5c 100644
--- a/tests/PathOpsConicQuadIntersectionTest.cpp
+++ b/tests/PathOpsConicQuadIntersectionTest.cpp
@@ -29,7 +29,7 @@
{{{494.355774f, 224.605927f}, {494.363708f, 224.631714f}, {494.370148f, 224.657471f}}}},
};
-static const int conicQuadTests_count = (int) SK_ARRAY_COUNT(conicQuadTests);
+static const int conicQuadTests_count = (int) std::size(conicQuadTests);
static void conicQuadIntersection(skiatest::Reporter* reporter, int index) {
const ConicPts& c = conicQuadTests[index].conic;
diff --git a/tests/PathOpsCubicConicIntersectionTest.cpp b/tests/PathOpsCubicConicIntersectionTest.cpp
index 9f8034f..d27d706 100644
--- a/tests/PathOpsCubicConicIntersectionTest.cpp
+++ b/tests/PathOpsCubicConicIntersectionTest.cpp
@@ -40,7 +40,7 @@
{231.80000305175781, 2084.800048828125}}}, 0.707107008f}},
};
-static const int cubicConicTests_count = (int) SK_ARRAY_COUNT(cubicConicTests);
+static const int cubicConicTests_count = (int) std::size(cubicConicTests);
static void cubicConicIntersection(skiatest::Reporter* reporter, int index) {
const CubicPts& cu = cubicConicTests[index].cubic;
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index cc06e2a..6e6f970 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -167,7 +167,7 @@
{56.4860195, 60.529264}}},
};
-const int testSetCount = (int) SK_ARRAY_COUNT(testSet);
+const int testSetCount = (int) std::size(testSet);
static const CubicPts newTestSet[] = {
@@ -386,7 +386,7 @@
{{{0, 3}, {0, 1}, {2, 0}, {1, 0}}},
};
-const int newTestSetCount = (int) SK_ARRAY_COUNT(newTestSet);
+const int newTestSetCount = (int) std::size(newTestSet);
static void oneOff(skiatest::Reporter* reporter, const CubicPts& cubic1, const CubicPts& cubic2,
bool coin) {
SkDCubic c1, c2;
@@ -637,7 +637,7 @@
{{{12.81, 7.27}, {7.22, 6.98}, {12.49, 8.97}, {11.42, 6.18}}},
};
-int selfSetCount = (int) SK_ARRAY_COUNT(selfSet);
+int selfSetCount = (int) std::size(selfSet);
static void selfOneOff(skiatest::Reporter* reporter, int setIdx) {
const CubicPts& cubic = selfSet[setIdx];
@@ -694,7 +694,7 @@
{324.71566772460937, 714.62060546875}, {325, 714.9990234375}}},
};
-static int coinSetCount = (int) SK_ARRAY_COUNT(coinSet);
+static int coinSetCount = (int) std::size(coinSet);
static void coinOneOff(skiatest::Reporter* reporter, int index) {
const CubicPts& cubic1 = coinSet[index];
diff --git a/tests/PathOpsCubicIntersectionTestData.cpp b/tests/PathOpsCubicIntersectionTestData.cpp
index 7641fd7..60e75f1 100644
--- a/tests/PathOpsCubicIntersectionTestData.cpp
+++ b/tests/PathOpsCubicIntersectionTestData.cpp
@@ -45,7 +45,7 @@
{{{1, 1}, {2, 2}, {2, 2+N}, {1, 1}}},
};
-const size_t pointDegenerates_count = SK_ARRAY_COUNT(pointDegenerates);
+const size_t pointDegenerates_count = std::size(pointDegenerates);
const CubicPts notPointDegenerates[] = {
{{{1 + FLT_EPSILON * 8, 1}, {1, FLT_EPSILON * 8}, {1, 1}, {1, 1}}},
@@ -53,7 +53,7 @@
};
const size_t notPointDegenerates_count =
- SK_ARRAY_COUNT(notPointDegenerates);
+ std::size(notPointDegenerates);
// from http://www.truetex.com/bezint.htm
const CubicPts tests[][2] = {
@@ -109,7 +109,7 @@
}
};
-const size_t tests_count = SK_ARRAY_COUNT(tests);
+const size_t tests_count = std::size(tests);
const CubicPts lines[] = {
{{{0, 0}, {0, 0}, {0, 0}, {1, 0}}}, // 0: horizontal
@@ -144,7 +144,7 @@
{{{2, 2}, {4, 4}, {3, 3}, {1, 1}}},
};
-const size_t lines_count = SK_ARRAY_COUNT(lines);
+const size_t lines_count = std::size(lines);
// 'not a line' tries to fool the line detection code
const CubicPts notLines[] = {
@@ -156,7 +156,7 @@
{{{0, 1}, {1, 0}, {0, 0}, {0, 0}}},
};
-const size_t notLines_count = SK_ARRAY_COUNT(notLines);
+const size_t notLines_count = std::size(notLines);
static const double E = FLT_EPSILON * 8;
static const double F = FLT_EPSILON * 8;
@@ -202,7 +202,7 @@
{{{2, 2}, {4, 4}, {3, 3}, {1, 1+E}}},
};
-const size_t modEpsilonLines_count = SK_ARRAY_COUNT(modEpsilonLines);
+const size_t modEpsilonLines_count = std::size(modEpsilonLines);
const CubicPts lessEpsilonLines[] = {
{{{0, D}, {0, 0}, {0, 0}, {1, 0}}}, // horizontal
@@ -238,7 +238,7 @@
{{{2, 2}, {4, 4}, {3, 3}, {1, 1+D}}},
};
-const size_t lessEpsilonLines_count = SK_ARRAY_COUNT(lessEpsilonLines);
+const size_t lessEpsilonLines_count = std::size(lessEpsilonLines);
const CubicPts negEpsilonLines[] = {
{{{0, N}, {0, 0}, {0, 0}, {1, 0}}}, // horizontal
@@ -274,6 +274,6 @@
{{{2, 2}, {4, 4}, {3, 3}, {1, 1+N}}},
};
-const size_t negEpsilonLines_count = SK_ARRAY_COUNT(negEpsilonLines);
+const size_t negEpsilonLines_count = std::size(negEpsilonLines);
} // namespace PathOpsCubicIntersectionTestData
diff --git a/tests/PathOpsCubicLineIntersectionIdeas.cpp b/tests/PathOpsCubicLineIntersectionIdeas.cpp
index 9b17f82..026a339 100644
--- a/tests/PathOpsCubicLineIntersectionIdeas.cpp
+++ b/tests/PathOpsCubicLineIntersectionIdeas.cpp
@@ -31,7 +31,7 @@
0.578826774, {-390.17910153915489, -687.21144412296007}},
};
-int cubicLineFailuresCount = (int) SK_ARRAY_COUNT(cubicLineFailures);
+int cubicLineFailuresCount = (int) std::size(cubicLineFailures);
double measuredSteps[] = {
9.15910731e-007, 8.6600277e-007, 7.4122059e-007, 6.92087618e-007, 8.35290245e-007,
@@ -240,7 +240,7 @@
}
SkDebugf("errors=%d avgIter=%1.9g", errors, (double) iters / errors);
SkDebugf(" steps: ");
- int worstLimit = SK_ARRAY_COUNT(worstStep);
+ int worstLimit = std::size(worstStep);
while (worstStep[--worstLimit] == 0) ;
for (int idx2 = 0; idx2 <= worstLimit; ++idx2) {
SkDebugf("%1.9g ", worstStep[idx2]);
diff --git a/tests/PathOpsCubicLineIntersectionTest.cpp b/tests/PathOpsCubicLineIntersectionTest.cpp
index ac13736..7b0e91f 100644
--- a/tests/PathOpsCubicLineIntersectionTest.cpp
+++ b/tests/PathOpsCubicLineIntersectionTest.cpp
@@ -24,7 +24,7 @@
{{{40.625,-5.7890625}, {37.7109375,1.3515625}}}},
};
-static const size_t failLineCubicTests_count = SK_ARRAY_COUNT(failLineCubicTests);
+static const size_t failLineCubicTests_count = std::size(failLineCubicTests);
static void testFail(skiatest::Reporter* reporter, int iIndex) {
const CubicPts& cuPts = failLineCubicTests[iIndex].cubic;
@@ -98,7 +98,7 @@
{{{{0, 0}, {0, 1}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}}},
};
-static const size_t lineCubicTests_count = SK_ARRAY_COUNT(lineCubicTests);
+static const size_t lineCubicTests_count = std::size(lineCubicTests);
static int doIntersect(SkIntersections& intersections, const SkDCubic& cubic, const SkDLine& line) {
int result;
diff --git a/tests/PathOpsCubicQuadIntersectionTest.cpp b/tests/PathOpsCubicQuadIntersectionTest.cpp
index 6f4b3db..51a194f 100644
--- a/tests/PathOpsCubicQuadIntersectionTest.cpp
+++ b/tests/PathOpsCubicQuadIntersectionTest.cpp
@@ -49,7 +49,7 @@
{{{12.342399597167969,228.3424072265625}, {10,230.68629455566406}, {10,234}}}},
};
-static const int quadCubicTests_count = (int) SK_ARRAY_COUNT(quadCubicTests);
+static const int quadCubicTests_count = (int) std::size(quadCubicTests);
static void cubicQuadIntersection(skiatest::Reporter* reporter, int index) {
int iIndex = static_cast<int>(index);
diff --git a/tests/PathOpsDCubicTest.cpp b/tests/PathOpsDCubicTest.cpp
index e41135e..acb33fe 100644
--- a/tests/PathOpsDCubicTest.cpp
+++ b/tests/PathOpsDCubicTest.cpp
@@ -12,7 +12,7 @@
{{{2.6250000819563866, 2.3750000223517418}, {2.833333432674408, 2.3333333432674408}, {3.1111112236976624, 2.3333333134651184}, {3.4074075222015381, 2.3333332538604736}}},
};
-static const size_t hullTests_count = SK_ARRAY_COUNT(hullTests);
+static const size_t hullTests_count = std::size(hullTests);
DEF_TEST(PathOpsCubicHull, reporter) {
for (size_t index = 0; index < hullTests_count; ++index) {
diff --git a/tests/PathOpsDLineTest.cpp b/tests/PathOpsDLineTest.cpp
index 3d04ff8..51175ab 100644
--- a/tests/PathOpsDLineTest.cpp
+++ b/tests/PathOpsDLineTest.cpp
@@ -17,7 +17,7 @@
{{{3, 2}, {1, 1}}},
};
-static const size_t tests_count = SK_ARRAY_COUNT(tests);
+static const size_t tests_count = std::size(tests);
DEF_TEST(PathOpsLineUtilities, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
diff --git a/tests/PathOpsDPointTest.cpp b/tests/PathOpsDPointTest.cpp
index 1b9a009..4750f15 100644
--- a/tests/PathOpsDPointTest.cpp
+++ b/tests/PathOpsDPointTest.cpp
@@ -18,7 +18,7 @@
{2, 2}
};
-static const size_t tests_count = SK_ARRAY_COUNT(tests);
+static const size_t tests_count = std::size(tests);
DEF_TEST(PathOpsDPoint, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
diff --git a/tests/PathOpsDRectTest.cpp b/tests/PathOpsDRectTest.cpp
index 72b7be0..289da24 100644
--- a/tests/PathOpsDRectTest.cpp
+++ b/tests/PathOpsDRectTest.cpp
@@ -25,8 +25,8 @@
{{{3, 0}, {2, 1}, {3, 2}, {1, 1}}},
};
-static const size_t quadTests_count = SK_ARRAY_COUNT(quadTests);
-static const size_t cubicTests_count = SK_ARRAY_COUNT(cubicTests);
+static const size_t quadTests_count = std::size(quadTests);
+static const size_t cubicTests_count = std::size(cubicTests);
static void setRawBounds(const SkDQuad& quad, SkDRect* rect) {
rect->set(quad[0]);
diff --git a/tests/PathOpsDVectorTest.cpp b/tests/PathOpsDVectorTest.cpp
index e588193..b675931 100644
--- a/tests/PathOpsDVectorTest.cpp
+++ b/tests/PathOpsDVectorTest.cpp
@@ -18,7 +18,7 @@
{2, 2}
};
-static const size_t tests_count = SK_ARRAY_COUNT(tests);
+static const size_t tests_count = std::size(tests);
DEF_TEST(PathOpsDVector, reporter) {
for (size_t index = 0; index < tests_count - 1; ++index) {
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index d88078f..b3fc02f 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -250,7 +250,7 @@
static void showPathOpPath(const char* testName, const SkPath& one, const SkPath& two,
const SkPath& a, const SkPath& b, const SkPath& scaledOne, const SkPath& scaledTwo,
const SkPathOp shapeOp, const SkMatrix& scale) {
- SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs));
+ SkASSERT((unsigned) shapeOp < std::size(opStrs));
if (!testName) {
testName = "xOp";
}
@@ -668,7 +668,7 @@
void PathOpsThreadState::outputProgress(const char* pathStr, SkPathOp op) {
const char testFunction[] = "testOp(path);";
- SkASSERT((size_t) op < SK_ARRAY_COUNT(opSuffixes));
+ SkASSERT((size_t) op < std::size(opSuffixes));
const char* nameSuffix = opSuffixes[op];
appendTest(pathStr, nullptr, nameSuffix, testFunction, true, fPathStr);
}
diff --git a/tests/PathOpsFuzz763Test.cpp b/tests/PathOpsFuzz763Test.cpp
index d3d2828..d4a436d 100644
--- a/tests/PathOpsFuzz763Test.cpp
+++ b/tests/PathOpsFuzz763Test.cpp
@@ -2432,7 +2432,7 @@
TEST(fuzz763_378a_1),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
diff --git a/tests/PathOpsIssue3651.cpp b/tests/PathOpsIssue3651.cpp
index 426e7e6..bb12a99 100644
--- a/tests/PathOpsIssue3651.cpp
+++ b/tests/PathOpsIssue3651.cpp
@@ -1674,7 +1674,7 @@
TEST(issue3651_3),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp
index 9134ba1..a49713f 100644
--- a/tests/PathOpsLineIntersectionTest.cpp
+++ b/tests/PathOpsLineIntersectionTest.cpp
@@ -41,7 +41,7 @@
{{{166.86960700313026, 112.6965477747386}, {166.86925794355412, 112.69656471103423}}}}
};
-static const size_t tests_count = SK_ARRAY_COUNT(tests);
+static const size_t tests_count = std::size(tests);
static const SkDLine noIntersect[][2] = {
{{{{(double) (2 - 1e-6f),2}, {(double) (2 - 1e-6f),4}}},
@@ -54,7 +54,7 @@
{{{{1, 1}, {2, 2}}}, {{{4, 4}, {3, 3}}}},
};
-static const size_t noIntersect_count = SK_ARRAY_COUNT(noIntersect);
+static const size_t noIntersect_count = std::size(noIntersect);
static const SkDLine coincidentTests[][2] = {
{{{ {-1.48383003e-006,-83}, {4.2268899e-014,-60} }},
@@ -82,7 +82,7 @@
{{{286.695129, 291.000000}, {229.304855, 561.000000}}}},
};
-static const size_t coincidentTests_count = SK_ARRAY_COUNT(coincidentTests);
+static const size_t coincidentTests_count = std::size(coincidentTests);
static void check_results(skiatest::Reporter* reporter, const SkDLine& line1, const SkDLine& line2,
const SkIntersections& ts, bool nearAllowed) {
diff --git a/tests/PathOpsLineParametetersTest.cpp b/tests/PathOpsLineParametetersTest.cpp
index 696de71..4a5c32f 100644
--- a/tests/PathOpsLineParametetersTest.cpp
+++ b/tests/PathOpsLineParametetersTest.cpp
@@ -35,7 +35,7 @@
{1.5894571940104115e-07, 7.9472859700520577e-08},
};
-static const size_t tests_count = SK_ARRAY_COUNT(tests);
+static const size_t tests_count = std::size(tests);
DEF_TEST(PathOpsLineParameters, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 9167fb4..cc41b71 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -9474,7 +9474,7 @@
TEST(cubicOp1d),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static struct TestDesc subTests[] = {
TEST(loops47i),
@@ -9483,7 +9483,7 @@
TEST(issue3517),
};
-static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
+static const size_t subTestCount = std::size(subTests);
static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = nullptr;
@@ -12523,7 +12523,7 @@
TEST(bufferOverflow),
};
-static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
+static const size_t failTestCount = std::size(failTests);
DEF_TEST(PathOpsFailOp, reporter) {
RunTestSet(reporter, failTests, failTestCount, nullptr, nullptr, nullptr, false);
@@ -12538,5 +12538,5 @@
return;
}
for (int index = 0; index < 1; ++index)
- RunTestSet(reporter, repTests, SK_ARRAY_COUNT(repTests), nullptr, nullptr, nullptr, false);
+ RunTestSet(reporter, repTests, std::size(repTests), nullptr, nullptr, nullptr, false);
}
diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp
index dc6113b..d62ac26 100644
--- a/tests/PathOpsQuadIntersectionTest.cpp
+++ b/tests/PathOpsQuadIntersectionTest.cpp
@@ -330,7 +330,7 @@
{{{8, 8}, {9, 9}, {10, 8}}}
};
-const size_t testSetCount = SK_ARRAY_COUNT(testSet);
+const size_t testSetCount = std::size(testSet);
static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner) {
const QuadPts& q1 = testSet[outer];
@@ -382,7 +382,7 @@
{{{8, -10}, {10, 10}, {8, 8}}},
};
-static const int coincidentTestSetCount = (int) SK_ARRAY_COUNT(coincidentTestSet);
+static const int coincidentTestSetCount = (int) std::size(coincidentTestSet);
static void coincidentTestOne(skiatest::Reporter* reporter, int test1, int test2) {
const QuadPts& q1 = coincidentTestSet[test1];
diff --git a/tests/PathOpsQuadIntersectionTestData.cpp b/tests/PathOpsQuadIntersectionTestData.cpp
index 13b7677..9ea4f5c 100644
--- a/tests/PathOpsQuadIntersectionTestData.cpp
+++ b/tests/PathOpsQuadIntersectionTestData.cpp
@@ -14,7 +14,7 @@
{{{1, 1}, {2, 2}, {1, 1}}},
};
-const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints);
+const size_t quadraticPoints_count = std::size(quadraticPoints);
const QuadPts quadraticLines[] = {
{{{0, 0}, {0, 0}, {1, 0}}},
@@ -42,7 +42,7 @@
{{{2, 2}, {4, 4}, {3, 3}}},
};
-const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines);
+const size_t quadraticLines_count = std::size(quadraticLines);
static const double F = FLT_EPSILON * 32;
static const double H = FLT_EPSILON * 32;
@@ -80,7 +80,7 @@
};
const size_t quadraticModEpsilonLines_count =
- SK_ARRAY_COUNT(quadraticModEpsilonLines);
+ std::size(quadraticModEpsilonLines);
const QuadPts quadraticTests[][2] = {
{ // one intersection
@@ -101,4 +101,4 @@
}
};
-const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests);
+const size_t quadraticTests_count = std::size(quadraticTests);
diff --git a/tests/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp
index d80cc38..6e1e86b 100644
--- a/tests/PathOpsQuadLineIntersectionTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionTest.cpp
@@ -28,7 +28,7 @@
{{{{0, 0}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}}, 1, {{.25, .75}, {0, 0}} },
};
-static size_t lineQuadTests_count = SK_ARRAY_COUNT(lineQuadTests);
+static size_t lineQuadTests_count = std::size(lineQuadTests);
static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, const SkDLine& line,
bool& flipped) {
@@ -78,7 +78,7 @@
{{{406.207703, 121.298294}, {348.781738, 123.864815}}}},
};
-static size_t oneOffs_count = SK_ARRAY_COUNT(oneOffs);
+static size_t oneOffs_count = std::size(oneOffs);
static void testOneOffs(skiatest::Reporter* reporter) {
bool flipped = false;
diff --git a/tests/PathOpsQuadReduceOrderTest.cpp b/tests/PathOpsQuadReduceOrderTest.cpp
index 0f0e334..7bd4ef9 100644
--- a/tests/PathOpsQuadReduceOrderTest.cpp
+++ b/tests/PathOpsQuadReduceOrderTest.cpp
@@ -15,7 +15,7 @@
{{{1, 0}, {2, 6}, {3, 0}}}
};
-static const size_t testSetCount = SK_ARRAY_COUNT(testSet);
+static const size_t testSetCount = std::size(testSet);
static void oneOffTest(skiatest::Reporter* reporter) {
for (size_t index = 0; index < testSetCount; ++index) {
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index 9d8e6b6..abcd566 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -9830,14 +9830,14 @@
TEST(testLine1),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static TestDesc subTests[] = {
TEST(fuzz994s_3414),
TEST(fuzz994s_11),
};
-static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
+static const size_t subTestCount = std::size(subTests);
static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = nullptr;
diff --git a/tests/PathOpsSkpTest.cpp b/tests/PathOpsSkpTest.cpp
index de86883..191e03a 100644
--- a/tests/PathOpsSkpTest.cpp
+++ b/tests/PathOpsSkpTest.cpp
@@ -4761,7 +4761,7 @@
TEST(skpeverytechpro_blogspot_com100),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
diff --git a/tests/PathOpsThreeWayTest.cpp b/tests/PathOpsThreeWayTest.cpp
index 0a4127b..af9ac88 100644
--- a/tests/PathOpsThreeWayTest.cpp
+++ b/tests/PathOpsThreeWayTest.cpp
@@ -33,11 +33,11 @@
const Curve* tests;
int testCount;
} testSets[] = {
- { testSet0, (int) SK_ARRAY_COUNT(testSet0) },
- { testSet1, (int) SK_ARRAY_COUNT(testSet1) },
+ { testSet0, (int) std::size(testSet0) },
+ { testSet1, (int) std::size(testSet1) },
};
-static const int testSetsCount = (int) SK_ARRAY_COUNT(testSets);
+static const int testSetsCount = (int) std::size(testSets);
static void testSetTest(skiatest::Reporter* reporter, int index) {
const TestSet& testSet = testSets[index];
diff --git a/tests/PathOpsTigerTest.cpp b/tests/PathOpsTigerTest.cpp
index afcac8b..b598120 100644
--- a/tests/PathOpsTigerTest.cpp
+++ b/tests/PathOpsTigerTest.cpp
@@ -335,7 +335,7 @@
TEST(tiger_threaded),
};
-static const size_t testCount = SK_ARRAY_COUNT(tests);
+static const size_t testCount = std::size(tests);
static bool runReverse = false;
DEF_TEST(PathOpsTiger, reporter) {
diff --git a/tests/PathOpsTypesTest.cpp b/tests/PathOpsTypesTest.cpp
index e513c95..cb502e1 100644
--- a/tests/PathOpsTypesTest.cpp
+++ b/tests/PathOpsTypesTest.cpp
@@ -11,7 +11,7 @@
{5.0402503619650929e-005, 4.3178054475078825e-005}
};
-static const size_t roughlyTestsCount = SK_ARRAY_COUNT(roughlyTests);
+static const size_t roughlyTestsCount = std::size(roughlyTests);
DEF_TEST(PathOpsRoughly, reporter) {
for (size_t index = 0; index < roughlyTestsCount; ++index) {
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 4926210..29cf9a1 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -311,7 +311,7 @@
SkRegion clip;
clip.setRect({0, 0, 1255, 1925});
- for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
+ for (size_t i = 0; i < std::size(procs); ++i) {
SkPath path;
procs[i](&path);
@@ -1030,13 +1030,13 @@
SkPoint pts[32];
SkRandom rand;
- for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
+ for (size_t i = 0; i < std::size(pts); ++i) {
pts[i].fX = rand.nextSScalar1();
pts[i].fY = rand.nextSScalar1();
}
for (int doClose = 0; doClose <= 1; ++doClose) {
- for (size_t count = 1; count <= SK_ARRAY_COUNT(pts); ++count) {
+ for (size_t count = 1; count <= std::size(pts); ++count) {
SkPath path;
path.addPoly(pts, SkToInt(count), SkToBool(doClose));
test_poly(reporter, path, pts, SkToBool(doClose));
@@ -1097,7 +1097,7 @@
"M 10 10 Q 10 10 10 10",
"M 10 10 C 10 10 10 10 10 10",
};
- for (i = 0; i < SK_ARRAY_COUNT(gDegen); ++i) {
+ for (i = 0; i < std::size(gDegen); ++i) {
path.reset();
bool valid = SkParsePath::FromSVGString(gDegen[i], &path);
REPORTER_ASSERT(reporter, valid);
@@ -1114,7 +1114,7 @@
"M 10 10 C 10 0 10 0 20 0 L 40 0 C 50 0 50 0 50 10",
"M 20 10 L 0 10 Q 10 10 20 0", // left, degenerate serif
};
- for (i = 0; i < SK_ARRAY_COUNT(gCW); ++i) {
+ for (i = 0; i < std::size(gCW); ++i) {
path.reset();
bool valid = SkParsePath::FromSVGString(gCW[i], &path);
REPORTER_ASSERT(reporter, valid);
@@ -1130,7 +1130,7 @@
"M 50 10 C 50 0 50 0 40 0 L 20 0 C 10 0 10 0 10 10",
"M 10 10 L 30 10 Q 20 10 10 0", // right, degenerate serif
};
- for (i = 0; i < SK_ARRAY_COUNT(gCCW); ++i) {
+ for (i = 0; i < std::size(gCCW); ++i) {
path.reset();
bool valid = SkParsePath::FromSVGString(gCCW[i], &path);
REPORTER_ASSERT(reporter, valid);
@@ -1187,7 +1187,7 @@
};
SkPath path0, path1;
- for (size_t i = 0; i < SK_ARRAY_COUNT(rects); ++i) {
+ for (size_t i = 0; i < std::size(rects); ++i) {
path0.addRect(rects[i]);
add_rect(&path1, rects[i]);
}
@@ -1610,7 +1610,7 @@
{ "0 0 10 0 0 10 -10 -10", false, SkPathFirstDirection::kCW },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
+ for (size_t i = 0; i < std::size(gRec); ++i) {
path.reset();
setFromString(&path, gRec[i].fPathStr);
check_convexity(reporter, path, gRec[i].fExpectedIsConvex);
@@ -1894,7 +1894,7 @@
};
for (int inv = 0; inv < 4; ++inv) {
- for (size_t q = 0; q < SK_ARRAY_COUNT(kQueries); ++q) {
+ for (size_t q = 0; q < std::size(kQueries); ++q) {
SkRect qRect = kQueries[q].fQueryRect;
if (inv & 0x1) {
using std::swap;
@@ -2096,44 +2096,44 @@
bool fClose;
bool fIsRect;
} tests[] = {
- { r1, SK_ARRAY_COUNT(r1), true, true },
- { r2, SK_ARRAY_COUNT(r2), true, true },
- { r3, SK_ARRAY_COUNT(r3), true, true },
- { r4, SK_ARRAY_COUNT(r4), true, true },
- { r5, SK_ARRAY_COUNT(r5), true, true },
- { r6, SK_ARRAY_COUNT(r6), true, true },
- { r7, SK_ARRAY_COUNT(r7), true, true },
- { r8, SK_ARRAY_COUNT(r8), true, true },
- { r9, SK_ARRAY_COUNT(r9), true, true },
- { ra, SK_ARRAY_COUNT(ra), true, true },
- { rb, SK_ARRAY_COUNT(rb), true, true },
- { rc, SK_ARRAY_COUNT(rc), true, true },
- { rd, SK_ARRAY_COUNT(rd), true, true },
- { re, SK_ARRAY_COUNT(re), true, true },
- { rf, SK_ARRAY_COUNT(rf), true, true },
+ { r1, std::size(r1), true, true },
+ { r2, std::size(r2), true, true },
+ { r3, std::size(r3), true, true },
+ { r4, std::size(r4), true, true },
+ { r5, std::size(r5), true, true },
+ { r6, std::size(r6), true, true },
+ { r7, std::size(r7), true, true },
+ { r8, std::size(r8), true, true },
+ { r9, std::size(r9), true, true },
+ { ra, std::size(ra), true, true },
+ { rb, std::size(rb), true, true },
+ { rc, std::size(rc), true, true },
+ { rd, std::size(rd), true, true },
+ { re, std::size(re), true, true },
+ { rf, std::size(rf), true, true },
- { f1, SK_ARRAY_COUNT(f1), true, false },
- { f2, SK_ARRAY_COUNT(f2), true, false },
- { f3, SK_ARRAY_COUNT(f3), true, false },
- { f4, SK_ARRAY_COUNT(f4), true, false },
- { f5, SK_ARRAY_COUNT(f5), true, false },
- { f6, SK_ARRAY_COUNT(f6), true, false },
- { f7, SK_ARRAY_COUNT(f7), true, false },
- { f8, SK_ARRAY_COUNT(f8), true, false },
- { f9, SK_ARRAY_COUNT(f9), true, false },
- { fa, SK_ARRAY_COUNT(fa), true, false },
- { fb, SK_ARRAY_COUNT(fb), true, false },
+ { f1, std::size(f1), true, false },
+ { f2, std::size(f2), true, false },
+ { f3, std::size(f3), true, false },
+ { f4, std::size(f4), true, false },
+ { f5, std::size(f5), true, false },
+ { f6, std::size(f6), true, false },
+ { f7, std::size(f7), true, false },
+ { f8, std::size(f8), true, false },
+ { f9, std::size(f9), true, false },
+ { fa, std::size(fa), true, false },
+ { fb, std::size(fb), true, false },
- { c1, SK_ARRAY_COUNT(c1), false, true },
- { c2, SK_ARRAY_COUNT(c2), false, true },
- { c3, SK_ARRAY_COUNT(c3), false, true },
+ { c1, std::size(c1), false, true },
+ { c2, std::size(c2), false, true },
+ { c3, std::size(c3), false, true },
- { d1, SK_ARRAY_COUNT(d1), false, false },
- { d2, SK_ARRAY_COUNT(d2), false, true },
- { d3, SK_ARRAY_COUNT(d3), false, false },
+ { d1, std::size(d1), false, false },
+ { d2, std::size(d2), false, true },
+ { d3, std::size(d3), false, false },
};
- const size_t testCount = SK_ARRAY_COUNT(tests);
+ const size_t testCount = std::size(tests);
int index;
for (size_t testIndex = 0; testIndex < testCount; ++testIndex) {
SkPath path;
@@ -2177,7 +2177,7 @@
// fail, close then line
SkPath path1;
path1.moveTo(r1[0].fX, r1[0].fY);
- for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
path1.lineTo(r1[index].fX, r1[index].fY);
}
path1.close();
@@ -2187,7 +2187,7 @@
// fail, move in the middle
path1.reset();
path1.moveTo(r1[0].fX, r1[0].fY);
- for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
if (index == 2) {
path1.moveTo(1, .5f);
}
@@ -2198,7 +2198,7 @@
// fail, move on the edge
path1.reset();
- for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
path1.moveTo(r1[index - 1].fX, r1[index - 1].fY);
path1.lineTo(r1[index].fX, r1[index].fY);
}
@@ -2208,7 +2208,7 @@
// fail, quad
path1.reset();
path1.moveTo(r1[0].fX, r1[0].fY);
- for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
if (index == 2) {
path1.quadTo(1, .5f, 1, .5f);
}
@@ -2220,7 +2220,7 @@
// fail, cubic
path1.reset();
path1.moveTo(r1[0].fX, r1[0].fY);
- for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
if (index == 2) {
path1.cubicTo(1, .5f, 1, .5f, 1, .5f);
}
@@ -2410,35 +2410,35 @@
bool fClose;
bool fIsNestedRect; // nests with path.addRect(-1, -1, 2, 2);
} tests[] = {
- { r1, SK_ARRAY_COUNT(r1), SkPathFirstDirection::kCW , true, true },
- { r2, SK_ARRAY_COUNT(r2), SkPathFirstDirection::kCW , true, true },
- { r3, SK_ARRAY_COUNT(r3), SkPathFirstDirection::kCW , true, true },
- { r4, SK_ARRAY_COUNT(r4), SkPathFirstDirection::kCW , true, true },
- { r5, SK_ARRAY_COUNT(r5), SkPathFirstDirection::kCCW, true, true },
- { r6, SK_ARRAY_COUNT(r6), SkPathFirstDirection::kCCW, true, true },
- { r7, SK_ARRAY_COUNT(r7), SkPathFirstDirection::kCCW, true, true },
- { r8, SK_ARRAY_COUNT(r8), SkPathFirstDirection::kCCW, true, true },
- { r9, SK_ARRAY_COUNT(r9), SkPathFirstDirection::kCCW, true, true },
- { ra, SK_ARRAY_COUNT(ra), SkPathFirstDirection::kCCW, true, true },
- { rb, SK_ARRAY_COUNT(rb), SkPathFirstDirection::kCW, true, true },
- { rc, SK_ARRAY_COUNT(rc), SkPathFirstDirection::kCW, true, true },
- { rd, SK_ARRAY_COUNT(rd), SkPathFirstDirection::kCCW, true, true },
- { re, SK_ARRAY_COUNT(re), SkPathFirstDirection::kCW, true, true },
+ { r1, std::size(r1), SkPathFirstDirection::kCW , true, true },
+ { r2, std::size(r2), SkPathFirstDirection::kCW , true, true },
+ { r3, std::size(r3), SkPathFirstDirection::kCW , true, true },
+ { r4, std::size(r4), SkPathFirstDirection::kCW , true, true },
+ { r5, std::size(r5), SkPathFirstDirection::kCCW, true, true },
+ { r6, std::size(r6), SkPathFirstDirection::kCCW, true, true },
+ { r7, std::size(r7), SkPathFirstDirection::kCCW, true, true },
+ { r8, std::size(r8), SkPathFirstDirection::kCCW, true, true },
+ { r9, std::size(r9), SkPathFirstDirection::kCCW, true, true },
+ { ra, std::size(ra), SkPathFirstDirection::kCCW, true, true },
+ { rb, std::size(rb), SkPathFirstDirection::kCW, true, true },
+ { rc, std::size(rc), SkPathFirstDirection::kCW, true, true },
+ { rd, std::size(rd), SkPathFirstDirection::kCCW, true, true },
+ { re, std::size(re), SkPathFirstDirection::kCW, true, true },
- { f1, SK_ARRAY_COUNT(f1), SkPathFirstDirection::kUnknown, true, false },
- { f2, SK_ARRAY_COUNT(f2), SkPathFirstDirection::kUnknown, true, false },
- { f3, SK_ARRAY_COUNT(f3), SkPathFirstDirection::kUnknown, true, false },
- { f4, SK_ARRAY_COUNT(f4), SkPathFirstDirection::kUnknown, true, false },
- { f5, SK_ARRAY_COUNT(f5), SkPathFirstDirection::kUnknown, true, false },
- { f6, SK_ARRAY_COUNT(f6), SkPathFirstDirection::kUnknown, true, false },
- { f7, SK_ARRAY_COUNT(f7), SkPathFirstDirection::kUnknown, true, false },
- { f8, SK_ARRAY_COUNT(f8), SkPathFirstDirection::kUnknown, true, false },
+ { f1, std::size(f1), SkPathFirstDirection::kUnknown, true, false },
+ { f2, std::size(f2), SkPathFirstDirection::kUnknown, true, false },
+ { f3, std::size(f3), SkPathFirstDirection::kUnknown, true, false },
+ { f4, std::size(f4), SkPathFirstDirection::kUnknown, true, false },
+ { f5, std::size(f5), SkPathFirstDirection::kUnknown, true, false },
+ { f6, std::size(f6), SkPathFirstDirection::kUnknown, true, false },
+ { f7, std::size(f7), SkPathFirstDirection::kUnknown, true, false },
+ { f8, std::size(f8), SkPathFirstDirection::kUnknown, true, false },
- { c1, SK_ARRAY_COUNT(c1), SkPathFirstDirection::kCW, false, true },
- { c2, SK_ARRAY_COUNT(c2), SkPathFirstDirection::kCW, false, true },
+ { c1, std::size(c1), SkPathFirstDirection::kCW, false, true },
+ { c2, std::size(c2), SkPathFirstDirection::kCW, false, true },
};
- const size_t testCount = SK_ARRAY_COUNT(tests);
+ const size_t testCount = std::size(tests);
int index;
for (int rectFirst = 0; rectFirst <= 1; ++rectFirst) {
for (size_t testIndex = 0; testIndex < testCount; ++testIndex) {
@@ -2486,7 +2486,7 @@
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) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
path1.lineTo(r1[index].fX, r1[index].fY);
}
path1.close();
@@ -2502,7 +2502,7 @@
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) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
if (index == 2) {
path1.moveTo(1, .5f);
}
@@ -2519,7 +2519,7 @@
if (rectFirst) {
path1.addRect(-1, -1, 2, 2, SkPathDirection::kCW);
}
- for (index = 1; index < SkToInt(SK_ARRAY_COUNT(r1)); ++index) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
path1.moveTo(r1[index - 1].fX, r1[index - 1].fY);
path1.lineTo(r1[index].fX, r1[index].fY);
}
@@ -2535,7 +2535,7 @@
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) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
if (index == 2) {
path1.quadTo(1, .5f, 1, .5f);
}
@@ -2553,7 +2553,7 @@
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) {
+ for (index = 1; index < SkToInt(std::size(r1)); ++index) {
if (index == 2) {
path1.cubicTo(1, .5f, 1, .5f, 1, .5f);
}
@@ -2700,7 +2700,7 @@
{ 0, 0 }, { SkIntToScalar(20), SkIntToScalar(10) }, // conic
#endif
};
- const int kPtCount = SK_ARRAY_COUNT(pts);
+ const int kPtCount = std::size(pts);
p.moveTo(pts[0]);
p.lineTo(pts[1]);
@@ -2843,36 +2843,36 @@
SkPath::kMove_Verb, SkPath::kCubic_Verb, SkPath::kClose_Verb, SkPath::kMove_Verb, SkPath::kCubic_Verb, SkPath::kClose_Verb
};
static const struct zeroPathTestData gZeroLengthTests[] = {
- { "M 1 1", 1, {1, 1, 1, 1}, resultVerbs1, SK_ARRAY_COUNT(resultVerbs1) },
- { "M 1 1 M 2 1", 2, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs2, SK_ARRAY_COUNT(resultVerbs2) },
- { "M 1 1 z", 1, {1, 1, 1, 1}, resultVerbs3, SK_ARRAY_COUNT(resultVerbs3) },
- { "M 1 1 z M 2 1 z", 2, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs4, SK_ARRAY_COUNT(resultVerbs4) },
- { "M 1 1 L 1 1", 2, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs5, SK_ARRAY_COUNT(resultVerbs5) },
- { "M 1 1 L 1 1 M 2 1 L 2 1", 4, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs6, SK_ARRAY_COUNT(resultVerbs6) },
- { "M 1 1 L 1 1 z", 2, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs7, SK_ARRAY_COUNT(resultVerbs7) },
- { "M 1 1 L 1 1 z M 2 1 L 2 1 z", 4, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs8, SK_ARRAY_COUNT(resultVerbs8) },
- { "M 1 1 Q 1 1 1 1", 3, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs9, SK_ARRAY_COUNT(resultVerbs9) },
- { "M 1 1 Q 1 1 1 1 M 2 1 Q 2 1 2 1", 6, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs10, SK_ARRAY_COUNT(resultVerbs10) },
- { "M 1 1 Q 1 1 1 1 z", 3, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs11, SK_ARRAY_COUNT(resultVerbs11) },
- { "M 1 1 Q 1 1 1 1 z M 2 1 Q 2 1 2 1 z", 6, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs12, SK_ARRAY_COUNT(resultVerbs12) },
- { "M 1 1 C 1 1 1 1 1 1", 4, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs13, SK_ARRAY_COUNT(resultVerbs13) },
+ { "M 1 1", 1, {1, 1, 1, 1}, resultVerbs1, std::size(resultVerbs1) },
+ { "M 1 1 M 2 1", 2, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs2, std::size(resultVerbs2) },
+ { "M 1 1 z", 1, {1, 1, 1, 1}, resultVerbs3, std::size(resultVerbs3) },
+ { "M 1 1 z M 2 1 z", 2, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs4, std::size(resultVerbs4) },
+ { "M 1 1 L 1 1", 2, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs5, std::size(resultVerbs5) },
+ { "M 1 1 L 1 1 M 2 1 L 2 1", 4, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs6, std::size(resultVerbs6) },
+ { "M 1 1 L 1 1 z", 2, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs7, std::size(resultVerbs7) },
+ { "M 1 1 L 1 1 z M 2 1 L 2 1 z", 4, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs8, std::size(resultVerbs8) },
+ { "M 1 1 Q 1 1 1 1", 3, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs9, std::size(resultVerbs9) },
+ { "M 1 1 Q 1 1 1 1 M 2 1 Q 2 1 2 1", 6, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs10, std::size(resultVerbs10) },
+ { "M 1 1 Q 1 1 1 1 z", 3, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs11, std::size(resultVerbs11) },
+ { "M 1 1 Q 1 1 1 1 z M 2 1 Q 2 1 2 1 z", 6, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs12, std::size(resultVerbs12) },
+ { "M 1 1 C 1 1 1 1 1 1", 4, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs13, std::size(resultVerbs13) },
{ "M 1 1 C 1 1 1 1 1 1 M 2 1 C 2 1 2 1 2 1", 8, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs14,
- SK_ARRAY_COUNT(resultVerbs14)
+ std::size(resultVerbs14)
},
- { "M 1 1 C 1 1 1 1 1 1 z", 4, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs15, SK_ARRAY_COUNT(resultVerbs15) },
+ { "M 1 1 C 1 1 1 1 1 1 z", 4, {SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1}, resultVerbs15, std::size(resultVerbs15) },
{ "M 1 1 C 1 1 1 1 1 1 z M 2 1 C 2 1 2 1 2 1 z", 8, {SK_Scalar1, SK_Scalar1, 2*SK_Scalar1, SK_Scalar1}, resultVerbs16,
- SK_ARRAY_COUNT(resultVerbs16)
+ std::size(resultVerbs16)
}
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gZeroLengthTests); ++i) {
+ for (size_t i = 0; i < std::size(gZeroLengthTests); ++i) {
p.reset();
bool valid = SkParsePath::FromSVGString(gZeroLengthTests[i].testPath, &p);
REPORTER_ASSERT(reporter, valid);
REPORTER_ASSERT(reporter, !p.isEmpty());
REPORTER_ASSERT(reporter, gZeroLengthTests[i].numResultPts == (size_t)p.countPoints());
REPORTER_ASSERT(reporter, gZeroLengthTests[i].resultBound == p.getBounds());
- REPORTER_ASSERT(reporter, gZeroLengthTests[i].numResultVerbs == (size_t)p.getVerbs(verbs, SK_ARRAY_COUNT(verbs)));
+ REPORTER_ASSERT(reporter, gZeroLengthTests[i].numResultVerbs == (size_t)p.getVerbs(verbs, std::size(verbs)));
for (size_t j = 0; j < gZeroLengthTests[i].numResultVerbs; ++j) {
REPORTER_ASSERT(reporter, gZeroLengthTests[i].resultVerbs[j] == verbs[j]);
}
@@ -2963,14 +2963,14 @@
{ SK_Scalar1, 0 }, { SK_Scalar1, 0 }, { SK_Scalar1, 0 }, { SK_Scalar1, 0 }, { 0, 0 }, { 0, 0 }
};
static const struct iterTestData gIterTests[] = {
- { "M 1 0", false, resultPtsSizes1, resultPts1, resultVerbs1, SK_ARRAY_COUNT(resultVerbs1) },
- { "z", false, resultPtsSizes1, resultPts1, resultVerbs1, SK_ARRAY_COUNT(resultVerbs1) },
- { "z", true, resultPtsSizes1, resultPts1, resultVerbs1, SK_ARRAY_COUNT(resultVerbs1) },
- { "M 1 0 L 1 0 M 0 0 z", false, resultPtsSizes2, resultPts2, resultVerbs2, SK_ARRAY_COUNT(resultVerbs2) },
- { "M 1 0 L 1 0 M 0 0 z", true, resultPtsSizes3, resultPts3, resultVerbs3, SK_ARRAY_COUNT(resultVerbs3) }
+ { "M 1 0", false, resultPtsSizes1, resultPts1, resultVerbs1, std::size(resultVerbs1) },
+ { "z", false, resultPtsSizes1, resultPts1, resultVerbs1, std::size(resultVerbs1) },
+ { "z", true, resultPtsSizes1, resultPts1, resultVerbs1, std::size(resultVerbs1) },
+ { "M 1 0 L 1 0 M 0 0 z", false, resultPtsSizes2, resultPts2, resultVerbs2, std::size(resultVerbs2) },
+ { "M 1 0 L 1 0 M 0 0 z", true, resultPtsSizes3, resultPts3, resultVerbs3, std::size(resultVerbs3) }
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gIterTests); ++i) {
+ for (size_t i = 0; i < std::size(gIterTests); ++i) {
p.reset();
bool valid = SkParsePath::FromSVGString(gIterTests[i].testPath, &p);
REPORTER_ASSERT(reporter, valid);
@@ -3655,7 +3655,7 @@
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) {
+ for (size_t i = 0; i < std::size(radii); ++i) {
SkVector save = radii[i];
radii[i].set(0, 0);
rr.setRectRadii(r, radii);
@@ -4185,14 +4185,14 @@
p.reset();
const SkPoint qPts[] = {{6, 6}, {8, 8}, {6, 8}, {4, 8}, {4, 6}, {4, 4}, {6, 6}};
p.moveTo(qPts[0]);
- for (int index = 1; index < (int) SK_ARRAY_COUNT(qPts); index += 2) {
+ for (int index = 1; index < (int) std::size(qPts); index += 2) {
p.quadTo(qPts[index], qPts[index + 1]);
}
REPORTER_ASSERT(reporter, p.contains(5, 6));
REPORTER_ASSERT(reporter, !p.contains(6, 5));
// test quad edge
SkPoint halfway;
- for (int index = 0; index < (int) SK_ARRAY_COUNT(qPts) - 2; index += 2) {
+ for (int index = 0; index < (int) std::size(qPts) - 2; index += 2) {
SkEvalQuadAt(&qPts[index], 0.5f, &halfway, nullptr);
REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
}
@@ -4201,13 +4201,13 @@
p.reset();
const SkPoint kPts[] = {{4, 4}, {6, 6}, {8, 8}, {6, 8}, {4, 8}, {4, 6}, {4, 4}};
p.moveTo(kPts[0]);
- for (int index = 1; index < (int) SK_ARRAY_COUNT(kPts); index += 2) {
+ for (int index = 1; index < (int) std::size(kPts); index += 2) {
p.conicTo(kPts[index], kPts[index + 1], 0.5f);
}
REPORTER_ASSERT(reporter, p.contains(5, 6));
REPORTER_ASSERT(reporter, !p.contains(6, 5));
// test conic edge
- for (int index = 0; index < (int) SK_ARRAY_COUNT(kPts) - 2; index += 2) {
+ for (int index = 0; index < (int) std::size(kPts) - 2; index += 2) {
SkConic conic(&kPts[index], 0.5f);
halfway = conic.evalAt(0.5f);
REPORTER_ASSERT(reporter, p.contains(halfway.fX, halfway.fY));
@@ -5261,28 +5261,28 @@
// isolated from skbug.com/7792 (bug description)
SkRect rect;
SkPoint points[] = { {10, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150} };
- SkPath path = makePath(points, SK_ARRAY_COUNT(points), false);
+ SkPath path = makePath(points, std::size(points), false);
REPORTER_ASSERT(reporter, path.isRect(&rect));
SkRect compare;
- compare.setBounds(&points[1], SK_ARRAY_COUNT(points) - 1);
+ compare.setBounds(&points[1], std::size(points) - 1);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c3
SkPoint points3[] = { {75, 50}, {100, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 50} };
- path = makePath(points3, SK_ARRAY_COUNT(points3), true);
+ path = makePath(points3, std::size(points3), true);
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from skbug.com/7792#c9
SkPoint points9[] = { {10, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150} };
- path = makePath(points9, SK_ARRAY_COUNT(points9), true);
+ path = makePath(points9, std::size(points9), true);
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.setBounds(&points9[1], SK_ARRAY_COUNT(points9) - 1);
+ compare.setBounds(&points9[1], std::size(points9) - 1);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c11
SkPath::Verb verbs11[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb, SkPath::kLine_Verb, SkPath::kMove_Verb };
SkPoint points11[] = { {75, 150}, {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 150} };
- path = makePath2(points11, verbs11, SK_ARRAY_COUNT(verbs11));
+ path = makePath2(points11, verbs11, std::size(verbs11));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.setBounds(&points11[0], SK_ARRAY_COUNT(points11));
+ compare.setBounds(&points11[0], std::size(points11));
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c14
SkPath::Verb verbs14[] = { SkPath::kMove_Verb, SkPath::kMove_Verb, SkPath::kMove_Verb,
@@ -5291,19 +5291,19 @@
SkPath::kLine_Verb, SkPath::kClose_Verb };
SkPoint points14[] = { {250, 75}, {250, 75}, {250, 75}, {100, 75},
{150, 75}, {150, 150}, {75, 150}, {75, 75}, {0, 0} };
- path = makePath2(points14, verbs14, SK_ARRAY_COUNT(verbs14));
+ path = makePath2(points14, verbs14, std::size(verbs14));
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from skbug.com/7792#c15
SkPath::Verb verbs15[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb, SkPath::kMove_Verb };
SkPoint points15[] = { {75, 75}, {150, 75}, {150, 150}, {75, 150}, {250, 75} };
- path = makePath2(points15, verbs15, SK_ARRAY_COUNT(verbs15));
+ path = makePath2(points15, verbs15, std::size(verbs15));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.setBounds(&points15[0], SK_ARRAY_COUNT(points15) - 1);
+ compare.setBounds(&points15[0], std::size(points15) - 1);
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c17
SkPoint points17[] = { {75, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 10} };
- path = makePath(points17, SK_ARRAY_COUNT(points17), true);
+ path = makePath(points17, std::size(points17), true);
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from skbug.com/7792#c19
SkPath::Verb verbs19[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5312,7 +5312,7 @@
SkPath::kLine_Verb, SkPath::kLine_Verb };
SkPoint points19[] = { {75, 75}, {75, 75}, {75, 75}, {75, 75}, {150, 75}, {150, 150},
{75, 150}, {10, 10}, {30, 10}, {10, 30} };
- path = makePath2(points19, verbs19, SK_ARRAY_COUNT(verbs19));
+ path = makePath2(points19, verbs19, std::size(verbs19));
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from skbug.com/7792#c23
SkPath::Verb verbs23[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kMove_Verb,
@@ -5320,23 +5320,23 @@
SkPath::kLine_Verb, SkPath::kClose_Verb };
SkPoint points23[] = { {75, 75}, {75, 75}, {75, 75}, {75, 75}, {150, 75}, {150, 150},
{75, 150} };
- path = makePath2(points23, verbs23, SK_ARRAY_COUNT(verbs23));
+ path = makePath2(points23, verbs23, std::size(verbs23));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.setBounds(&points23[0], SK_ARRAY_COUNT(points23));
+ compare.setBounds(&points23[0], std::size(points23));
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c29
SkPath::Verb verbs29[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb, SkPath::kLine_Verb, SkPath::kMove_Verb,
SkPath::kClose_Verb };
SkPoint points29[] = { {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 250}, {75, 75} };
- path = makePath2(points29, verbs29, SK_ARRAY_COUNT(verbs29));
+ path = makePath2(points29, verbs29, std::size(verbs29));
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from skbug.com/7792#c31
SkPath::Verb verbs31[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb, SkPath::kLine_Verb, SkPath::kMove_Verb,
SkPath::kClose_Verb };
SkPoint points31[] = { {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 10}, {75, 75} };
- path = makePath2(points31, verbs31, SK_ARRAY_COUNT(verbs31));
+ path = makePath2(points31, verbs31, std::size(verbs31));
REPORTER_ASSERT(reporter, path.isRect(&rect));
compare.setBounds(&points31[0], 4);
REPORTER_ASSERT(reporter, rect == compare);
@@ -5344,13 +5344,13 @@
SkPath::Verb verbs36[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb, SkPath::kMove_Verb, SkPath::kLine_Verb };
SkPoint points36[] = { {75, 75}, {150, 75}, {150, 150}, {10, 150}, {75, 75}, {75, 75} };
- path = makePath2(points36, verbs36, SK_ARRAY_COUNT(verbs36));
+ path = makePath2(points36, verbs36, std::size(verbs36));
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from skbug.com/7792#c39
SkPath::Verb verbs39[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb };
SkPoint points39[] = { {150, 75}, {150, 150}, {75, 150}, {75, 100} };
- path = makePath2(points39, verbs39, SK_ARRAY_COUNT(verbs39));
+ path = makePath2(points39, verbs39, std::size(verbs39));
REPORTER_ASSERT(reporter, !path.isRect(&rect));
// isolated from zero_length_paths_aa
SkPath::Verb verbsAA[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
@@ -5358,16 +5358,16 @@
SkPath::kLine_Verb, SkPath::kClose_Verb };
SkPoint pointsAA[] = { {32, 9.5f}, {32, 9.5f}, {32, 17}, {17, 17}, {17, 9.5f}, {17, 2},
{32, 2} };
- path = makePath2(pointsAA, verbsAA, SK_ARRAY_COUNT(verbsAA));
+ path = makePath2(pointsAA, verbsAA, std::size(verbsAA));
REPORTER_ASSERT(reporter, path.isRect(&rect));
- compare.setBounds(&pointsAA[0], SK_ARRAY_COUNT(pointsAA));
+ compare.setBounds(&pointsAA[0], std::size(pointsAA));
REPORTER_ASSERT(reporter, rect == compare);
// isolated from skbug.com/7792#c41
SkPath::Verb verbs41[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
SkPath::kLine_Verb, SkPath::kLine_Verb, SkPath::kMove_Verb,
SkPath::kClose_Verb };
SkPoint points41[] = { {75, 75}, {150, 75}, {150, 150}, {140, 150}, {140, 75}, {75, 75} };
- path = makePath2(points41, verbs41, SK_ARRAY_COUNT(verbs41));
+ path = makePath2(points41, verbs41, std::size(verbs41));
REPORTER_ASSERT(reporter, path.isRect(&rect));
compare.setBounds(&points41[1], 4);
REPORTER_ASSERT(reporter, rect == compare);
@@ -5376,7 +5376,7 @@
SkPath::kLine_Verb, SkPath::kLine_Verb, SkPath::kMove_Verb,
SkPath::kClose_Verb };
SkPoint points53[] = { {75, 75}, {150, 75}, {150, 150}, {140, 150}, {140, 75}, {75, 75} };
- path = makePath2(points53, verbs53, SK_ARRAY_COUNT(verbs53));
+ path = makePath2(points53, verbs53, std::size(verbs53));
REPORTER_ASSERT(reporter, path.isRect(&rect));
compare.setBounds(&points53[1], 4);
REPORTER_ASSERT(reporter, rect == compare);
diff --git a/tests/Point3Test.cpp b/tests/Point3Test.cpp
index 9a20a04..bb87078 100644
--- a/tests/Point3Test.cpp
+++ b/tests/Point3Test.cpp
@@ -136,7 +136,7 @@
{ 3.4e38f, 0.0f, 0.0f, 3.4e38f } // overflows
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
+ for (size_t i = 0; i < std::size(gRec); ++i) {
test_length(reporter, gRec[i].fX, gRec[i].fY, gRec[i].fZ, gRec[i].fLength);
test_normalize(reporter, gRec[i].fX, gRec[i].fY, gRec[i].fZ, gRec[i].fLength);
}
diff --git a/tests/PointTest.cpp b/tests/PointTest.cpp
index ea01ad0..6e015a8 100644
--- a/tests/PointTest.cpp
+++ b/tests/PointTest.cpp
@@ -133,7 +133,7 @@
{ 0.6f, 0.8f, SK_Scalar1 },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) {
+ for (size_t i = 0; i < std::size(gRec); ++i) {
test_length(reporter, gRec[i].fX, gRec[i].fY, gRec[i].fLength);
}
@@ -147,7 +147,7 @@
const float tests[] = { 1.0f, 0.0f, 1.0e-37f, 3.4e38f, 42.0f, 0.00012f };
const SkPoint kOne = {1.0f, 1.0f};
- for (unsigned i = 0; i < SK_ARRAY_COUNT(tests); i++) {
+ for (unsigned i = 0; i < std::size(tests); i++) {
SkPoint slow = kOne, fast = kOne;
slow.setLength(tests[i]);
diff --git a/tests/PolyUtilsTest.cpp b/tests/PolyUtilsTest.cpp
index 09d0fcb..89459ef 100644
--- a/tests/PolyUtilsTest.cpp
+++ b/tests/PolyUtilsTest.cpp
@@ -421,7 +421,7 @@
};
DEF_TEST(IsPolyConvex_experimental, r) {
- #define PTSET(array) {array, SK_ARRAY_COUNT(array)}
+ #define PTSET(array) {array, std::size(array)}
const SkPoint g0[] = { {0, 0}, {10, 0}, {10, 10}, {0, 10} };
const PtSet convex[] = { PTSET(g0) };
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index 26df12c..bbda949 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -62,7 +62,7 @@
}
static void test_premul_alpha_roundtrip(skiatest::Reporter* reporter, SkSurface* surf) {
- for (size_t upmaIdx = 0; upmaIdx < SK_ARRAY_COUNT(gUnpremul); ++upmaIdx) {
+ for (size_t upmaIdx = 0; upmaIdx < std::size(gUnpremul); ++upmaIdx) {
fill_surface(surf, gUnpremul[upmaIdx].fColorType, gUnpremul[upmaIdx].fPackProc);
const SkImageInfo info = SkImageInfo::Make(256, 256, gUnpremul[upmaIdx].fColorType,
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 18a343c..29d8c38 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -331,7 +331,7 @@
// it's called. Call `reroll` to get a different FP.
SkRandom random{fRandomSeed};
GrProcessorTestData testData{&random, fContext, randomTreeDepth,
- SK_ARRAY_COUNT(fTestViews), fTestViews,
+ static_cast<int>(std::size(fTestViews)), fTestViews,
std::move(inputFP)};
return GrFragmentProcessorTestFactory::MakeIdx(type, &testData);
}
diff --git a/tests/ProgramsTest.cpp b/tests/ProgramsTest.cpp
index b6760be..94180e4 100644
--- a/tests/ProgramsTest.cpp
+++ b/tests/ProgramsTest.cpp
@@ -289,7 +289,7 @@
}
GrPaint paint;
- GrProcessorTestData ptd(&random, direct, /*maxTreeDepth=*/1, SK_ARRAY_COUNT(views), views);
+ GrProcessorTestData ptd(&random, direct, /*maxTreeDepth=*/1, std::size(views), views);
set_random_color_coverage_stages(&paint, &ptd, maxStages, maxLevels);
set_random_xpf(&paint, &ptd);
GrDrawRandomOp(&random, surfaceDrawContext.get(), std::move(paint));
@@ -312,7 +312,7 @@
for (int i = 0; i < fpFactoryCnt; ++i) {
// Since FP factories internally randomize, call each 10 times.
for (int j = 0; j < 10; ++j) {
- GrProcessorTestData ptd(&random, direct, /*maxTreeDepth=*/1, SK_ARRAY_COUNT(views),
+ GrProcessorTestData ptd(&random, direct, /*maxTreeDepth=*/1, std::size(views),
views);
GrPaint paint;
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index e818a75..b9ccf72 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -328,10 +328,10 @@
const SkImageInfo& surfaceInfo) {
SkCanvas* canvas = surface->getCanvas();
fill_src_canvas(canvas);
- for (size_t rect = 0; rect < SK_ARRAY_COUNT(gReadPixelsTestRects); ++rect) {
+ for (size_t rect = 0; rect < std::size(gReadPixelsTestRects); ++rect) {
const SkIRect& srcRect = gReadPixelsTestRects[rect];
for (auto tightRB : {TightRowBytes::kYes, TightRowBytes::kNo}) {
- for (size_t c = 0; c < SK_ARRAY_COUNT(gReadPixelsConfigs); ++c) {
+ for (size_t c = 0; c < std::size(gReadPixelsConfigs); ++c) {
SkBitmap bmp;
init_bitmap(&bmp, srcRect, tightRB, gReadPixelsConfigs[c].fColorType,
gReadPixelsConfigs[c].fAlphaType);
diff --git a/tests/RecordOptsTest.cpp b/tests/RecordOptsTest.cpp
index 21366bb..7633a38 100644
--- a/tests/RecordOptsTest.cpp
+++ b/tests/RecordOptsTest.cpp
@@ -258,10 +258,10 @@
for (auto outerF : filters) {
bool outerNoOped = !outerF;
for (auto innerF : filters) {
- for (size_t i = 0; i < SK_ARRAY_COUNT(firstBounds); ++ i) {
- for (size_t j = 0; j < SK_ARRAY_COUNT(firstPaints); ++j) {
- for (size_t k = 0; k < SK_ARRAY_COUNT(secondBounds); ++k) {
- for (size_t m = 0; m < SK_ARRAY_COUNT(secondPaints); ++m) {
+ for (size_t i = 0; i < std::size(firstBounds); ++ i) {
+ for (size_t j = 0; j < std::size(firstPaints); ++j) {
+ for (size_t k = 0; k < std::size(secondBounds); ++k) {
+ for (size_t m = 0; m < std::size(secondPaints); ++m) {
bool innerNoOped = !secondBounds[k] && !secondPaints[m] && !innerF;
recorder.saveLayer({firstBounds[i], firstPaints[j], outerF, 0});
@@ -305,7 +305,7 @@
{ &alphaOnlyLayerPaint, &colorFilterPaint }
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(noChangeTests); ++i) {
+ for (size_t i = 0; i < std::size(noChangeTests); ++i) {
recorder.saveLayer(nullptr, noChangeTests[i].firstPaint);
recorder.save();
recorder.clipRect(clip);
diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp
index dda6dcb..94bddca 100644
--- a/tests/RegionTest.cpp
+++ b/tests/RegionTest.cpp
@@ -237,7 +237,7 @@
{ 0, 0, 1, 1 },
{ 2, 2, 3, 3 },
};
- REPORTER_ASSERT(reporter, test_rects(r2, SK_ARRAY_COUNT(r2)));
+ REPORTER_ASSERT(reporter, test_rects(r2, std::size(r2)));
const SkIRect rects[] = {
{ 0, 0, 1, 2 },
@@ -245,7 +245,7 @@
{ 4, 0, 5, 1 },
{ 6, 0, 7, 4 },
};
- REPORTER_ASSERT(reporter, test_rects(rects, SK_ARRAY_COUNT(rects)));
+ REPORTER_ASSERT(reporter, test_rects(rects, std::size(rects)));
SkRandom rand;
for (int i = 0; i < 1000; i++) {
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index e978272..f872c7a 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -238,7 +238,7 @@
kDontShare},
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(overlappingTests); i++) {
+ for (size_t i = 0; i < std::size(overlappingTests); i++) {
const TestCase& test = overlappingTests[i];
sk_sp<GrSurfaceProxy> p1 = make_proxy(dContext, test.fP1);
sk_sp<GrSurfaceProxy> p2 = make_proxy(dContext, test.fP2);
@@ -307,7 +307,7 @@
kDontShare}
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(nonOverlappingTests); i++) {
+ for (size_t i = 0; i < std::size(nonOverlappingTests); i++) {
const TestCase& test = nonOverlappingTests[i];
sk_sp<GrSurfaceProxy> p1 = make_proxy(dContext, test.fP1);
sk_sp<GrSurfaceProxy> p2 = make_proxy(dContext, test.fP2);
@@ -496,7 +496,7 @@
}},
};
SkString match("");
- for (size_t i = 0; i < SK_ARRAY_COUNT(tests); i++) {
+ for (size_t i = 0; i < std::size(tests); i++) {
TestCase& test = tests[i];
if (match.isEmpty() || match == SkString(test.fName)) {
// Create proxies
diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp
index 54740f4..0e8508c 100644
--- a/tests/RoundRectTest.cpp
+++ b/tests/RoundRectTest.cpp
@@ -71,7 +71,7 @@
SkRRect r;
- for (size_t i = 0; i < SK_ARRAY_COUNT(oooRects); ++i) {
+ for (size_t i = 0; i < std::size(oooRects); ++i) {
r.setRect(oooRects[i]);
REPORTER_ASSERT(reporter, !r.isEmpty());
REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
@@ -93,7 +93,7 @@
REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
}
- for (size_t i = 0; i < SK_ARRAY_COUNT(emptyRects); ++i) {
+ for (size_t i = 0; i < std::size(emptyRects); ++i) {
r.setRect(emptyRects[i]);
REPORTER_ASSERT(reporter, r.isEmpty());
REPORTER_ASSERT(reporter, r.rect() == emptyRects[i]);
@@ -428,7 +428,7 @@
};
for (int i = 0; i < kNumRRects; ++i) {
- for (size_t j = 0; j < SK_ARRAY_COUNT(easyOuts); ++j) {
+ for (size_t j = 0; j < std::size(easyOuts); ++j) {
REPORTER_ASSERT(reporter, !rrects[i].contains(easyOuts[j]));
}
}
diff --git a/tests/SVGDeviceTest.cpp b/tests/SVGDeviceTest.cpp
index 0463ee6..3d11bd5 100644
--- a/tests/SVGDeviceTest.cpp
+++ b/tests/SVGDeviceTest.cpp
@@ -173,7 +173,7 @@
{ "\t\t \t ab \t\t \t cd \t\t \t ", "ab cd " },
};
- for (unsigned i = 0; i < SK_ARRAY_COUNT(tests); ++i) {
+ for (unsigned i = 0; i < std::size(tests); ++i) {
test_whitespace_pos(reporter, tests[i].tst_in, tests[i].tst_out);
}
}
@@ -409,7 +409,7 @@
// We also use paths in the presence of path effects.
SkScalar intervals[] = {10, 5};
- paint.setPathEffect(SkDashPathEffect::Make(intervals, SK_ARRAY_COUNT(intervals), 0));
+ paint.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
check_text(0, /*expect_path=*/true);
}
diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp
index ceac1e3..dea4548 100644
--- a/tests/ScalarTest.cpp
+++ b/tests/ScalarTest.cpp
@@ -57,16 +57,16 @@
int fCount;
bool fIsFinite;
} gSets[] = {
- { gF0, SK_ARRAY_COUNT(gF0), true },
- { gF1, SK_ARRAY_COUNT(gF1), true },
+ { gF0, std::size(gF0), true },
+ { gF1, std::size(gF1), true },
- { gI0, SK_ARRAY_COUNT(gI0), false },
- { gI1, SK_ARRAY_COUNT(gI1), false },
- { gI2, SK_ARRAY_COUNT(gI2), false },
- { gI3, SK_ARRAY_COUNT(gI3), false },
+ { gI0, std::size(gI0), false },
+ { gI1, std::size(gI1), false },
+ { gI2, std::size(gI2), false },
+ { gI3, std::size(gI3), false },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gSets); ++i) {
+ for (size_t i = 0; i < std::size(gSets); ++i) {
SkRect r;
r.setBounds(gSets[i].fPts, gSets[i].fCount);
bool rectIsFinite = !r.isEmpty();
@@ -165,10 +165,10 @@
isFinite2_mulzeroadd
};
- size_t i, n = SK_ARRAY_COUNT(data);
+ size_t i, n = std::size(data);
for (i = 0; i < n; ++i) {
- for (size_t k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
+ for (size_t k = 0; k < std::size(gProc1); ++k) {
const Rec& rec = data[i];
bool finite = gProc1[k](rec.fValue);
REPORTER_ASSERT(reporter, rec.fIsFinite == finite);
@@ -179,10 +179,10 @@
const Rec& rec0 = data[i];
for (size_t j = 0; j < n; ++j) {
const Rec& rec1 = data[j];
- for (size_t k = 0; k < SK_ARRAY_COUNT(gProc1); ++k) {
+ for (size_t k = 0; k < std::size(gProc1); ++k) {
IsFiniteProc1 proc1 = gProc1[k];
- for (size_t m = 0; m < SK_ARRAY_COUNT(gProc2); ++m) {
+ for (size_t m = 0; m < std::size(gProc2); ++m) {
bool finite = gProc2[m](rec0.fValue, rec1.fValue, proc1);
bool finite2 = rec0.fIsFinite && rec1.fIsFinite;
REPORTER_ASSERT(reporter, finite2 == finite);
diff --git a/tests/ScaleToSidesTest.cpp b/tests/ScaleToSidesTest.cpp
index 5e2c1ee..375c39c 100644
--- a/tests/ScaleToSidesTest.cpp
+++ b/tests/ScaleToSidesTest.cpp
@@ -44,7 +44,7 @@
170141244307698042686698575557637963776.0,
};
- int numInterestingValues = (int)SK_ARRAY_COUNT(interestingValues);
+ int numInterestingValues = (int)std::size(interestingValues);
for (int s = 0; s <= numInterestingValues; s++) {
for (int i = 0; i < numInterestingValues; i++) {
diff --git a/tests/SerialProcsTest.cpp b/tests/SerialProcsTest.cpp
index 6ed9260..2d6540c 100644
--- a/tests/SerialProcsTest.cpp
+++ b/tests/SerialProcsTest.cpp
@@ -66,7 +66,7 @@
SkDeserialProcs dproc;
dproc.fImageCtx = &state;
- for (size_t i = 0; i < SK_ARRAY_COUNT(sprocs); ++i) {
+ for (size_t i = 0; i < std::size(sprocs); ++i) {
sproc.fImageProc = sprocs[i];
auto data = pic->serialize(&sproc);
REPORTER_ASSERT(reporter, data);
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 7c69db7..19c3c12 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -405,7 +405,7 @@
{ SkSetFourByteTag('w','g','h','t'), SK_ScalarSqrt2 },
};
SkFontArguments params;
- params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
+ params.setVariationDesignPosition({position, std::size(position)});
sk_sp<SkFontMgr> fm = SkFontMgr::RefDefault();
@@ -802,7 +802,7 @@
sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
- TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
+ TestAnnotationCanvas canvas(reporter, recs, std::size(recs));
canvas.drawPicture(pict1);
}
diff --git a/tests/ShaderImageFilterTest.cpp b/tests/ShaderImageFilterTest.cpp
index ee08d06..d413239 100644
--- a/tests/ShaderImageFilterTest.cpp
+++ b/tests/ShaderImageFilterTest.cpp
@@ -37,7 +37,7 @@
SkScalar radius = SkIntToScalar(5);
sk_sp<SkShader> gradient = SkGradientShader::MakeRadial(
- center, radius, colors, pos, SK_ARRAY_COUNT(colors), SkTileMode::kClamp);
+ center, radius, colors, pos, std::size(colors), SkTileMode::kClamp);
// Test using the image filter
{
@@ -85,7 +85,7 @@
SkScalar radius = SkIntToScalar(5);
sk_sp<SkShader> gradient = SkGradientShader::MakeRadial(
- center, radius, colors, pos, SK_ARRAY_COUNT(colors), SkTileMode::kClamp);
+ center, radius, colors, pos, std::size(colors), SkTileMode::kClamp);
// Test using the image filter
{
diff --git a/tests/SkRemoteGlyphCacheTest.cpp b/tests/SkRemoteGlyphCacheTest.cpp
index 139cf01..0cc00db 100644
--- a/tests/SkRemoteGlyphCacheTest.cpp
+++ b/tests/SkRemoteGlyphCacheTest.cpp
@@ -727,13 +727,13 @@
SkTextBlobBuilder builder;
SkRect bounds = SkRect::MakeIWH(100, 100);
- const auto& runBuffer = builder.allocRunPosH(font, SK_ARRAY_COUNT(glyphs), 100, &bounds);
+ const auto& runBuffer = builder.allocRunPosH(font, std::size(glyphs), 100, &bounds);
SkASSERT(runBuffer.utf8text == nullptr);
SkASSERT(runBuffer.clusters == nullptr);
std::copy(std::begin(glyphs), std::end(glyphs), runBuffer.glyphs);
- for (size_t i = 0; i < SK_ARRAY_COUNT(glyphs); i++) {
+ for (size_t i = 0; i < std::size(glyphs); i++) {
runBuffer.pos[i] = i * 100;
}
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 4f51a81..abcabc5 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -187,7 +187,7 @@
SkMatrix::Scale(1.7f, 0.5f),
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(xforms); ++i) {
+ for (size_t i = 0; i < std::size(xforms); ++i) {
test_discarded_image(reporter, xforms[i], []() {
auto surface(SkSurface::MakeRasterN32Premul(10, 10));
surface->getCanvas()->clear(SK_ColorCYAN);
diff --git a/tests/SkUTFTest.cpp b/tests/SkUTFTest.cpp
index 5caba4b..ac25001 100644
--- a/tests/SkUTFTest.cpp
+++ b/tests/SkUTFTest.cpp
@@ -16,7 +16,7 @@
size_t count2 = SkUTF::CountUTF16(buf, sizeof(buf));
REPORTER_ASSERT(reporter, count2 == 1);
const uint16_t* ptr = buf;
- SkUnichar c = SkUTF::NextUTF16(&ptr, buf + SK_ARRAY_COUNT(buf));
+ SkUnichar c = SkUTF::NextUTF16(&ptr, buf + std::size(buf));
REPORTER_ASSERT(reporter, c == uni);
REPORTER_ASSERT(reporter, ptr - buf == 2);
}
diff --git a/tests/SkVMDebugTraceTest.cpp b/tests/SkVMDebugTraceTest.cpp
index 3943f10..fffbb9c 100644
--- a/tests/SkVMDebugTraceTest.cpp
+++ b/tests/SkVMDebugTraceTest.cpp
@@ -169,8 +169,8 @@
"[2][0]", "[2][1]", "[2][2]", "[2][3]",
"[3][0]", "[3][1]", "[3][2]", "[3][3]"};
- REPORTER_ASSERT(r, i.fSlotInfo.size() == SK_ARRAY_COUNT(kExpected));
- for (size_t index = 0; index < SK_ARRAY_COUNT(kExpected); ++index) {
+ REPORTER_ASSERT(r, i.fSlotInfo.size() == std::size(kExpected));
+ for (size_t index = 0; index < std::size(kExpected); ++index) {
REPORTER_ASSERT(r, kExpected[index] == i.getSlotComponentSuffix(index));
}
}
diff --git a/tests/SkVMTest.cpp b/tests/SkVMTest.cpp
index 4829226..0a9d6a7 100644
--- a/tests/SkVMTest.cpp
+++ b/tests/SkVMTest.cpp
@@ -91,11 +91,11 @@
int src[] = {1,2,3,4,5,6,7,8,9},
dst[] = {0,0,0,0,0,0,0,0,0};
- p.eval(SK_ARRAY_COUNT(src)-1, src, dst);
- for (size_t i = 0; i < SK_ARRAY_COUNT(src)-1; i++) {
+ p.eval(std::size(src)-1, src, dst);
+ for (size_t i = 0; i < std::size(src)-1; i++) {
REPORTER_ASSERT(r, dst[i] == src[i]);
}
- size_t i = SK_ARRAY_COUNT(src)-1;
+ size_t i = std::size(src)-1;
REPORTER_ASSERT(r, dst[i] == 0);
});
}
@@ -125,8 +125,8 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int buf[64];
- for (int N = 0; N <= (int)SK_ARRAY_COUNT(buf); N++) {
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ for (int N = 0; N <= (int)std::size(buf); N++) {
+ for (int i = 0; i < (int)std::size(buf); i++) {
buf[i] = i;
}
program.eval(N, buf);
@@ -134,7 +134,7 @@
for (int i = 0; i < N; i++) {
REPORTER_ASSERT(r, buf[i] == i+1);
}
- for (int i = N; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ for (int i = N; i < (int)std::size(buf); i++) {
REPORTER_ASSERT(r, buf[i] == i);
}
}
@@ -345,10 +345,10 @@
// ±NaN, ±0, ±1, ±inf
uint32_t src[] = {0x7f80'0001, 0xff80'0001, 0x0000'0000, 0x8000'0000,
0x3f80'0000, 0xbf80'0000, 0x7f80'0000, 0xff80'0000};
- uint32_t dst[SK_ARRAY_COUNT(src)];
- program.eval(SK_ARRAY_COUNT(src), src, dst);
+ uint32_t dst[std::size(src)];
+ program.eval(std::size(src), src, dst);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(src); i++) {
+ for (int i = 0; i < (int)std::size(src); i++) {
REPORTER_ASSERT(r, dst[i] == (i < 2 ? 0 : src[i]));
}
});
@@ -368,7 +368,7 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
float buf[] = { 1,2,3,4,5,6,7,8,9 };
- program.eval(SK_ARRAY_COUNT(buf), buf);
+ program.eval(std::size(buf), buf);
for (float v : buf) {
REPORTER_ASSERT(r, v == 1.0f);
}
@@ -396,16 +396,16 @@
}
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int in[] = { 0,1,2,3,4,5,6,7,8,9 };
- int out[SK_ARRAY_COUNT(in)];
+ int out[std::size(in)];
- program.eval(SK_ARRAY_COUNT(in), in, out);
+ program.eval(std::size(in), in, out);
REPORTER_ASSERT(r, out[0] == 0b001111);
REPORTER_ASSERT(r, out[1] == 0b001100);
REPORTER_ASSERT(r, out[2] == 0b001010);
REPORTER_ASSERT(r, out[3] == 0b001010);
REPORTER_ASSERT(r, out[4] == 0b000010);
- for (int i = 5; i < (int)SK_ARRAY_COUNT(out); i++) {
+ for (int i = 5; i < (int)std::size(out); i++) {
REPORTER_ASSERT(r, out[i] == 0b110010);
}
});
@@ -433,16 +433,16 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
float in[] = { 0,1,2,3,4,5,6,7,8,9 };
- int out[SK_ARRAY_COUNT(in)];
+ int out[std::size(in)];
- program.eval(SK_ARRAY_COUNT(in), in, out);
+ program.eval(std::size(in), in, out);
REPORTER_ASSERT(r, out[0] == 0b001111);
REPORTER_ASSERT(r, out[1] == 0b001100);
REPORTER_ASSERT(r, out[2] == 0b001010);
REPORTER_ASSERT(r, out[3] == 0b001010);
REPORTER_ASSERT(r, out[4] == 0b000010);
- for (int i = 5; i < (int)SK_ARRAY_COUNT(out); i++) {
+ for (int i = 5; i < (int)std::size(out); i++) {
REPORTER_ASSERT(r, out[i] == 0b110010);
}
});
@@ -454,9 +454,9 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int buf[23];
- program.eval(SK_ARRAY_COUNT(buf), buf);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
- REPORTER_ASSERT(r, buf[i] == (int)SK_ARRAY_COUNT(buf)-i);
+ program.eval(std::size(buf), buf);
+ for (int i = 0; i < (int)std::size(buf); i++) {
+ REPORTER_ASSERT(r, buf[i] == (int)std::size(buf)-i);
}
});
}
@@ -503,9 +503,9 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int buf[] = {0,1,2,3,4,5,6,7,8,9,10};
- program.eval((int)SK_ARRAY_COUNT(buf), &buf);
+ program.eval((int)std::size(buf), &buf);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ for (int i = 0; i < (int)std::size(buf); i++) {
REPORTER_ASSERT(r, buf[i] = 2*i-1);
}
});
@@ -525,9 +525,9 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int buf[] = {0,1,2,3,4,5,6,7,8,9,10};
- program.eval((int)SK_ARRAY_COUNT(buf), &buf);
+ program.eval((int)std::size(buf), &buf);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ for (int i = 0; i < (int)std::size(buf); i++) {
REPORTER_ASSERT(r, buf[i] = 1-2*i);
}
});
@@ -565,8 +565,8 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
float buf[] = { -2.0f, -1.5f, -1.0f, 0.0f, 1.0f, 1.5f, 2.0f };
float want[] = { -2.0f, -2.0f, -1.0f, 0.0f, 1.0f, 1.0f, 2.0f };
- program.eval(SK_ARRAY_COUNT(buf), buf);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ program.eval(std::size(buf), buf);
+ for (int i = 0; i < (int)std::size(buf); i++) {
REPORTER_ASSERT(r, buf[i] == want[i]);
}
});
@@ -585,10 +585,10 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
float buf[] = { -1.5f, -0.5f, 0.0f, 0.5f, 0.2f, 0.6f, 1.0f, 1.4f, 1.5f, 2.0f };
int want[] = { -2 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 2 , 2 };
- int dst[SK_ARRAY_COUNT(buf)];
+ int dst[std::size(buf)];
- program.eval(SK_ARRAY_COUNT(buf), buf, dst);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(dst); i++) {
+ program.eval(std::size(buf), buf, dst);
+ for (int i = 0; i < (int)std::size(dst); i++) {
REPORTER_ASSERT(r, dst[i] == want[i]);
}
});
@@ -608,9 +608,9 @@
float s1[] = { 0.0f, 1.0f, 4.0f, -1.0f, -1.0f};
float s2[] = { 0.0f, 2.0f, 3.0f, 1.0f, -2.0f};
float want[] = { 0.0f, 1.0f, 3.0f, -1.0f, -2.0f};
- float d[SK_ARRAY_COUNT(s1)];
- program.eval(SK_ARRAY_COUNT(d), s1, s2, d);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(d); i++) {
+ float d[std::size(s1)];
+ program.eval(std::size(d), s1, s2, d);
+ for (int i = 0; i < (int)std::size(d); i++) {
REPORTER_ASSERT(r, d[i] == want[i]);
}
});
@@ -630,9 +630,9 @@
float s1[] = { 0.0f, 1.0f, 4.0f, -1.0f, -1.0f};
float s2[] = { 0.0f, 2.0f, 3.0f, 1.0f, -2.0f};
float want[] = { 0.0f, 2.0f, 4.0f, 1.0f, -1.0f};
- float d[SK_ARRAY_COUNT(s1)];
- program.eval(SK_ARRAY_COUNT(d), s1, s2, d);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(d); i++) {
+ float d[std::size(s1)];
+ program.eval(std::size(d), s1, s2, d);
+ for (int i = 0; i < (int)std::size(d); i++) {
REPORTER_ASSERT(r, d[i] == want[i]);
}
});
@@ -674,8 +674,8 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int buf[] = { 0,1,2,3,4,5,6,7,8 };
- program.eval(SK_ARRAY_COUNT(buf), buf);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ program.eval(std::size(buf), buf);
+ for (int i = 0; i < (int)std::size(buf); i++) {
REPORTER_ASSERT(r, buf[i] == (i > 4 ? i : 42));
}
});
@@ -708,8 +708,8 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int b1[] = { 0,1,2,3 };
int b2[] = { 4,5,6,7 };
- program.eval(SK_ARRAY_COUNT(b1), b1, b2);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(b1); i++) {
+ program.eval(std::size(b1), b1, b2);
+ for (int i = 0; i < (int)std::size(b1); i++) {
REPORTER_ASSERT(r, b1[i] == 4 + i);
REPORTER_ASSERT(r, b2[i] == i);
}
@@ -882,7 +882,7 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program) {
int buf[] = { 0,1,2,3,4,5,6,7,8,9 };
- program.eval(SK_ARRAY_COUNT(buf), buf);
+ program.eval(std::size(buf), buf);
});
}
@@ -2144,7 +2144,7 @@
// log2
{
float values[] = {0.25f, 0.5f, 1, 2, 4, 8};
- constexpr int N = SK_ARRAY_COUNT(values);
+ constexpr int N = std::size(values);
eval(N, values, [](skvm::Builder* b, skvm::F32 v) {
return b->approx_log2(v);
});
@@ -2155,7 +2155,7 @@
// pow2
{
float values[] = {-80, -5, -2, -1, 0, 1, 2, 3, 5, 160};
- constexpr int N = SK_ARRAY_COUNT(values);
+ constexpr int N = std::size(values);
eval(N, values, [](skvm::Builder* b, skvm::F32 v) {
return b->approx_pow2(v);
});
@@ -2165,7 +2165,7 @@
// powf -- 1^x
{
float exps[] = {-2, -1, 0, 1, 2};
- constexpr int N = SK_ARRAY_COUNT(exps);
+ constexpr int N = std::size(exps);
eval(N, exps, [](skvm::Builder* b, skvm::F32 exp) {
return b->approx_powf(b->splat(1.0f), exp);
});
@@ -2175,7 +2175,7 @@
// powf -- 2^x
{
float exps[] = {-80, -5, -2, -1, 0, 1, 2, 3, 5, 160};
- constexpr int N = SK_ARRAY_COUNT(exps);
+ constexpr int N = std::size(exps);
eval(N, exps, [](skvm::Builder* b, skvm::F32 exp) {
return b->approx_powf(2.0, exp);
});
@@ -2185,7 +2185,7 @@
// powf -- 3^x
{
float exps[] = {-2, -1, 0, 1, 2};
- constexpr int N = SK_ARRAY_COUNT(exps);
+ constexpr int N = std::size(exps);
eval(N, exps, [](skvm::Builder* b, skvm::F32 exp) {
return b->approx_powf(b->splat(3.0f), exp);
});
@@ -2195,7 +2195,7 @@
// powf -- x^0.5
{
float bases[] = {0, 1, 4, 9, 16};
- constexpr int N = SK_ARRAY_COUNT(bases);
+ constexpr int N = std::size(bases);
eval(N, bases, [](skvm::Builder* b, skvm::F32 base) {
return b->approx_powf(base, b->splat(0.5f));
});
@@ -2205,7 +2205,7 @@
// powf -- x^1
{
float bases[] = {0, 1, 2, 3, 4};
- constexpr int N = SK_ARRAY_COUNT(bases);
+ constexpr int N = std::size(bases);
eval(N, bases, [](skvm::Builder* b, skvm::F32 base) {
return b->approx_powf(base, b->splat(1.0f));
});
@@ -2215,7 +2215,7 @@
// powf -- x^2
{
float bases[] = {0, 1, 2, 3, 4};
- constexpr int N = SK_ARRAY_COUNT(bases);
+ constexpr int N = std::size(bases);
eval(N, bases, [](skvm::Builder* b, skvm::F32 base) {
return b->approx_powf(base, b->splat(2.0f));
});
@@ -2731,8 +2731,8 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program){
int buf[] = { 0,1,2,3,4 };
- program.eval(SK_ARRAY_COUNT(buf), buf);
- for (int i = 0; i < (int)SK_ARRAY_COUNT(buf); i++) {
+ program.eval(std::size(buf), buf);
+ for (int i = 0; i < (int)std::size(buf); i++) {
REPORTER_ASSERT(r, buf[i] == i+K);
}
});
@@ -2752,7 +2752,7 @@
test_jit_and_interpreter(b, [&](const skvm::Program& program){
int buf[42];
- program.eval(SK_ARRAY_COUNT(buf), buf);
+ program.eval(std::size(buf), buf);
for (int x : buf) {
REPORTER_ASSERT(r, x == 4);
}
diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp
index babbba8..2862fa9 100644
--- a/tests/SortTest.cpp
+++ b/tests/SortTest.cpp
@@ -37,14 +37,14 @@
/** An array of random numbers to be sorted. */
int randomArray[500];
/** The reference sort of the random numbers. */
- int sortedArray[SK_ARRAY_COUNT(randomArray)];
+ int sortedArray[std::size(randomArray)];
/** The random numbers are copied into this array, sorted by an SkSort,
then this array is compared against the reference sort. */
- int workingArray[SK_ARRAY_COUNT(randomArray)];
+ int workingArray[std::size(randomArray)];
SkRandom rand;
for (int i = 0; i < 10000; i++) {
- int count = rand.nextRangeU(1, SK_ARRAY_COUNT(randomArray));
+ int count = rand.nextRangeU(1, std::size(randomArray));
rand_array(rand, randomArray, count);
// Use qsort as the reference sort.
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index cd821af..1241dd7 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -158,13 +158,13 @@
size_t i;
SkDynamicMemoryWStream wstream;
- for (i = 0; i < SK_ARRAY_COUNT(sizes); ++i) {
+ for (i = 0; i < std::size(sizes); ++i) {
bool success = wstream.writePackedUInt(sizes[i]);
REPORTER_ASSERT(reporter, success);
}
std::unique_ptr<SkStreamAsset> rstream(wstream.detachAsStream());
- for (i = 0; i < SK_ARRAY_COUNT(sizes); ++i) {
+ for (i = 0; i < std::size(sizes); ++i) {
size_t n;
if (!rstream->readPackedUInt(&n)) {
ERRORF(reporter, "[%zu] sizes:%zx could not be read\n", i, sizes[i]);
diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp
index 4bf7ca1..79a68e0 100644
--- a/tests/StringTest.cpp
+++ b/tests/StringTest.cpp
@@ -157,7 +157,7 @@
{ -3.4028234e38f, "-3.4028235e+38" },
#endif
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
+ for (size_t i = 0; i < std::size(gRec); i++) {
a.reset();
a.appendScalar(gRec[i].fValue);
REPORTER_ASSERT(reporter, a.size() <= kSkStrAppendScalar_MaxSize);
@@ -316,17 +316,17 @@
0xD835, 0xDCD0, 0xD835, 0xDCD1, 0xD835, 0xDCD2, 0xD835, 0xDCD3, 0xD835, 0xDCD4, 0x0020,
0xD835, 0xDCD5, 0xD835, 0xDCD6, 0xD835, 0xDCD7, 0xD835, 0xDCD8, 0xD835, 0xDCD9
};
- REPORTER_ASSERT(r, SkStringFromUTF16(test1, SK_ARRAY_COUNT(test1)).equals("𝓐𝓑𝓒𝓓𝓔 𝓕𝓖𝓗𝓘𝓙"));
+ REPORTER_ASSERT(r, SkStringFromUTF16(test1, std::size(test1)).equals("𝓐𝓑𝓒𝓓𝓔 𝓕𝓖𝓗𝓘𝓙"));
const uint16_t test2[] = {
0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0020, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A,
};
- REPORTER_ASSERT(r, SkStringFromUTF16(test2, SK_ARRAY_COUNT(test2)).equals("ABCDE FGHIJ"));
+ REPORTER_ASSERT(r, SkStringFromUTF16(test2, std::size(test2)).equals("ABCDE FGHIJ"));
const uint16_t test3[] = {
0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x0020, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA,
};
- REPORTER_ASSERT(r, SkStringFromUTF16(test3, SK_ARRAY_COUNT(test3)).equals("αβγδε ζηθικ"));
+ REPORTER_ASSERT(r, SkStringFromUTF16(test3, std::size(test3)).equals("αβγδε ζηθικ"));
}
static void test_va_list_print(skiatest::Reporter* r, const char format[], ...)
diff --git a/tests/StrokeTest.cpp b/tests/StrokeTest.cpp
index ed348d3..8e07598 100644
--- a/tests/StrokeTest.cpp
+++ b/tests/StrokeTest.cpp
@@ -65,7 +65,7 @@
SkPaint::kMiter_Join, SkPaint::kRound_Join, SkPaint::kBevel_Join
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(joins); ++i) {
+ for (size_t i = 0; i < std::size(joins); ++i) {
paint.setStrokeJoin(joins[i]);
SkPath path, fillPath;
diff --git a/tests/StrokerTest.cpp b/tests/StrokerTest.cpp
index 0ea2fcc..25ffc0a 100644
--- a/tests/StrokerTest.cpp
+++ b/tests/StrokerTest.cpp
@@ -27,7 +27,7 @@
0.0000001f, 0.000001f, 0.00001f, 0.0001f, 0.001f, 0.01f,
0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 1, 1.1f, 2, 10, 10e2f, 10e3f, 10e4f, 10e5f, 10e6f, 10e7f,
10e8f, 10e9f, 10e10f, 10e20f, FLT_MAX };
-size_t widths_count = SK_ARRAY_COUNT(widths);
+size_t widths_count = std::size(widths);
static void pathTest(const SkPath& path) {
SkPaint p;
diff --git a/tests/TArrayTest.cpp b/tests/TArrayTest.cpp
index 7350e28..ef301c8 100644
--- a/tests/TArrayTest.cpp
+++ b/tests/TArrayTest.cpp
@@ -59,19 +59,19 @@
// { 1 }, replace with new array
T b[5] = {T{0}, T{1}, T{2}, T{3}, T{4}};
- a.reset(b, SK_ARRAY_COUNT(b));
- REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b));
+ a.reset(b, std::size(b));
+ REPORTER_ASSERT(reporter, a.count() == std::size(b));
REPORTER_ASSERT(reporter, a[2] == T{2});
REPORTER_ASSERT(reporter, a[4] == T{4});
// { 0, 1, 2, 3, 4 }, removeShuffle the last
a.removeShuffle(4);
- REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b) - 1);
+ REPORTER_ASSERT(reporter, a.count() == std::size(b) - 1);
REPORTER_ASSERT(reporter, a[3] == T{3});
// { 0, 1, 2, 3 }, remove a middle, note shuffle
a.removeShuffle(1);
- REPORTER_ASSERT(reporter, a.count() == SK_ARRAY_COUNT(b) - 2);
+ REPORTER_ASSERT(reporter, a.count() == std::size(b) - 2);
REPORTER_ASSERT(reporter, a[0] == T{0});
REPORTER_ASSERT(reporter, a[1] == T{3});
REPORTER_ASSERT(reporter, a[2] == T{2});
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index 51ab346..ad1be0a 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -28,24 +28,24 @@
RunDef set1[] = {
{ 128, SkTextBlobRunIterator::kDefault_Positioning, 100, 100 },
};
- RunBuilderTest(reporter, builder, set1, SK_ARRAY_COUNT(set1), set1, SK_ARRAY_COUNT(set1));
+ RunBuilderTest(reporter, builder, set1, std::size(set1), set1, std::size(set1));
RunDef set2[] = {
{ 128, SkTextBlobRunIterator::kHorizontal_Positioning, 100, 100 },
};
- RunBuilderTest(reporter, builder, set2, SK_ARRAY_COUNT(set2), set2, SK_ARRAY_COUNT(set2));
+ RunBuilderTest(reporter, builder, set2, std::size(set2), set2, std::size(set2));
RunDef set3[] = {
{ 128, SkTextBlobRunIterator::kFull_Positioning, 100, 100 },
};
- RunBuilderTest(reporter, builder, set3, SK_ARRAY_COUNT(set3), set3, SK_ARRAY_COUNT(set3));
+ RunBuilderTest(reporter, builder, set3, std::size(set3), set3, std::size(set3));
RunDef set4[] = {
{ 128, SkTextBlobRunIterator::kDefault_Positioning, 100, 150 },
{ 128, SkTextBlobRunIterator::kDefault_Positioning, 100, 150 },
{ 128, SkTextBlobRunIterator::kDefault_Positioning, 100, 150 },
};
- RunBuilderTest(reporter, builder, set4, SK_ARRAY_COUNT(set4), set4, SK_ARRAY_COUNT(set4));
+ RunBuilderTest(reporter, builder, set4, std::size(set4), set4, std::size(set4));
RunDef set5[] = {
{ 128, SkTextBlobRunIterator::kHorizontal_Positioning, 100, 150 },
@@ -56,8 +56,8 @@
{ 256, SkTextBlobRunIterator::kHorizontal_Positioning, 0, 150 },
{ 128, SkTextBlobRunIterator::kHorizontal_Positioning, 0, 250 },
};
- RunBuilderTest(reporter, builder, set5, SK_ARRAY_COUNT(set5), mergedSet5,
- SK_ARRAY_COUNT(mergedSet5));
+ RunBuilderTest(reporter, builder, set5, std::size(set5), mergedSet5,
+ std::size(mergedSet5));
RunDef set6[] = {
{ 128, SkTextBlobRunIterator::kFull_Positioning, 100, 100 },
@@ -67,8 +67,8 @@
RunDef mergedSet6[] = {
{ 384, SkTextBlobRunIterator::kFull_Positioning, 0, 0 },
};
- RunBuilderTest(reporter, builder, set6, SK_ARRAY_COUNT(set6), mergedSet6,
- SK_ARRAY_COUNT(mergedSet6));
+ RunBuilderTest(reporter, builder, set6, std::size(set6), mergedSet6,
+ std::size(mergedSet6));
RunDef set7[] = {
{ 128, SkTextBlobRunIterator::kDefault_Positioning, 100, 150 },
@@ -95,8 +95,8 @@
{ 128, SkTextBlobRunIterator::kHorizontal_Positioning, 0, 650 },
{ 256, SkTextBlobRunIterator::kFull_Positioning, 0, 0 },
};
- RunBuilderTest(reporter, builder, set7, SK_ARRAY_COUNT(set7), mergedSet7,
- SK_ARRAY_COUNT(mergedSet7));
+ RunBuilderTest(reporter, builder, set7, std::size(set7), mergedSet7,
+ std::size(mergedSet7));
}
// This unit test verifies blob bounds computation.
diff --git a/tests/TopoSortTest.cpp b/tests/TopoSortTest.cpp
index 3403d72..9f77e99 100644
--- a/tests/TopoSortTest.cpp
+++ b/tests/TopoSortTest.cpp
@@ -175,7 +175,7 @@
{ create_graph6, false },
};
- for (size_t i = 0; i < SK_ARRAY_COUNT(tests); ++i) {
+ for (size_t i = 0; i < std::size(tests); ++i) {
SkTArray<sk_sp<ToolUtils::TopoTestNode>> graph;
(tests[i].fCreate)(&graph);
diff --git a/tests/TriangulatingPathRendererTests.cpp b/tests/TriangulatingPathRendererTests.cpp
index 52f1756..f6f376a 100644
--- a/tests/TriangulatingPathRendererTests.cpp
+++ b/tests/TriangulatingPathRendererTests.cpp
@@ -786,7 +786,7 @@
SkPoint pts[2] = { {0, 0}, {1, 1} };
SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE };
sk_sp<SkShader> shader = SkGradientShader::MakeLinear(
- pts, colors, nullptr, SK_ARRAY_COUNT(colors), SkTileMode::kClamp);
+ pts, colors, nullptr, std::size(colors), SkTileMode::kClamp);
GrColorInfo colorInfo(GrColorType::kRGBA_8888, kPremul_SkAlphaType, nullptr);
SkMatrixProvider matrixProvider(SkMatrix::I());
return as_SB(shader)->asFragmentProcessor({rContext, matrixProvider, &colorInfo});
@@ -1111,7 +1111,7 @@
verify_simple_inner_polygons(r, "overlapping rects with horizontal collinear edges", SkPath()
.lineTo(2,0).lineTo(2,1).lineTo(0,1)
.moveTo(1,0).lineTo(3,0).lineTo(3,1).lineTo(1,1).close());
- for (int i = 0; i < (int)SK_ARRAY_COUNT(kNonEdgeAAPaths); ++i) {
+ for (int i = 0; i < (int)std::size(kNonEdgeAAPaths); ++i) {
verify_simple_inner_polygons(r, SkStringPrintf("kNonEdgeAAPaths[%i]", i).c_str(),
kNonEdgeAAPaths[i]());
}
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index e4598a8..1e6317f 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -255,7 +255,7 @@
{ SkSetFourByteTag('w','g','h','t'), 600.0f },
};
SkFontArguments params;
- params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
+ params.setVariationDesignPosition({position, std::size(position)});
sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(dupTags), params);
test(typeface.get(), Variation{&position[1], 2}, 1);
}
@@ -275,7 +275,7 @@
{ SkSetFourByteTag('w','g','h','t'), SK_ScalarSqrt2 },
};
SkFontArguments params;
- params.setVariationDesignPosition({position, SK_ARRAY_COUNT(position)});
+ params.setVariationDesignPosition({position, std::size(position)});
sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(distortable), params);
test(typeface.get(), Variation{&position[1], 1}, -1);
@@ -312,7 +312,7 @@
}
SkFontArguments::VariationPosition::Coordinate positionRead[1];
- count = typeface->getVariationDesignPosition(positionRead, SK_ARRAY_COUNT(positionRead));
+ count = typeface->getVariationDesignPosition(positionRead, std::size(positionRead));
if (count == -1) {
return;
}
@@ -439,7 +439,7 @@
Axis(SkSetFourByteTag('w','d','t','h'), 50.0f, 100.0f, 200.0f, false),
};
sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(variable), 0);
- test(typeface.get(), &expected[0], SK_ARRAY_COUNT(expected), -1);
+ test(typeface.get(), &expected[0], std::size(expected), -1);
}
// Multiple axes with the same tag (and min, max, default) works.
@@ -457,7 +457,7 @@
Axis(SkSetFourByteTag('w','g','h','t'), 100.0f, 400.0f, 900.0f, false),
};
sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(dupTags), 0);
- test(typeface.get(), &expected[0], SK_ARRAY_COUNT(expected), 1);
+ test(typeface.get(), &expected[0], std::size(expected), 1);
}
// Simple single axis GX variable font.
@@ -471,7 +471,7 @@
Axis(SkSetFourByteTag('w','g','h','t'), 0.5f, 1.0f, 2.0f, true),
};
sk_sp<SkTypeface> typeface = fm->makeFromStream(std::move(distortable), 0);
- test(typeface.get(), &expected[0], SK_ARRAY_COUNT(expected), -1);
+ test(typeface.get(), &expected[0], std::size(expected), -1);
}
}
diff --git a/tests/UnicodeTest.cpp b/tests/UnicodeTest.cpp
index 1328fdc..2137678 100644
--- a/tests/UnicodeTest.cpp
+++ b/tests/UnicodeTest.cpp
@@ -32,9 +32,9 @@
SkFont font;
- int count8 = font.textToGlyphs(text8, len8, SkTextEncoding::kUTF8, glyphs8, SK_ARRAY_COUNT(glyphs8));
- int count16 = font.textToGlyphs(text16, len16, SkTextEncoding::kUTF16, glyphs16, SK_ARRAY_COUNT(glyphs16));
- int count32 = font.textToGlyphs(text32, len32, SkTextEncoding::kUTF32, glyphs32, SK_ARRAY_COUNT(glyphs32));
+ int count8 = font.textToGlyphs(text8, len8, SkTextEncoding::kUTF8, glyphs8, std::size(glyphs8));
+ int count16 = font.textToGlyphs(text16, len16, SkTextEncoding::kUTF16, glyphs16, std::size(glyphs16));
+ int count32 = font.textToGlyphs(text32, len32, SkTextEncoding::kUTF32, glyphs32, std::size(glyphs32));
REPORTER_ASSERT(reporter, (int)len8 == count8);
REPORTER_ASSERT(reporter, (int)len8 == count16);
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 745f057..1429ab0 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -382,10 +382,10 @@
{kBGRA_8888_SkColorType, kPremul_SkAlphaType},
{kBGRA_8888_SkColorType, kUnpremul_SkAlphaType},
};
- for (size_t r = 0; r < SK_ARRAY_COUNT(testRects); ++r) {
+ for (size_t r = 0; r < std::size(testRects); ++r) {
const SkIRect& rect = testRects[r];
for (int tightBmp = 0; tightBmp < 2; ++tightBmp) {
- for (size_t c = 0; c < SK_ARRAY_COUNT(gSrcConfigs); ++c) {
+ for (size_t c = 0; c < std::size(gSrcConfigs); ++c) {
const SkColorType ct = gSrcConfigs[c].fColorType;
const SkAlphaType at = gSrcConfigs[c].fAlphaType;
diff --git a/tests/Writer32Test.cpp b/tests/Writer32Test.cpp
index 2ada4df..18dcbf85 100644
--- a/tests/Writer32Test.cpp
+++ b/tests/Writer32Test.cpp
@@ -43,7 +43,7 @@
int32_t array[3] = { 1, 2, 4 };
REPORTER_ASSERT(reporter, 0 == swriter.bytesWritten());
- for (size_t i = 0; i < SK_ARRAY_COUNT(array); ++i) {
+ for (size_t i = 0; i < std::size(array); ++i) {
swriter.writeInt(array[i]);
}
check_contents(reporter, swriter, array, sizeof(array));
@@ -70,7 +70,7 @@
static void test1(skiatest::Reporter* reporter, SkWriter32* writer) {
const uint32_t data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
- for (size_t i = 0; i < SK_ARRAY_COUNT(data); ++i) {
+ for (size_t i = 0; i < std::size(data); ++i) {
REPORTER_ASSERT(reporter, i*4 == writer->bytesWritten());
writer->write32(data[i]);
REPORTER_ASSERT(reporter, data[i] == writer->readTAt<uint32_t>(i * 4));