Remove SkTMin and SkTMax
Use std::min and std::max everywhere.
SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.
Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 66d541f..a61441c 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -7,6 +7,7 @@
Milestone 82
<Insert new notes here- top is most recent.>
+ * Removed SkTMax and SkTMin.
* Removed SkTClamp and SkClampMax.
* Removed SkScalarClampMax and SkScalarPin.
* Removed SkMax32 and SkMin32.
diff --git a/bench/PathTextBench.cpp b/bench/PathTextBench.cpp
index 9f51f38..846f049 100644
--- a/bench/PathTextBench.cpp
+++ b/bench/PathTextBench.cpp
@@ -59,11 +59,11 @@
for (int i = 0; i < kNumDraws; ++i) {
const SkPath& glyph = fGlyphs[i % kNumGlyphs];
const SkRect& bounds = glyph.getBounds();
- float glyphSize = SkTMax(bounds.width(), bounds.height());
+ float glyphSize = std::max(bounds.width(), bounds.height());
float t0 = pow(rand.nextF(), 100);
- float size = (1 - t0) * SkTMin(kScreenWidth, kScreenHeight) / 50 +
- t0 * SkTMin(kScreenWidth, kScreenHeight) / 3;
+ float size = (1 - t0) * std::min(kScreenWidth, kScreenHeight) / 50 +
+ t0 * std::min(kScreenWidth, kScreenHeight) / 3;
float scale = size / glyphSize;
float t1 = rand.nextF(), t2 = rand.nextF();
fXforms[i].setTranslate((1 - t1) * sqrt(2) * scale/2 * glyphSize +
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 9fe11f8..c6dc83f 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -55,8 +55,8 @@
int tileW = gpu ? FLAGS_GPUbenchTileW : FLAGS_CPUbenchTileW,
tileH = gpu ? FLAGS_GPUbenchTileH : FLAGS_CPUbenchTileH;
- tileW = SkTMin(tileW, bounds.width());
- tileH = SkTMin(tileH, bounds.height());
+ tileW = std::min(tileW, bounds.width());
+ tileH = std::min(tileH, bounds.height());
int xTiles = SkScalarCeilToInt(bounds.width() / SkIntToScalar(tileW));
int yTiles = SkScalarCeilToInt(bounds.height() / SkIntToScalar(tileH));
diff --git a/bench/ShapesBench.cpp b/bench/ShapesBench.cpp
index 9b4e99ff..dcb75c9 100644
--- a/bench/ShapesBench.cpp
+++ b/bench/ShapesBench.cpp
@@ -102,7 +102,7 @@
private:
void clampShapeSize() {
- float maxDiagonal = static_cast<float>(SkTMin(kBenchWidth, kBenchHeight));
+ float maxDiagonal = static_cast<float>(std::min(kBenchWidth, kBenchHeight));
float diagonal = sqrtf(static_cast<float>(fShapesSize.width() * fShapesSize.width()) +
static_cast<float>(fShapesSize.height() * fShapesSize.height()));
if (diagonal > maxDiagonal) {
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 5755d4c..04be13e 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -956,7 +956,7 @@
while (fCurrentSampleSize < (int) SK_ARRAY_COUNT(sampleSizes)) {
int sampleSize = sampleSizes[fCurrentSampleSize];
fCurrentSampleSize++;
- if (10 * sampleSize > SkTMin(codec->getInfo().width(), codec->getInfo().height())) {
+ if (10 * sampleSize > std::min(codec->getInfo().width(), codec->getInfo().height())) {
// Avoid benchmarking scaled decodes of already small images.
break;
}
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index da68301..41ae1e4 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -205,8 +205,8 @@
// We will not allow the border to be larger than the image dimensions. Allowing
// these large borders causes off by one errors that indicate a problem with the
// test suite, not a problem with the implementation.
- const uint32_t maxBorder = SkTMin(width, height) / (fSampleSize * divisor);
- const uint32_t scaledBorder = SkTMin(5u, maxBorder);
+ const uint32_t maxBorder = std::min(width, height) / (fSampleSize * divisor);
+ const uint32_t scaledBorder = std::min(5u, maxBorder);
const uint32_t unscaledBorder = scaledBorder * fSampleSize;
// We may need to clear the canvas to avoid uninitialized memory.
@@ -270,8 +270,8 @@
SkISize BRDSrc::size() const {
std::unique_ptr<SkBitmapRegionDecoder> brd(create_brd(fPath));
if (brd) {
- return {SkTMax(1, brd->width() / (int)fSampleSize),
- SkTMax(1, brd->height() / (int)fSampleSize)};
+ return {std::max(1, brd->width() / (int)fSampleSize),
+ std::max(1, brd->height() / (int)fSampleSize)};
}
return {0, 0};
}
@@ -599,12 +599,12 @@
for (int i = 0; i < numStripes; i += 2) {
// Skip a stripe
- const int linesToSkip = SkTMin(stripeHeight, height - i * stripeHeight);
+ const int linesToSkip = std::min(stripeHeight, height - i * stripeHeight);
codec->skipScanlines(linesToSkip);
// Read a stripe
const int startY = (i + 1) * stripeHeight;
- const int linesToRead = SkTMin(stripeHeight, height - startY);
+ const int linesToRead = std::min(stripeHeight, height - startY);
if (linesToRead > 0) {
codec->getScanlines(SkTAddOffset<void>(dst, rowBytes * startY), linesToRead,
rowBytes);
@@ -619,12 +619,12 @@
for (int i = 0; i < numStripes; i += 2) {
// Read a stripe
const int startY = i * stripeHeight;
- const int linesToRead = SkTMin(stripeHeight, height - startY);
+ const int linesToRead = std::min(stripeHeight, height - startY);
codec->getScanlines(SkTAddOffset<void>(dst, rowBytes * startY), linesToRead,
rowBytes);
// Skip a stripe
- const int linesToSkip = SkTMin(stripeHeight, height - (i + 1) * stripeHeight);
+ const int linesToSkip = std::min(stripeHeight, height - (i + 1) * stripeHeight);
if (linesToSkip > 0) {
codec->skipScanlines(linesToSkip);
}
@@ -642,7 +642,7 @@
const int tileSize = 36;
SkIRect subset;
for (int x = 0; x < width; x += tileSize) {
- subset = SkIRect::MakeXYWH(x, 0, SkTMin(tileSize, width - x), height);
+ subset = SkIRect::MakeXYWH(x, 0, std::min(tileSize, width - x), height);
options.fSubset = ⊂
if (SkCodec::kSuccess != codec->startScanlineDecode(decodeInfo, &options)) {
return "Could not start scanline decoder.";
@@ -682,14 +682,14 @@
int top = 0;
for (int y = 0; y < H; y+= h) {
// Do not make the subset go off the edge of the image.
- const int preScaleW = SkTMin(w, W - x);
- const int preScaleH = SkTMin(h, H - y);
+ const int preScaleW = std::min(w, W - x);
+ const int preScaleH = std::min(h, H - y);
subset.setXYWH(x, y, preScaleW, preScaleH);
// And scale
// FIXME: Should we have a version of getScaledDimensions that takes a subset
// into account?
- const int scaledW = SkTMax(1, SkScalarRoundToInt(preScaleW * fScale));
- const int scaledH = SkTMax(1, SkScalarRoundToInt(preScaleH * fScale));
+ const int scaledW = std::max(1, SkScalarRoundToInt(preScaleW * fScale));
+ const int scaledH = std::max(1, SkScalarRoundToInt(preScaleH * fScale));
decodeInfo = decodeInfo.makeWH(scaledW, scaledH);
SkImageInfo subsetBitmapInfo = bitmapInfo.makeWH(scaledW, scaledH);
size_t subsetRowBytes = subsetBitmapInfo.minRowBytes();
@@ -1207,7 +1207,7 @@
// no intrinsic size
fDom->setContainerSize(kDefaultSVGSize);
} else {
- fScale = SkTMax(1.f, SkTMax(kMinimumSVGSize.width() / sz.width(),
+ fScale = std::max(1.f, std::max(kMinimumSVGSize.width() / sz.width(),
kMinimumSVGSize.height() / sz.height()));
}
}
@@ -1380,7 +1380,7 @@
initContext(context);
}
const int maxDimension = context->priv().caps()->maxTextureSize();
- if (maxDimension < SkTMax(size.width(), size.height())) {
+ if (maxDimension < std::max(size.width(), size.height())) {
return Error::Nonfatal("Src too large to create a texture.\n");
}
uint32_t flags = fUseDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
diff --git a/docs/examples/Octopus_Generator.cpp b/docs/examples/Octopus_Generator.cpp
index 3602c27..da791dd 100644
--- a/docs/examples/Octopus_Generator.cpp
+++ b/docs/examples/Octopus_Generator.cpp
@@ -12,9 +12,9 @@
canvas->drawCircle(x - radius + (2 * radius / 7.5 * leg),
y + radius - pow(abs(4 - leg), 2), size_base / 2 + 2, paint);
}
- paint.setColor(SkColorSetRGB(SkTMin(255u, SkColorGetR(color) + 20),
- SkTMin(255u, SkColorGetG(color) + 20),
- SkTMin(255u, SkColorGetB(color) + 20)));
+ paint.setColor(SkColorSetRGB(std::min(255u, SkColorGetR(color) + 20),
+ std::min(255u, SkColorGetG(color) + 20),
+ std::min(255u, SkColorGetB(color) + 20)));
canvas->drawCircle(x - size_base, y + size_base, size_base / 2, paint);
canvas->drawCircle(x + size_base, y + size_base, size_base / 2, paint);
}
diff --git a/docs/examples/Octopus_Generator_Animated.cpp b/docs/examples/Octopus_Generator_Animated.cpp
index 3c2ae0d..ead2a54 100644
--- a/docs/examples/Octopus_Generator_Animated.cpp
+++ b/docs/examples/Octopus_Generator_Animated.cpp
@@ -12,9 +12,9 @@
canvas->drawCircle(x - radius + (2*radius/7.5*leg),
y + radius - pow(abs(4-leg), 2), size_base/2 + 2, paint);
}
- paint.setColor(SkColorSetRGB(SkTMin(255u, SkColorGetR(color) + 20),
- SkTMin(255u, SkColorGetG(color) + 20),
- SkTMin(255u, SkColorGetB(color) + 20)));
+ paint.setColor(SkColorSetRGB(std::min(255u, SkColorGetR(color) + 20),
+ std::min(255u, SkColorGetG(color) + 20),
+ std::min(255u, SkColorGetB(color) + 20)));
canvas->drawCircle(x-size_base, y+size_base, size_base/2, paint);
canvas->drawCircle(x+size_base, y+size_base, size_base/2, paint);
}
diff --git a/docs/examples/Path_getPoints.cpp b/docs/examples/Path_getPoints.cpp
index 03b660c..b3898c3 100644
--- a/docs/examples/Path_getPoints.cpp
+++ b/docs/examples/Path_getPoints.cpp
@@ -7,7 +7,7 @@
auto debugster = [](const char* prefix, const SkPath& path, SkPoint* points, int max) -> void {
int count = path.getPoints(points, max);
SkDebugf("%s point count: %d ", prefix, count);
- for (int i = 0; i < SkTMin(count, max) && points; ++i) {
+ for (int i = 0; i < std::min(count, max) && points; ++i) {
SkDebugf("(%1.8g,%1.8g) ", points[i].fX, points[i].fY);
}
SkDebugf("\n");
diff --git a/docs/examples/Path_getVerbs.cpp b/docs/examples/Path_getVerbs.cpp
index c38876e..5da0022 100644
--- a/docs/examples/Path_getVerbs.cpp
+++ b/docs/examples/Path_getVerbs.cpp
@@ -8,7 +8,7 @@
int count = path.getVerbs(verbs, max);
SkDebugf("%s verb count: %d ", prefix, count);
const char* verbStr[] = { "move", "line", "quad", "conic", "cubic", "close" };
- for (int i = 0; i < SkTMin(count, max) && verbs; ++i) {
+ for (int i = 0; i < std::min(count, max) && verbs; ++i) {
SkDebugf("%s ", verbStr[verbs[i]]);
}
SkDebugf("\n");
diff --git a/docs/examples/SkImage_to_PPM_ascii.cpp b/docs/examples/SkImage_to_PPM_ascii.cpp
index 13e5c7f..680dfa9 100644
--- a/docs/examples/SkImage_to_PPM_ascii.cpp
+++ b/docs/examples/SkImage_to_PPM_ascii.cpp
@@ -8,7 +8,7 @@
size_t s = data->size();
const char* d = (const char*)data->bytes();
while (s > 0) {
- int l = (int)SkTMin(s, (size_t)1024);
+ int l = (int)std::min(s, (size_t)1024);
SkDebugf("%.*s", l, d);
s -= l;
d += l;
diff --git a/experimental/ffmpeg/SkVideoEncoder.cpp b/experimental/ffmpeg/SkVideoEncoder.cpp
index 358f5a5..1b62944 100644
--- a/experimental/ffmpeg/SkVideoEncoder.cpp
+++ b/experimental/ffmpeg/SkVideoEncoder.cpp
@@ -30,7 +30,7 @@
size_t len = fStorage.size();
SkASSERT(fPos <= len);
- size_t overwrite = SkTMin(len - fPos, bytes);
+ size_t overwrite = std::min(len - fPos, bytes);
if (overwrite) {
SkDebugf("overwrite %zu bytes at %zu offset with %zu remaining\n", overwrite, fPos, bytes - overwrite);
memcpy(&fStorage[fPos], src, overwrite);
diff --git a/fuzz/FuzzMain.cpp b/fuzz/FuzzMain.cpp
index 4567366..a15aebe 100644
--- a/fuzz/FuzzMain.cpp
+++ b/fuzz/FuzzMain.cpp
@@ -504,12 +504,12 @@
for (int i = 0; i < numStripes; i += 2) {
// Skip a stripe
- const int linesToSkip = SkTMin(stripeHeight, height - i * stripeHeight);
+ const int linesToSkip = std::min(stripeHeight, height - i * stripeHeight);
codec->skipScanlines(linesToSkip);
// Read a stripe
const int startY = (i + 1) * stripeHeight;
- const int linesToRead = SkTMin(stripeHeight, height - startY);
+ const int linesToRead = std::min(stripeHeight, height - startY);
if (linesToRead > 0) {
codec->getScanlines(bitmap.getAddr(0, startY), linesToRead, bitmap.rowBytes());
}
@@ -524,11 +524,11 @@
for (int i = 0; i < numStripes; i += 2) {
// Read a stripe
const int startY = i * stripeHeight;
- const int linesToRead = SkTMin(stripeHeight, height - startY);
+ const int linesToRead = std::min(stripeHeight, height - startY);
codec->getScanlines(bitmap.getAddr(0, startY), linesToRead, bitmap.rowBytes());
// Skip a stripe
- const int linesToSkip = SkTMin(stripeHeight, height - (i + 1) * stripeHeight);
+ const int linesToSkip = std::min(stripeHeight, height - (i + 1) * stripeHeight);
if (linesToSkip > 0) {
codec->skipScanlines(linesToSkip);
}
@@ -565,15 +565,15 @@
int top = 0;
for (int y = 0; y < H; y+= h) {
// Do not make the subset go off the edge of the image.
- const int preScaleW = SkTMin(w, W - x);
- const int preScaleH = SkTMin(h, H - y);
+ const int preScaleW = std::min(w, W - x);
+ const int preScaleH = std::min(h, H - y);
subset.setXYWH(x, y, preScaleW, preScaleH);
// And fscale
// FIXME: Should we have a version of getScaledDimensions that takes a subset
// into account?
decodeInfo = decodeInfo.makeWH(
- SkTMax(1, SkScalarRoundToInt(preScaleW * fscale)),
- SkTMax(1, SkScalarRoundToInt(preScaleH * fscale)));
+ std::max(1, SkScalarRoundToInt(preScaleW * fscale)),
+ std::max(1, SkScalarRoundToInt(preScaleH * fscale)));
size_t rowBytes = decodeInfo.minRowBytes();
if (!subsetBm.installPixels(decodeInfo, pixels, rowBytes)) {
SkDebugf("[terminated] Could not install pixels.\n");
diff --git a/fuzz/FuzzPathMeasure.cpp b/fuzz/FuzzPathMeasure.cpp
index 8526ff8..3107356 100644
--- a/fuzz/FuzzPathMeasure.cpp
+++ b/fuzz/FuzzPathMeasure.cpp
@@ -21,7 +21,7 @@
SkPath path;
FuzzEvilPath(fuzz, &path, SkPath::Verb::kDone_Verb);
SkRect bounds = path.getBounds();
- SkScalar maxDim = SkTMax(bounds.width(), bounds.height());
+ SkScalar maxDim = std::max(bounds.width(), bounds.height());
SkScalar resScale = maxDim / 1000;
SkPathMeasure measure(path, bits & 1, resScale);
SkPoint position;
diff --git a/gm/aaxfermodes.cpp b/gm/aaxfermodes.cpp
index d61a262..7cc209a 100644
--- a/gm/aaxfermodes.cpp
+++ b/gm/aaxfermodes.cpp
@@ -213,9 +213,9 @@
if (mode == SkBlendMode::kPlus) {
// Check for overflow, otherwise we might get confusing AA artifacts.
- int maxSum = SkTMax(SkTMax(SkColorGetA(kBGColor) + SkColorGetA(color),
+ int maxSum = std::max(std::max(SkColorGetA(kBGColor) + SkColorGetA(color),
SkColorGetR(kBGColor) + SkColorGetR(color)),
- SkTMax(SkColorGetG(kBGColor) + SkColorGetG(color),
+ std::max(SkColorGetG(kBGColor) + SkColorGetG(color),
SkColorGetB(kBGColor) + SkColorGetB(color)));
if (maxSum > 255) {
diff --git a/gm/bleed.cpp b/gm/bleed.cpp
index b182fb4..f024bbe 100644
--- a/gm/bleed.cpp
+++ b/gm/bleed.cpp
@@ -345,8 +345,8 @@
SkPoint corners[] = {{0, 0}, { 0, kBottom }, { kWidth, kBottom }, {kWidth, 0} };
matrices[matrices.count()-1].mapPoints(corners, 4);
SkScalar y = (corners[0].fY + corners[1].fY + corners[2].fY + corners[3].fY) / 4;
- SkScalar x = SkTMax(SkTMax(corners[0].fX, corners[1].fX),
- SkTMax(corners[2].fX, corners[3].fX));
+ SkScalar x = std::max(std::max(corners[0].fX, corners[1].fX),
+ std::max(corners[2].fX, corners[3].fX));
m.setTranslate(x, y);
m.preScale(0.2f, 0.2f);
*matrices.append() = m;
@@ -404,9 +404,9 @@
SkPoint corners[] = { { 0, 0 },{ 0, kBottom },{ kWidth, kBottom },{ kWidth, 0 } };
matrices[m].mapPoints(corners, 4);
- SkScalar x = kBlockSize + SkTMax(SkTMax(corners[0].fX, corners[1].fX),
- SkTMax(corners[2].fX, corners[3].fX));
- maxX = SkTMax(maxX, x);
+ SkScalar x = kBlockSize + std::max(std::max(corners[0].fX, corners[1].fX),
+ std::max(corners[2].fX, corners[3].fX));
+ maxX = std::max(maxX, x);
canvas->restore();
}
canvas->restore();
diff --git a/gm/circles.cpp b/gm/circles.cpp
index fe499ce..52d54d2 100644
--- a/gm/circles.cpp
+++ b/gm/circles.cpp
@@ -155,7 +155,7 @@
void onDraw(SkCanvas* canvas) override {
// Draw a giant AA circle as the background.
SkISize size = this->getISize();
- SkScalar giantRadius = SkTMin(SkIntToScalar(size.fWidth),
+ SkScalar giantRadius = std::min(SkIntToScalar(size.fWidth),
SkIntToScalar(size.fHeight)) / 2.f;
SkPoint giantCenter = SkPoint::Make(SkIntToScalar(size.fWidth/2),
SkIntToScalar(size.fHeight/2));
diff --git a/gm/compressed_textures.cpp b/gm/compressed_textures.cpp
index 3ae4d74..d67e2e1 100644
--- a/gm/compressed_textures.cpp
+++ b/gm/compressed_textures.cpp
@@ -60,7 +60,7 @@
tmp.close();
- float fInnerRad = 0.1f * SkTMin(dimensions.fWidth, dimensions.fHeight);
+ float fInnerRad = 0.1f * std::min(dimensions.fWidth, dimensions.fHeight);
if (fInnerRad > 0.5f) {
tmp.addCircle(0.0f, 0.0f, fInnerRad, SkPathDirection::kCCW);
}
@@ -138,7 +138,7 @@
}
offset += levelSize;
- dimensions = {SkTMax(1, dimensions.width()/2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width()/2), std::max(1, dimensions.height()/2)};
}
return tmp;
@@ -278,8 +278,8 @@
offset.fY += levelDimensions.height()+1;
}
- levelDimensions = {SkTMax(1, levelDimensions.width()/2),
- SkTMax(1, levelDimensions.height()/2)};
+ levelDimensions = {std::max(1, levelDimensions.width()/2),
+ std::max(1, levelDimensions.height()/2)};
}
}
diff --git a/gm/constcolorprocessor.cpp b/gm/constcolorprocessor.cpp
index 6aad014..53d7513 100644
--- a/gm/constcolorprocessor.cpp
+++ b/gm/constcolorprocessor.cpp
@@ -168,8 +168,8 @@
// update x and y for the next test case.
SkScalar height = renderRect.height();
- SkScalar width = SkTMax(inputLabelBounds.fRight, procLabelBounds.fRight);
- maxW = SkTMax(maxW, width);
+ SkScalar width = std::max(inputLabelBounds.fRight, procLabelBounds.fRight);
+ maxW = std::max(maxW, width);
y += height + kPad;
if (y + height > kHeight) {
y = kPad;
diff --git a/gm/dashing.cpp b/gm/dashing.cpp
index ed08f10..8c7a082 100644
--- a/gm/dashing.cpp
+++ b/gm/dashing.cpp
@@ -567,7 +567,7 @@
canvas->save();
SkScalar h = 0.f;
for (const auto& line : kLines) {
- h = SkTMax(h, SkScalarAbs(line.fA.fY - line.fB.fY));
+ h = std::max(h, SkScalarAbs(line.fA.fY - line.fB.fY));
}
for (const auto& line : kLines) {
SkScalar w = SkScalarAbs(line.fA.fX - line.fB.fX);
diff --git a/gm/dftext_blob_persp.cpp b/gm/dftext_blob_persp.cpp
index 5c42218..9c38221 100644
--- a/gm/dftext_blob_persp.cpp
+++ b/gm/dftext_blob_persp.cpp
@@ -90,7 +90,7 @@
}
this->drawBlob(canvas, blob.get(), SK_ColorBLACK, x, y + h, pm, twm);
x += w + 20.f;
- maxH = SkTMax(h, maxH);
+ maxH = std::max(h, maxH);
canvas->restore();
}
}
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index e349bbf..d447c69 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -140,8 +140,8 @@
// Compute a conservative bounds so we can cull the draw
const SkRect fontb = SkFontPriv::GetFontBounds(font);
- const SkScalar max = SkTMax(SkTMax(SkScalarAbs(fontb.fLeft), SkScalarAbs(fontb.fRight)),
- SkTMax(SkScalarAbs(fontb.fTop), SkScalarAbs(fontb.fBottom)));
+ const SkScalar max = std::max(std::max(SkScalarAbs(fontb.fLeft), SkScalarAbs(fontb.fRight)),
+ std::max(SkScalarAbs(fontb.fTop), SkScalarAbs(fontb.fBottom)));
const SkRect bounds = path.getBounds().makeOutset(max, max);
SkAutoTArray<SkGlyphID> glyphs(count);
diff --git a/gm/drawimageset.cpp b/gm/drawimageset.cpp
index d99c3c3..345b5a9 100644
--- a/gm/drawimageset.cpp
+++ b/gm/drawimageset.cpp
@@ -239,7 +239,7 @@
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setBlendMode(SkBlendMode::kSrcOver);
- static constexpr SkScalar kTranslate = SkTMax(kW, kH) * 2.f + 10.f;
+ static constexpr SkScalar kTranslate = std::max(kW, kH) * 2.f + 10.f;
canvas->translate(5.f, 5.f);
canvas->save();
for (SkScalar frac : {0.f, 0.5f}) {
diff --git a/gm/hsl.cpp b/gm/hsl.cpp
index 5c936f2..987aefb 100644
--- a/gm/hsl.cpp
+++ b/gm/hsl.cpp
@@ -42,8 +42,8 @@
//
// I think the KHR version is just wrong... it produces values >1. So we use the web version.
-static float min(float r, float g, float b) { return SkTMin(r, SkTMin(g, b)); }
-static float max(float r, float g, float b) { return SkTMax(r, SkTMax(g, b)); }
+static float min(float r, float g, float b) { return std::min(r, std::min(g, b)); }
+static float max(float r, float g, float b) { return std::max(r, std::max(g, b)); }
static float sat(float r, float g, float b) { return max(r,g,b) - min(r,g,b); }
static float lum(float r, float g, float b) { return r*0.30f + g*0.59f + b*0.11f; }
diff --git a/gm/polygonoffset.cpp b/gm/polygonoffset.cpp
index 9f906ac..5210145 100644
--- a/gm/polygonoffset.cpp
+++ b/gm/polygonoffset.cpp
@@ -495,7 +495,7 @@
int numPtsArray[] = { 5, 7, 8, 20, 100 };
size_t arrayIndex = index - SK_ARRAY_COUNT(PolygonOffsetData::gSimplePoints);
- arrayIndex = SkTMin(arrayIndex, SK_ARRAY_COUNT(numPtsArray) - 1);
+ arrayIndex = std::min(arrayIndex, SK_ARRAY_COUNT(numPtsArray) - 1);
SkASSERT(arrayIndex < SK_ARRAY_COUNT(numPtsArray));
*numPts = numPtsArray[arrayIndex];
// squash horizontally
diff --git a/gm/repeated_bitmap.cpp b/gm/repeated_bitmap.cpp
index cc9c4dd..a35ca24 100644
--- a/gm/repeated_bitmap.cpp
+++ b/gm/repeated_bitmap.cpp
@@ -28,7 +28,7 @@
SkRect rect = SkRect::MakeLTRB(-68.0f, -68.0f, 68.0f, 68.0f);
SkPaint paint;
paint.setColor(SkColorSetRGB(49, 48, 49));
- SkScalar scale = SkTMin(128.0f / image->width(),
+ SkScalar scale = std::min(128.0f / image->width(),
128.0f / image->height());
SkScalar point[2] = {-0.5f * image->width(), -0.5f * image->height()};
for (int j = 0; j < 4; ++j) {
diff --git a/gm/shadowutils.cpp b/gm/shadowutils.cpp
index 2d4e91e..9ea42a7 100644
--- a/gm/shadowutils.cpp
+++ b/gm/shadowutils.cpp
@@ -156,7 +156,7 @@
canvas->translate(dx, 0);
x += dx;
- dy = SkTMax(dy, postMBounds.height() + kPad + kHeight);
+ dy = std::max(dy, postMBounds.height() + kPad + kHeight);
++pathCounter;
}
}
@@ -207,7 +207,7 @@
canvas->translate(dx, 0);
x += dx;
- dy = SkTMax(dy, postMBounds.height() + kPad + kHeight);
+ dy = std::max(dy, postMBounds.height() + kPad + kHeight);
}
}
diff --git a/gm/shapes.cpp b/gm/shapes.cpp
index edfe4bd..33fc99a 100644
--- a/gm/shapes.cpp
+++ b/gm/shapes.cpp
@@ -139,7 +139,7 @@
for (int i = 0; i < fShapes.count(); i++) {
const SkRRect& outer = fShapes[i];
const SkRRect& inner = fShapes[(i * 7 + 11) % fSimpleShapeCount];
- float s = 0.95f * SkTMin(outer.rect().width() / inner.rect().width(),
+ float s = 0.95f * std::min(outer.rect().width() / inner.rect().width(),
outer.rect().height() / inner.rect().height());
SkMatrix innerXform;
float dx = (rand.nextF() - 0.5f) * (outer.rect().width() - s * inner.rect().width());
diff --git a/gm/sharedcorners.cpp b/gm/sharedcorners.cpp
index 88323b8..e9f8716 100644
--- a/gm/sharedcorners.cpp
+++ b/gm/sharedcorners.cpp
@@ -120,7 +120,7 @@
path.lineTo(points[triangle[2]]);
path.close();
}
- SkScalar scale = kBoxSize / SkTMax(path.getBounds().height(), path.getBounds().width());
+ SkScalar scale = kBoxSize / std::max(path.getBounds().height(), path.getBounds().width());
path.transform(SkMatrix::MakeScale(scale, scale));
this->drawRow(canvas, path);
diff --git a/gm/trickycubicstrokes.cpp b/gm/trickycubicstrokes.cpp
index 813116d..a79de16 100644
--- a/gm/trickycubicstrokes.cpp
+++ b/gm/trickycubicstrokes.cpp
@@ -35,10 +35,10 @@
static SkRect calc_tight_cubic_bounds(const SkPoint P[4], int depth=5) {
if (0 == depth) {
SkRect bounds;
- bounds.fLeft = SkTMin(SkTMin(P[0].x(), P[1].x()), SkTMin(P[2].x(), P[3].x()));
- bounds.fTop = SkTMin(SkTMin(P[0].y(), P[1].y()), SkTMin(P[2].y(), P[3].y()));
- bounds.fRight = SkTMax(SkTMax(P[0].x(), P[1].x()), SkTMax(P[2].x(), P[3].x()));
- bounds.fBottom = SkTMax(SkTMax(P[0].y(), P[1].y()), SkTMax(P[2].y(), P[3].y()));
+ bounds.fLeft = std::min(std::min(P[0].x(), P[1].x()), std::min(P[2].x(), P[3].x()));
+ bounds.fTop = std::min(std::min(P[0].y(), P[1].y()), std::min(P[2].y(), P[3].y()));
+ bounds.fRight = std::max(std::max(P[0].x(), P[1].x()), std::max(P[2].x(), P[3].x()));
+ bounds.fBottom = std::max(std::max(P[0].y(), P[1].y()), std::max(P[2].y(), P[3].y()));
return bounds;
}
diff --git a/gm/typeface.cpp b/gm/typeface.cpp
index c9f11a3..58139b5 100644
--- a/gm/typeface.cpp
+++ b/gm/typeface.cpp
@@ -252,7 +252,7 @@
SkScalar dx = SkScalarCeilToScalar(
font.measureText(&character, 1, SkTextEncoding::kUTF8)) + 5;
x += dx;
- xMax = SkTMax(x, xMax);
+ xMax = std::max(x, xMax);
}
}
}
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index f0033a1..c32655e 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -584,18 +584,10 @@
return value;
}
-template <typename T> constexpr const T& SkTMin(const T& a, const T& b) {
- return (a < b) ? a : b;
-}
-
-template <typename T> constexpr const T& SkTMax(const T& a, const T& b) {
- return (b < a) ? a : b;
-}
-
/** @return value pinned (clamped) between min and max, inclusively.
*/
template <typename T> static constexpr const T& SkTPin(const T& value, const T& min, const T& max) {
- return SkTMax(SkTMin(value, max), min);
+ return value < min ? min : (value < max ? value : max);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/include/core/SkYUVAIndex.h b/include/core/SkYUVAIndex.h
index 310c975..4a46f34 100644
--- a/include/core/SkYUVAIndex.h
+++ b/include/core/SkYUVAIndex.h
@@ -61,7 +61,7 @@
} else if (yuvaIndices[i].fIndex > 3) {
valid = false; // A maximum of four input textures is allowed
} else {
- maxSlotUsed = SkTMax(yuvaIndices[i].fIndex, maxSlotUsed);
+ maxSlotUsed = std::max(yuvaIndices[i].fIndex, maxSlotUsed);
used[i] = true;
}
}
diff --git a/include/private/SkFloatingPoint.h b/include/private/SkFloatingPoint.h
index f0ca4bb..0c49860 100644
--- a/include/private/SkFloatingPoint.h
+++ b/include/private/SkFloatingPoint.h
@@ -118,8 +118,8 @@
* Return the closest int for the given float. Returns SK_MaxS32FitsInFloat for NaN.
*/
static inline int sk_float_saturate2int(float x) {
- x = SkTMin<float>(x, SK_MaxS32FitsInFloat);
- x = SkTMax<float>(x, SK_MinS32FitsInFloat);
+ x = x < SK_MaxS32FitsInFloat ? x : SK_MaxS32FitsInFloat;
+ x = x > SK_MinS32FitsInFloat ? x : SK_MinS32FitsInFloat;
return (int)x;
}
@@ -127,8 +127,8 @@
* Return the closest int for the given double. Returns SK_MaxS32 for NaN.
*/
static inline int sk_double_saturate2int(double x) {
- x = SkTMin<double>(x, SK_MaxS32);
- x = SkTMax<double>(x, SK_MinS32);
+ x = x < SK_MaxS32 ? x : SK_MaxS32;
+ x = x > SK_MinS32 ? x : SK_MinS32;
return (int)x;
}
@@ -136,8 +136,8 @@
* Return the closest int64_t for the given float. Returns SK_MaxS64FitsInFloat for NaN.
*/
static inline int64_t sk_float_saturate2int64(float x) {
- x = SkTMin<float>(x, SK_MaxS64FitsInFloat);
- x = SkTMax<float>(x, SK_MinS64FitsInFloat);
+ x = x < SK_MaxS64FitsInFloat ? x : SK_MaxS64FitsInFloat;
+ x = x > SK_MinS64FitsInFloat ? x : SK_MinS64FitsInFloat;
return (int64_t)x;
}
diff --git a/include/private/SkNx.h b/include/private/SkNx.h
index 240f4f4..67a68e8 100644
--- a/include/private/SkNx.h
+++ b/include/private/SkNx.h
@@ -105,8 +105,8 @@
Half::Store2(ptr + 2*N/2*sizeof(T), a.fHi, b.fHi);
}
- AI T min() const { return SkTMin(fLo.min(), fHi.min()); }
- AI T max() const { return SkTMax(fLo.max(), fHi.max()); }
+ AI T min() const { return std::min(fLo.min(), fHi.min()); }
+ AI T max() const { return std::max(fLo.max(), fHi.max()); }
AI bool anyTrue() const { return fLo.anyTrue() || fHi.anyTrue(); }
AI bool allTrue() const { return fLo.allTrue() && fHi.allTrue(); }
diff --git a/include/private/SkNx_neon.h b/include/private/SkNx_neon.h
index e702aef..6484fcf 100644
--- a/include/private/SkNx_neon.h
+++ b/include/private/SkNx_neon.h
@@ -267,7 +267,7 @@
return vminvq_f32(fVec);
#else
SkNx min = Min(*this, vrev64q_f32(fVec));
- return SkTMin(min[0], min[2]);
+ return std::min(min[0], min[2]);
#endif
}
@@ -276,7 +276,7 @@
return vmaxvq_f32(fVec);
#else
SkNx max = Max(*this, vrev64q_f32(fVec));
- return SkTMax(max[0], max[2]);
+ return std::max(max[0], max[2]);
#endif
}
diff --git a/include/private/SkSemaphore.h b/include/private/SkSemaphore.h
index e4ca9e8..265847b 100644
--- a/include/private/SkSemaphore.h
+++ b/include/private/SkSemaphore.h
@@ -11,6 +11,7 @@
#include "include/core/SkTypes.h"
#include "include/private/SkOnce.h"
#include "include/private/SkThreadAnnotations.h"
+#include <algorithm>
#include <atomic>
class SkSemaphore {
@@ -59,11 +60,11 @@
//
// This is easiest to think about with specific examples of prev and n.
// If n == 5 and prev == -3, there are 3 threads sleeping and we signal
- // SkTMin(-(-3), 5) == 3 times on the OS semaphore, leaving the count at 2.
+ // std::min(-(-3), 5) == 3 times on the OS semaphore, leaving the count at 2.
//
- // If prev >= 0, no threads are waiting, SkTMin(-prev, n) is always <= 0,
+ // If prev >= 0, no threads are waiting, std::min(-prev, n) is always <= 0,
// so we don't call the OS semaphore, leaving the count at (prev + n).
- int toSignal = SkTMin(-prev, n);
+ int toSignal = std::min(-prev, n);
if (toSignal > 0) {
this->osSignal(toSignal);
}
diff --git a/include/private/SkTArray.h b/include/private/SkTArray.h
index 3b437bb..8cf34d1 100644
--- a/include/private/SkTArray.h
+++ b/include/private/SkTArray.h
@@ -454,7 +454,7 @@
fOwnMemory = true;
fReserved = false;
} else {
- fAllocCount = SkTMax(count, SkTMax(kMinHeapAllocCount, reserveCount));
+ fAllocCount = std::max(count, std::max(kMinHeapAllocCount, reserveCount));
fItemArray = (T*)sk_malloc_throw(fAllocCount, sizeof(T));
fOwnMemory = true;
fReserved = reserveCount > 0;
@@ -469,7 +469,7 @@
fItemArray = nullptr;
fReserved = false;
if (count > preallocCount) {
- fAllocCount = SkTMax(count, kMinHeapAllocCount);
+ fAllocCount = std::max(count, kMinHeapAllocCount);
fItemArray = (T*)sk_malloc_throw(fAllocCount, sizeof(T));
fOwnMemory = true;
} else {
diff --git a/modules/particles/src/SkParticleDrawable.cpp b/modules/particles/src/SkParticleDrawable.cpp
index 1967484..7dbe97f 100644
--- a/modules/particles/src/SkParticleDrawable.cpp
+++ b/modules/particles/src/SkParticleDrawable.cpp
@@ -78,7 +78,7 @@
void draw(SkCanvas* canvas, const SkParticles& particles, int count,
const SkPaint& paint) override {
- int r = SkTMax(fRadius, 1);
+ int r = std::max(fRadius, 1);
SkPoint center = { SkIntToScalar(r), SkIntToScalar(r) };
DrawAtlasArrays arrays(particles, count, center);
for (int i = 0; i < count; ++i) {
@@ -89,7 +89,7 @@
}
void prepare(const skresources::ResourceProvider*) override {
- int r = SkTMax(fRadius, 1);
+ int r = std::max(fRadius, 1);
if (!fImage || fImage->width() != 2 * r) {
fImage = make_circle_image(r);
}
@@ -119,8 +119,8 @@
void draw(SkCanvas* canvas, const SkParticles& particles, int count,
const SkPaint& paint) override {
- int cols = SkTMax(fCols, 1),
- rows = SkTMax(fRows, 1);
+ int cols = std::max(fCols, 1),
+ rows = std::max(fRows, 1);
SkRect baseRect = SkRect::MakeWH(static_cast<float>(fImage->width()) / cols,
static_cast<float>(fImage->height()) / rows);
SkPoint center = { baseRect.width() * 0.5f, baseRect.height() * 0.5f };
diff --git a/modules/particles/src/SkParticleEffect.cpp b/modules/particles/src/SkParticleEffect.cpp
index ab4e4e1..02e2e15 100644
--- a/modules/particles/src/SkParticleEffect.cpp
+++ b/modules/particles/src/SkParticleEffect.cpp
@@ -494,7 +494,7 @@
fStableRandoms.realloc(capacity);
fCapacity = capacity;
- fCount = SkTMin(fCount, fCapacity);
+ fCount = std::min(fCount, fCapacity);
}
void SkParticleEffect::RegisterParticleTypes() {
diff --git a/modules/skottie/src/Animator.cpp b/modules/skottie/src/Animator.cpp
index dd436c6..afc2ddc 100644
--- a/modules/skottie/src/Animator.cpp
+++ b/modules/skottie/src/Animator.cpp
@@ -116,7 +116,7 @@
SkPoint prev_c0 = { 0, 0 },
prev_c1 = prev_c0;
- fRecs.reserve(SkTMax<size_t>(jframes.size(), 1) - 1);
+ fRecs.reserve(std::max<size_t>(jframes.size(), 1) - 1);
for (const skjson::ObjectValue* jframe : jframes) {
if (!jframe) continue;
diff --git a/modules/skottie/src/Camera.cpp b/modules/skottie/src/Camera.cpp
index 2f41449..eb7ead0 100644
--- a/modules/skottie/src/Camera.cpp
+++ b/modules/skottie/src/Camera.cpp
@@ -36,7 +36,7 @@
// * size -> composition size (TODO: AE seems to base it on width only?)
// * distance -> "zoom" camera attribute
//
- const auto view_size = SkTMax(viewport_size.width(), viewport_size.height()),
+ const auto view_size = std::max(viewport_size.width(), viewport_size.height()),
view_distance = zoom,
view_angle = std::atan(sk_ieee_float_divide(view_size * 0.5f, view_distance));
diff --git a/modules/skottie/src/Skottie.cpp b/modules/skottie/src/Skottie.cpp
index 7505f8e..d9de64c 100644
--- a/modules/skottie/src/Skottie.cpp
+++ b/modules/skottie/src/Skottie.cpp
@@ -378,7 +378,7 @@
ParseDefault<float>(json["h"], 0.0f));
const auto fps = ParseDefault<float>(json["fr"], -1.0f),
inPoint = ParseDefault<float>(json["ip"], 0.0f),
- outPoint = SkTMax(ParseDefault<float>(json["op"], SK_ScalarMax), inPoint),
+ outPoint = std::max(ParseDefault<float>(json["op"], SK_ScalarMax), inPoint),
duration = sk_ieee_float_divide(outPoint - inPoint, fps);
if (size.isEmpty() || version.isEmpty() || fps <= 0 ||
diff --git a/modules/skottie/src/layers/shapelayer/FillStroke.cpp b/modules/skottie/src/layers/shapelayer/FillStroke.cpp
index 8dc1576..d7301df 100644
--- a/modules/skottie/src/layers/shapelayer/FillStroke.cpp
+++ b/modules/skottie/src/layers/shapelayer/FillStroke.cpp
@@ -47,7 +47,7 @@
SkPaint::kBevel_Join,
};
this->node()->setStrokeJoin(
- gJoins[SkTMin<size_t>(ParseDefault<size_t>(jpaint["lj"], 1) - 1,
+ gJoins[std::min<size_t>(ParseDefault<size_t>(jpaint["lj"], 1) - 1,
SK_ARRAY_COUNT(gJoins) - 1)]);
static constexpr SkPaint::Cap gCaps[] = {
@@ -56,7 +56,7 @@
SkPaint::kSquare_Cap,
};
this->node()->setStrokeCap(
- gCaps[SkTMin<size_t>(ParseDefault<size_t>(jpaint["lc"], 1) - 1,
+ gCaps[std::min<size_t>(ParseDefault<size_t>(jpaint["lc"], 1) - 1,
SK_ARRAY_COUNT(gCaps) - 1)]);
}
diff --git a/modules/skottie/src/layers/shapelayer/MergePaths.cpp b/modules/skottie/src/layers/shapelayer/MergePaths.cpp
index 5ced51a..e2e41d6 100644
--- a/modules/skottie/src/layers/shapelayer/MergePaths.cpp
+++ b/modules/skottie/src/layers/shapelayer/MergePaths.cpp
@@ -38,7 +38,7 @@
sksg::Merge::Mode::kXOR , // "mm": 5
};
- const auto mode = gModes[SkTMin<size_t>(ParseDefault<size_t>(jmerge["mm"], 1) - 1,
+ const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jmerge["mm"], 1) - 1,
SK_ARRAY_COUNT(gModes) - 1)];
std::vector<sk_sp<sksg::GeometryNode>> merged;
diff --git a/modules/skottie/src/layers/shapelayer/TrimPaths.cpp b/modules/skottie/src/layers/shapelayer/TrimPaths.cpp
index a96aecc..8817db7 100644
--- a/modules/skottie/src/layers/shapelayer/TrimPaths.cpp
+++ b/modules/skottie/src/layers/shapelayer/TrimPaths.cpp
@@ -38,8 +38,8 @@
end = fEnd / 100,
offset = fOffset / 360;
- auto startT = SkTMin(start, end) + offset,
- stopT = SkTMax(start, end) + offset;
+ auto startT = std::min(start, end) + offset,
+ stopT = std::max(start, end) + offset;
auto mode = SkTrimPathEffect::Mode::kNormal;
if (stopT - startT < 1) {
@@ -80,7 +80,7 @@
kSerial, // "m": 2 (Trim Multiple Shapes: Individually)
} gModes[] = { Mode::kParallel, Mode::kSerial};
- const auto mode = gModes[SkTMin<size_t>(ParseDefault<size_t>(jtrim["m"], 1) - 1,
+ const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jtrim["m"], 1) - 1,
SK_ARRAY_COUNT(gModes) - 1)];
std::vector<sk_sp<sksg::GeometryNode>> inputs;
diff --git a/modules/skottie/src/text/SkottieShaper.cpp b/modules/skottie/src/text/SkottieShaper.cpp
index 77353c1..cef7525 100644
--- a/modules/skottie/src/text/SkottieShaper.cpp
+++ b/modules/skottie/src/text/SkottieShaper.cpp
@@ -82,9 +82,9 @@
SkFontMetrics metrics;
info.fFont.getMetrics(&metrics);
if (!fLineCount) {
- fFirstLineAscent = SkTMin(fFirstLineAscent, metrics.fAscent);
+ fFirstLineAscent = std::min(fFirstLineAscent, metrics.fAscent);
}
- fLastLineDescent = SkTMax(fLastLineDescent, metrics.fDescent);
+ fLastLineDescent = std::max(fLastLineDescent, metrics.fDescent);
}
void commitRunInfo() override {}
diff --git a/modules/skottie/src/text/TextValue.cpp b/modules/skottie/src/text/TextValue.cpp
index b7361b1..5829dd1 100644
--- a/modules/skottie/src/text/TextValue.cpp
+++ b/modules/skottie/src/text/TextValue.cpp
@@ -47,7 +47,7 @@
SkTextUtils::kRight_Align, // 'j': 1
SkTextUtils::kCenter_Align // 'j': 2
};
- v->fHAlign = gAlignMap[SkTMin<size_t>(ParseDefault<size_t>((*jtxt)["j"], 0),
+ v->fHAlign = gAlignMap[std::min<size_t>(ParseDefault<size_t>((*jtxt)["j"], 0),
SK_ARRAY_COUNT(gAlignMap))];
// Optional text box size.
@@ -72,7 +72,7 @@
Shaper::ResizePolicy::kScaleToFit, // 'sk_rs': 1
Shaper::ResizePolicy::kDownscaleToFit, // 'sk_rs': 2
};
- v->fResize = gResizeMap[SkTMin<size_t>(ParseDefault<size_t>((*jtxt)["sk_rs"], 0),
+ v->fResize = gResizeMap[std::min<size_t>(ParseDefault<size_t>((*jtxt)["sk_rs"], 0),
SK_ARRAY_COUNT(gResizeMap))];
// In point mode, the text is baseline-aligned.
diff --git a/modules/skparagraph/include/DartTypes.h b/modules/skparagraph/include/DartTypes.h
index 69659cf..1362a68 100644
--- a/modules/skparagraph/include/DartTypes.h
+++ b/modules/skparagraph/include/DartTypes.h
@@ -96,7 +96,7 @@
}
bool intersects(SkRange<size_t> other) const {
- return SkTMax(start, other.start) <= SkTMin(end, other.end);
+ return std::max(start, other.start) <= std::min(end, other.end);
}
bool empty() const {
diff --git a/modules/skparagraph/src/OneLineShaper.cpp b/modules/skparagraph/src/OneLineShaper.cpp
index b28a80a..00257ee 100644
--- a/modules/skparagraph/src/OneLineShaper.cpp
+++ b/modules/skparagraph/src/OneLineShaper.cpp
@@ -275,8 +275,8 @@
} else if (lastUnresolved.fText.intersects(unresolved.fText)) {
// Few pieces of the same unresolved text block can ignore the second one
lastUnresolved.fGlyphs.start =
- SkTMin(lastUnresolved.fGlyphs.start, glyphRange.start);
- lastUnresolved.fGlyphs.end = SkTMax(lastUnresolved.fGlyphs.end, glyphRange.end);
+ std::min(lastUnresolved.fGlyphs.start, glyphRange.start);
+ lastUnresolved.fGlyphs.end = std::max(lastUnresolved.fGlyphs.end, glyphRange.end);
lastUnresolved.fText = clusteredText(lastUnresolved.fGlyphs);
return;
}
@@ -361,7 +361,7 @@
};
for (auto& block : styleSpan) {
- BlockRange blockRange(SkTMax(block.fRange.start, textRange.start), SkTMin(block.fRange.end, textRange.end));
+ BlockRange blockRange(std::max(block.fRange.start, textRange.start), std::min(block.fRange.end, textRange.end));
if (blockRange.empty()) {
continue;
}
@@ -433,8 +433,8 @@
// Shape the text by bidi regions
while (bidiIndex < bidiRegions.size()) {
BidiRegion& bidiRegion = bidiRegions[bidiIndex];
- auto start = SkTMax(bidiRegion.text.start, placeholder.fTextBefore.start);
- auto end = SkTMin(bidiRegion.text.end, placeholder.fTextBefore.end);
+ auto start = std::max(bidiRegion.text.start, placeholder.fTextBefore.start);
+ auto end = std::min(bidiRegion.text.end, placeholder.fTextBefore.end);
// Set up the iterators (the style iterator points to a bigger region that it could
TextRange textRange(start, end);
diff --git a/modules/skparagraph/src/ParagraphImpl.cpp b/modules/skparagraph/src/ParagraphImpl.cpp
index 66a20de..954ee4d 100644
--- a/modules/skparagraph/src/ParagraphImpl.cpp
+++ b/modules/skparagraph/src/ParagraphImpl.cpp
@@ -36,8 +36,8 @@
TextRange operator*(const TextRange& a, const TextRange& b) {
if (a.start == b.start && a.end == b.end) return a;
- auto begin = SkTMax(a.start, b.start);
- auto end = SkTMin(a.end, b.end);
+ auto begin = std::max(a.start, b.start);
+ auto end = std::min(a.end, b.end);
return end > begin ? TextRange(begin, end) : EMPTY_TEXT;
}
@@ -414,7 +414,7 @@
}
}
- fLongestLine = SkTMax(fLongestLine, nearlyZero(advance.fX) ? widthWithSpaces : advance.fX);
+ fLongestLine = std::max(fLongestLine, nearlyZero(advance.fX) ? widthWithSpaces : advance.fX);
});
fHeight = textWrapper.height();
fWidth = maxWidth;
@@ -787,8 +787,8 @@
(nearlyEqual(lastBox.rect.fLeft, clip.fRight) ||
nearlyEqual(lastBox.rect.fRight, clip.fLeft)))
{
- lastBox.rect.fLeft = SkTMin(lastBox.rect.fLeft, clip.fLeft);
- lastBox.rect.fRight = SkTMax(lastBox.rect.fRight, clip.fRight);
+ lastBox.rect.fLeft = std::min(lastBox.rect.fLeft, clip.fLeft);
+ lastBox.rect.fRight = std::max(lastBox.rect.fRight, clip.fRight);
mergedBoxes = true;
}
}
diff --git a/modules/skparagraph/src/Run.cpp b/modules/skparagraph/src/Run.cpp
index bc1618e..4214099 100644
--- a/modules/skparagraph/src/Run.cpp
+++ b/modules/skparagraph/src/Run.cpp
@@ -334,7 +334,7 @@
// Find the width until the pos and return the min between trimmedWidth and the width(pos)
// We don't have to take in account cluster shift since it's the same for 0 and for pos
auto& run = fMaster->run(fRunIndex);
- return SkTMin(run.positionX(pos) - run.positionX(fStart), fWidth - fSpacing);
+ return std::min(run.positionX(pos) - run.positionX(fStart), fWidth - fSpacing);
}
SkScalar Run::positionX(size_t pos) const {
diff --git a/modules/skparagraph/src/Run.h b/modules/skparagraph/src/Run.h
index 3cc5d38..4aa93c6 100644
--- a/modules/skparagraph/src/Run.h
+++ b/modules/skparagraph/src/Run.h
@@ -353,15 +353,15 @@
return;
}
- fAscent = SkTMin(fAscent, run->correctAscent());
- fDescent = SkTMax(fDescent, run->correctDescent());
- fLeading = SkTMax(fLeading, run->correctLeading());
+ fAscent = std::min(fAscent, run->correctAscent());
+ fDescent = std::max(fDescent, run->correctDescent());
+ fLeading = std::max(fLeading, run->correctLeading());
}
void add(InternalLineMetrics other) {
- fAscent = SkTMin(fAscent, other.fAscent);
- fDescent = SkTMax(fDescent, other.fDescent);
- fLeading = SkTMax(fLeading, other.fLeading);
+ fAscent = std::min(fAscent, other.fAscent);
+ fDescent = std::max(fDescent, other.fDescent);
+ fLeading = std::max(fLeading, other.fLeading);
}
void clean() {
fAscent = 0;
@@ -378,8 +378,8 @@
metrics.fLeading = fLeading;
} else {
// This is another of those flutter changes. To be removed...
- metrics.fAscent = SkTMin(metrics.fAscent, fAscent - fLeading / 2.0f);
- metrics.fDescent = SkTMax(metrics.fDescent, fDescent + fLeading / 2.0f);
+ metrics.fAscent = std::min(metrics.fAscent, fAscent - fLeading / 2.0f);
+ metrics.fDescent = std::max(metrics.fDescent, fDescent + fLeading / 2.0f);
}
}
diff --git a/modules/skparagraph/src/TextLine.cpp b/modules/skparagraph/src/TextLine.cpp
index 25af76d..262f888 100644
--- a/modules/skparagraph/src/TextLine.cpp
+++ b/modules/skparagraph/src/TextLine.cpp
@@ -16,8 +16,8 @@
// TODO: deal with all the intersection functionality
TextRange intersected(const TextRange& a, const TextRange& b) {
if (a.start == b.start && a.end == b.end) return a;
- auto begin = SkTMax(a.start, b.start);
- auto end = SkTMin(a.end, b.end);
+ auto begin = std::max(a.start, b.start);
+ auto end = std::min(a.end, b.end);
return end >= begin ? TextRange(begin, end) : EMPTY_TEXT;
}
@@ -32,7 +32,7 @@
// Canvas scaling affects it
// Letter spacing affects it
// It has to be relative to be useful
- auto base = SkTMax(SkScalarAbs(a), SkScalarAbs(b));
+ auto base = std::max(SkScalarAbs(a), SkScalarAbs(b));
auto diff = SkScalarAbs(a - b);
if (nearlyZero(base) || diff / base < 0.001f) {
return 0;
@@ -294,7 +294,7 @@
SkRect TextLine::extendHeight(const ClipContext& context) const {
SkRect result = context.clip;
- result.fBottom += SkTMax(this->fMaxRunMetrics.height() - this->height(), 0.0f);
+ result.fBottom += std::max(this->fMaxRunMetrics.height() - this->height(), 0.0f);
return result;
}
@@ -741,9 +741,9 @@
for (size_t r = 0; r != fRunsInVisualOrder.size(); ++r) {
auto& runIndex = fRunsInVisualOrder[reverse ? fRunsInVisualOrder.size() - r - 1 : r];
auto run = this->fMaster->runs().begin() + runIndex;
- auto start = SkTMax(run->clusterRange().start, fClusterRange.start);
- auto end = SkTMin(run->clusterRange().end, fClusterRange.end);
- auto ghosts = SkTMin(run->clusterRange().end, fGhostClusterRange.end);
+ auto start = std::max(run->clusterRange().start, fClusterRange.start);
+ auto end = std::min(run->clusterRange().end, fClusterRange.end);
+ auto ghosts = std::min(run->clusterRange().end, fGhostClusterRange.end);
if (run->leftToRight() != reverse) {
for (auto index = start; index < ghosts; ++index) {
diff --git a/modules/skparagraph/src/TextWrapper.cpp b/modules/skparagraph/src/TextWrapper.cpp
index 8d3f163..166d718 100644
--- a/modules/skparagraph/src/TextWrapper.cpp
+++ b/modules/skparagraph/src/TextWrapper.cpp
@@ -31,7 +31,7 @@
if (cluster->isWhitespaces()) {
// It's the end of the word
fClusters.extend(cluster);
- fMinIntrinsicWidth = SkTMax(fMinIntrinsicWidth, getClustersTrimmedWidth());
+ fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, getClustersTrimmedWidth());
fWords.extend(fClusters);
break;
}
@@ -46,7 +46,7 @@
}
if (nextWordLength > maxWidth) {
// If the word is too long we can break it right now and hope it's enough
- fMinIntrinsicWidth = SkTMax(fMinIntrinsicWidth, nextWordLength);
+ fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, nextWordLength);
fTooLongWord = true;
}
@@ -62,7 +62,7 @@
// Keep adding clusters/words
if (fClusters.endOfWord()) {
- fMinIntrinsicWidth = SkTMax(fMinIntrinsicWidth, getClustersTrimmedWidth());
+ fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, getClustersTrimmedWidth());
fWords.extend(fClusters);
}
@@ -289,15 +289,15 @@
while (cluster != end || cluster->endPos() < end->endPos()) {
fExceededMaxLines = true;
if (cluster->isHardBreak()) {
- fMaxIntrinsicWidth = SkTMax(fMaxIntrinsicWidth, softLineMaxIntrinsicWidth);
+ fMaxIntrinsicWidth = std::max(fMaxIntrinsicWidth, softLineMaxIntrinsicWidth);
softLineMaxIntrinsicWidth = 0;
- fMinIntrinsicWidth = SkTMax(fMinIntrinsicWidth, lastWordLength);
+ fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, lastWordLength);
lastWordLength = 0;
} else if (cluster->isWhitespaces()) {
SkASSERT(cluster->isWhitespaces());
softLineMaxIntrinsicWidth += cluster->width();
- fMinIntrinsicWidth = SkTMax(fMinIntrinsicWidth, lastWordLength);
+ fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, lastWordLength);
lastWordLength = 0;
} else {
softLineMaxIntrinsicWidth += cluster->width();
@@ -305,10 +305,10 @@
}
++cluster;
}
- fMinIntrinsicWidth = SkTMax(fMinIntrinsicWidth, lastWordLength);
- fMaxIntrinsicWidth = SkTMax(fMaxIntrinsicWidth, softLineMaxIntrinsicWidth);
+ fMinIntrinsicWidth = std::max(fMinIntrinsicWidth, lastWordLength);
+ fMaxIntrinsicWidth = std::max(fMaxIntrinsicWidth, softLineMaxIntrinsicWidth);
// In case we could not place a single cluster on the line
- fHeight = SkTMax(fHeight, fEndLine.metrics().height());
+ fHeight = std::max(fHeight, fEndLine.metrics().height());
}
if (fHardLineBreak) {
diff --git a/modules/skplaintexteditor/src/shape.cpp b/modules/skplaintexteditor/src/shape.cpp
index 9acba0d..d37350b 100644
--- a/modules/skplaintexteditor/src/shape.cpp
+++ b/modules/skplaintexteditor/src/shape.cpp
@@ -100,9 +100,9 @@
void RunHandler::runInfo(const SkShaper::RunHandler::RunInfo& info) {
SkFontMetrics metrics;
info.fFont.getMetrics(&metrics);
- fMaxRunAscent = SkTMin(fMaxRunAscent, metrics.fAscent);
- fMaxRunDescent = SkTMax(fMaxRunDescent, metrics.fDescent);
- fMaxRunLeading = SkTMax(fMaxRunLeading, metrics.fLeading);
+ fMaxRunAscent = std::min(fMaxRunAscent, metrics.fAscent);
+ fMaxRunDescent = std::max(fMaxRunDescent, metrics.fDescent);
+ fMaxRunLeading = std::max(fMaxRunLeading, metrics.fLeading);
}
void RunHandler::commitRunInfo() {
@@ -154,7 +154,7 @@
fClusters[i] -= fClusterOffset;
}
fCurrentPosition += info.fAdvance;
- fTextOffset = SkTMax(fTextOffset, info.utf8Range.end());
+ fTextOffset = std::max(fTextOffset, info.utf8Range.end());
}
void RunHandler::commitLine() {
diff --git a/modules/skshaper/src/SkShaper.cpp b/modules/skshaper/src/SkShaper.cpp
index 4ef76e8..5ab3a04 100644
--- a/modules/skshaper/src/SkShaper.cpp
+++ b/modules/skshaper/src/SkShaper.cpp
@@ -191,9 +191,9 @@
void SkTextBlobBuilderRunHandler::runInfo(const RunInfo& info) {
SkFontMetrics metrics;
info.fFont.getMetrics(&metrics);
- fMaxRunAscent = SkTMin(fMaxRunAscent, metrics.fAscent);
- fMaxRunDescent = SkTMax(fMaxRunDescent, metrics.fDescent);
- fMaxRunLeading = SkTMax(fMaxRunLeading, metrics.fLeading);
+ fMaxRunAscent = std::min(fMaxRunAscent, metrics.fAscent);
+ fMaxRunDescent = std::max(fMaxRunDescent, metrics.fDescent);
+ fMaxRunLeading = std::max(fMaxRunLeading, metrics.fLeading);
}
void SkTextBlobBuilderRunHandler::commitRunInfo() {
diff --git a/samplecode/PerlinPatch.cpp b/samplecode/PerlinPatch.cpp
index 43dce62..b0d526d 100644
--- a/samplecode/PerlinPatch.cpp
+++ b/samplecode/PerlinPatch.cpp
@@ -197,7 +197,7 @@
} else if (-2 == ptClick->fIndex) {
SkScalar yDiff = click->fCurr.fY - click->fPrev.fY;
fTexScale += yDiff / 10.0f;
- fTexScale = SkTMax(0.1f, SkTMin(20.f, fTexScale));
+ fTexScale = std::max(0.1f, std::min(20.f, fTexScale));
}
return true;
}
diff --git a/samplecode/SampleAAGeometry.cpp b/samplecode/SampleAAGeometry.cpp
index 4f5cdb8..6865f65 100644
--- a/samplecode/SampleAAGeometry.cpp
+++ b/samplecode/SampleAAGeometry.cpp
@@ -393,7 +393,7 @@
}
SkASSERT(x < w);
SkASSERT(y < h);
- distanceMap[y * w + x] = SkTMax(distanceMap[y * w + x], (uint8_t) byteCoverage);
+ distanceMap[y * w + x] = std::max(distanceMap[y * w + x], (uint8_t) byteCoverage);
}
static void filter_coverage(const uint8_t* map, int len, uint8_t min, uint8_t max,
@@ -918,7 +918,7 @@
bool scaleToFit() {
SkMatrix matrix;
SkRect bounds = fPath.getBounds();
- SkScalar scale = SkTMin(this->width() / bounds.width(), this->height() / bounds.height())
+ SkScalar scale = std::min(this->width() / bounds.width(), this->height() / bounds.height())
* 0.8f;
matrix.setScale(scale, scale, bounds.centerX(), bounds.centerY());
fPath.transform(matrix);
@@ -1226,16 +1226,16 @@
return -radius;
}
rotated.fY /= SkScalarSqrt(lenSq);
- return SkTMax(-radius, SkTMin(radius, rotated.fY));
+ return std::max(-radius, std::min(radius, rotated.fY));
}
// given a line, compute the interior and exterior gradient coverage
bool coverage(SkPoint s, SkPoint e, uint8_t* distanceMap, int w, int h) {
SkScalar radius = fWidthControl.fValLo;
- int minX = SkTMax(0, (int) (SkTMin(s.fX, e.fX) - radius));
- int minY = SkTMax(0, (int) (SkTMin(s.fY, e.fY) - radius));
- int maxX = SkTMin(w, (int) (SkTMax(s.fX, e.fX) + radius) + 1);
- int maxY = SkTMin(h, (int) (SkTMax(s.fY, e.fY) + radius) + 1);
+ int minX = std::max(0, (int) (std::min(s.fX, e.fX) - radius));
+ int minY = std::max(0, (int) (std::min(s.fY, e.fY) - radius));
+ int maxX = std::min(w, (int) (std::max(s.fX, e.fX) + radius) + 1);
+ int maxY = std::min(h, (int) (std::max(s.fY, e.fY) + radius) + 1);
for (int y = minY; y < maxY; ++y) {
for (int x = minX; x < maxX; ++x) {
SkScalar ptToLineDist = pt_to_line(s, e, x, y);
@@ -1571,7 +1571,7 @@
}
static SkScalar MapScreenYtoValue(int y, const UniControl& control) {
- return SkTMin(1.f, SkTMax(0.f,
+ return std::min(1.f, std::max(0.f,
SkIntToScalar(y) - control.fBounds.fTop) / control.fBounds.height())
* (control.fMax - control.fMin) + control.fMin;
}
@@ -1615,9 +1615,9 @@
case MyClick::kFilterControl: {
SkScalar val = MapScreenYtoValue(click->fCurr.fY, fFilterControl);
if (val - fFilterControl.fValLo < fFilterControl.fValHi - val) {
- fFilterControl.fValLo = SkTMax(0.f, val);
+ fFilterControl.fValLo = std::max(0.f, val);
} else {
- fFilterControl.fValHi = SkTMin(255.f, val);
+ fFilterControl.fValHi = std::min(255.f, val);
}
} break;
case MyClick::kResControl:
diff --git a/samplecode/SampleAndroidShadows.cpp b/samplecode/SampleAndroidShadows.cpp
index 11d4a57..d5f264c 100644
--- a/samplecode/SampleAndroidShadows.cpp
+++ b/samplecode/SampleAndroidShadows.cpp
@@ -191,55 +191,55 @@
paint.setColor(SK_ColorWHITE);
canvas->translate(200, 90);
- zPlaneParams.fZ = SkTMax(1.0f, 2 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 2 + fZDelta);
this->drawShadowedPath(canvas, fRRPath, zPlaneParams, paint, fAnimAlpha*kAmbientAlpha,
lightPos, kLightWidth, fAnimAlpha*kSpotAlpha);
paint.setColor(SK_ColorRED);
canvas->translate(250, 0);
- zPlaneParams.fZ = SkTMax(1.0f, 8 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 8 + fZDelta);
this->drawShadowedPath(canvas, fRectPath, zPlaneParams, paint, fAnimAlpha*kAmbientAlpha,
lightPos, kLightWidth, fAnimAlpha*kSpotAlpha);
paint.setColor(SK_ColorBLUE);
canvas->translate(-250, 110);
- zPlaneParams.fZ = SkTMax(1.0f, 12 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 12 + fZDelta);
this->drawShadowedPath(canvas, fCirclePath, zPlaneParams, paint, fAnimAlpha*kAmbientAlpha,
lightPos, kLightWidth, fAnimAlpha*0.5f);
paint.setColor(SK_ColorGREEN);
canvas->translate(250, 0);
- zPlaneParams.fZ = SkTMax(1.0f, 64 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 64 + fZDelta);
this->drawShadowedPath(canvas, fRRPath, zPlaneParams, paint, fAnimAlpha*kAmbientAlpha,
lightPos, kLightWidth, fAnimAlpha*kSpotAlpha);
paint.setColor(SK_ColorYELLOW);
canvas->translate(-250, 110);
- zPlaneParams.fZ = SkTMax(1.0f, 8 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 8 + fZDelta);
this->drawShadowedPath(canvas, fFunkyRRPath, zPlaneParams, paint, fAnimAlpha*kAmbientAlpha,
lightPos, kLightWidth, fAnimAlpha*kSpotAlpha);
paint.setColor(SK_ColorCYAN);
canvas->translate(250, 0);
- zPlaneParams.fZ = SkTMax(1.0f, 16 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 16 + fZDelta);
this->drawShadowedPath(canvas, fCubicPath, zPlaneParams, paint, fAnimAlpha*kAmbientAlpha,
lightPos, kLightWidth, fAnimAlpha*kSpotAlpha);
paint.setColor(SK_ColorWHITE);
canvas->translate(250, -180);
- zPlaneParams.fZ = SkTMax(1.0f, 8 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 8 + fZDelta);
this->drawShadowedPath(canvas, fStarPath, zPlaneParams, paint,
kAmbientAlpha, lightPos, kLightWidth, kSpotAlpha);
paint.setColor(SK_ColorWHITE);
canvas->translate(150, 0);
- zPlaneParams.fZ = SkTMax(1.0f, 2 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 2 + fZDelta);
this->drawShadowedPath(canvas, fNotchPath, zPlaneParams, paint,
kAmbientAlpha, lightPos, kLightWidth, kSpotAlpha);
paint.setColor(SK_ColorWHITE);
canvas->translate(200, 0);
- zPlaneParams.fZ = SkTMax(1.0f, 16 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 16 + fZDelta);
this->drawShadowedPath(canvas, fTabPath, zPlaneParams, paint,
kAmbientAlpha, lightPos, kLightWidth, kSpotAlpha);
@@ -251,7 +251,7 @@
paint.setColor(SK_ColorMAGENTA);
canvas->translate(-725, 240);
- zPlaneParams.fZ = SkTMax(1.0f, 32 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 32 + fZDelta);
this->drawShadowedPath(canvas, tmpPath, zPlaneParams, paint, .1f,
lightPos, kLightWidth, .5f);
@@ -261,7 +261,7 @@
Op(fSquareRRectPath, tmpClipPathBug, kIntersect_SkPathOp, &tmpPath);
canvas->translate(250, 0);
- zPlaneParams.fZ = SkTMax(1.0f, 32 + fZDelta);
+ zPlaneParams.fZ = std::max(1.0f, 32 + fZDelta);
this->drawShadowedPath(canvas, tmpPath, zPlaneParams, paint, .1f,
lightPos, kLightWidth, .5f);
@@ -281,7 +281,7 @@
SkScalar radians = SkDegreesToRadians(fAnimAngle);
zPlaneParams = SkPoint3::Make(0,
SkScalarSin(radians),
- SkTMax(1.0f, 16 + fZDelta) - SkScalarSin(radians)*pivot.fY);
+ std::max(1.0f, 16 + fZDelta) - SkScalarSin(radians)*pivot.fY);
this->drawShadowedPath(canvas, fWideRectPath, zPlaneParams, paint, .1f,
lightPos, kLightWidth, .5f);
@@ -297,7 +297,7 @@
canvas->setMatrix(persp);
zPlaneParams = SkPoint3::Make(-SkScalarSin(radians),
0,
- SkTMax(1.0f, 32 + fZDelta) + SkScalarSin(radians)*pivot.fX);
+ std::max(1.0f, 32 + fZDelta) + SkScalarSin(radians)*pivot.fX);
this->drawShadowedPath(canvas, fWideOvalPath, zPlaneParams, paint, .1f,
lightPos, kLightWidth, .5f);
@@ -312,7 +312,7 @@
canvas->setMatrix(persp);
zPlaneParams = SkPoint3::Make(-SkScalarSin(radians),
0,
- SkTMax(1.0f, 8 + fZDelta) + SkScalarSin(radians)*pivot.fX);
+ std::max(1.0f, 8 + fZDelta) + SkScalarSin(radians)*pivot.fX);
this->drawShadowedPath(canvas, fStarPath, zPlaneParams, paint, .1f,
lightPos, kLightWidth, .5f);
}
diff --git a/samplecode/SampleChineseFling.cpp b/samplecode/SampleChineseFling.cpp
index 1cdf784..d16fa06 100644
--- a/samplecode/SampleChineseFling.cpp
+++ b/samplecode/SampleChineseFling.cpp
@@ -191,7 +191,7 @@
auto paragraphLength = kParagraphLength;
SkScalar y = 0;
while (paragraphLength - 45 > 0) {
- auto currentLineLength = SkTMin(45, paragraphLength - 45);
+ auto currentLineLength = std::min(45, paragraphLength - 45);
this->createRandomLine(glyphs, currentLineLength);
ToolUtils::add_to_text_blob_w_len(&builder,
diff --git a/samplecode/SamplePathText.cpp b/samplecode/SamplePathText.cpp
index 0b8ef02..54f49b3 100644
--- a/samplecode/SamplePathText.cpp
+++ b/samplecode/SamplePathText.cpp
@@ -115,14 +115,14 @@
}
void PathText::Glyph::reset(SkRandom& rand, int w, int h) {
- int screensize = SkTMax(w, h);
+ int screensize = std::max(w, h);
const SkRect& bounds = fPath.getBounds();
SkScalar t;
fPosition = {rand.nextF() * w, rand.nextF() * h};
t = pow(rand.nextF(), 100);
fZoom = ((1 - t) * screensize / 50 + t * screensize / 3) /
- SkTMax(bounds.width(), bounds.height());
+ std::max(bounds.width(), bounds.height());
fSpin = rand.nextF() * 360;
fMidpt = {bounds.centerX(), bounds.centerY()};
}
@@ -143,7 +143,7 @@
}
void reset() override {
- const SkScalar screensize = static_cast<SkScalar>(SkTMax(this->width(), this->height()));
+ const SkScalar screensize = static_cast<SkScalar>(std::max(this->width(), this->height()));
this->INHERITED::reset();
for (auto& v : fVelocities) {
@@ -356,7 +356,7 @@
};
void WavyPathText::Waves::reset(SkRandom& rand, int w, int h) {
- const double pixelsPerMeter = 0.06 * SkTMax(w, h);
+ const double pixelsPerMeter = 0.06 * std::max(w, h);
const double medianWavelength = 8 * pixelsPerMeter;
const double medianWaveAmplitude = 0.05 * 4 * pixelsPerMeter;
const double gravity = 9.8 * pixelsPerMeter;
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 6b679e2..c82145d 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -218,7 +218,7 @@
fText = "";
break;
case '-':
- fTextSize = SkTMax(1.0f, fTextSize - 1);
+ fTextSize = std::max(1.0f, fTextSize - 1);
break;
case '+':
case '=':
@@ -478,7 +478,7 @@
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(width);
SkPath path;
- SkScalar maxSide = SkTMax(rect.width(), rect.height()) / 2;
+ SkScalar maxSide = std::max(rect.width(), rect.height()) / 2;
SkPoint center = { rect.fLeft + maxSide, rect.fTop + maxSide };
path.addCircle(center.fX, center.fY, maxSide);
canvas->drawPath(path, paint);
@@ -793,13 +793,13 @@
}
#ifdef SK_DEBUG
else if (index == (int) SK_ARRAY_COUNT(fPts) + 3) {
- gDebugStrokerError = SkTMax(FLT_EPSILON, MapScreenYtoValue(click->fCurr.fY,
+ gDebugStrokerError = std::max(FLT_EPSILON, MapScreenYtoValue(click->fCurr.fY,
fErrorControl, kStrokerErrorMin, kStrokerErrorMax));
gDebugStrokerErrorSet = true;
}
#endif
else if (index == (int) SK_ARRAY_COUNT(fPts) + 4) {
- fWidth = SkTMax(FLT_EPSILON, MapScreenYtoValue(click->fCurr.fY, fWidthControl,
+ fWidth = std::max(FLT_EPSILON, MapScreenYtoValue(click->fCurr.fY, fWidthControl,
kWidthMin, kWidthMax));
fAnimate = fWidth <= kWidthMin;
}
diff --git a/samplecode/SampleShadowColor.cpp b/samplecode/SampleShadowColor.cpp
index e0dd7fe..71208aa 100644
--- a/samplecode/SampleShadowColor.cpp
+++ b/samplecode/SampleShadowColor.cpp
@@ -74,11 +74,11 @@
handled = true;
break;
case '>':
- fZIndex = SkTMin(9, fZIndex+1);
+ fZIndex = std::min(9, fZIndex+1);
handled = true;
break;
case '<':
- fZIndex = SkTMax(0, fZIndex-1);
+ fZIndex = std::max(0, fZIndex-1);
handled = true;
break;
default:
@@ -115,9 +115,9 @@
if (paint.getColor() != SK_ColorBLACK) {
SkColor color = paint.getColor();
- uint8_t max = SkTMax(SkTMax(SkColorGetR(color), SkColorGetG(color)),
+ uint8_t max = std::max(std::max(SkColorGetR(color), SkColorGetG(color)),
SkColorGetB(color));
- uint8_t min = SkTMin(SkTMin(SkColorGetR(color), SkColorGetG(color)),
+ uint8_t min = std::min(std::min(SkColorGetR(color), SkColorGetG(color)),
SkColorGetB(color));
SkScalar luminance = 0.5f*(max + min) / 255.f;
SkScalar alpha = (.6 - .4*luminance)*luminance*luminance + 0.3f;
diff --git a/samplecode/SampleShadowUtils.cpp b/samplecode/SampleShadowUtils.cpp
index b085166..5fffd63 100644
--- a/samplecode/SampleShadowUtils.cpp
+++ b/samplecode/SampleShadowUtils.cpp
@@ -177,7 +177,7 @@
SkPaint paint;
paint.setColor(SK_ColorGREEN);
paint.setAntiAlias(true);
- SkPoint3 zPlaneParams = SkPoint3::Make(0, 0, SkTMax(1.0f, kHeight + fZDelta));
+ SkPoint3 zPlaneParams = SkPoint3::Make(0, 0, std::max(1.0f, kHeight + fZDelta));
// convex paths
for (auto& m : matrices) {
@@ -203,7 +203,7 @@
canvas->translate(dx, 0);
x += dx;
- dy = SkTMax(dy, postMBounds.height() + kPad + kHeight);
+ dy = std::max(dy, postMBounds.height() + kPad + kHeight);
}
}
}
@@ -229,7 +229,7 @@
canvas->translate(dx, 0);
x += dx;
- dy = SkTMax(dy, postMBounds.height() + kPad + kHeight);
+ dy = std::max(dy, postMBounds.height() + kPad + kHeight);
}
}
diff --git a/samplecode/SampleTextureUpload.cpp b/samplecode/SampleTextureUpload.cpp
index a33d1d9..920c672 100644
--- a/samplecode/SampleTextureUpload.cpp
+++ b/samplecode/SampleTextureUpload.cpp
@@ -67,12 +67,12 @@
fDrawTexturesToScreen = !fDrawTexturesToScreen;
return true;
} else if ('>' == uni) {
- fTileSize = SkTMin(kMaxTileSize, 2*fTileSize);
+ fTileSize = std::min(kMaxTileSize, 2*fTileSize);
fTileRows = kMaxTileSize/fTileSize;
fTileCols = kMaxTileSize/fTileSize;
fCachedContext = nullptr;
} else if ('<' == uni) {
- fTileSize = SkTMax(kMinTileSize, fTileSize/2);
+ fTileSize = std::max(kMinTileSize, fTileSize/2);
fTileRows = kMaxTileSize/fTileSize;
fTileCols = kMaxTileSize/fTileSize;
fCachedContext = nullptr;
diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm
index 724dccd..40a5d42 100644
--- a/site/user/api/catalog.htm
+++ b/site/user/api/catalog.htm
@@ -2164,7 +2164,7 @@
"stdout": "point 0: (-10,-10)\\npoint 1: (10,10)\\n"
},
"SkPath_getPoints": {
- "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkPath& path, SkPoint* points, int max) -> void {\n int count = path.getPoints(points, max);\n SkDebugf(\"%s point count: %d \", prefix, count);\n for (int i = 0; i < SkTMin(count, max) && points; ++i) {\n SkDebugf(\"(%1.8g,%1.8g) \", points[i].fX, points[i].fY);\n }\n SkDebugf(\"\\n\");\n };\n SkPath path;\n path.lineTo(20, 20);\n path.lineTo(-10, -10);\n SkPoint points[3];\n debugster(\"no points\", path, nullptr, 0);\n debugster(\"zero max\", path, points, 0);\n debugster(\"too small\", path, points, 2);\n debugster(\"just right\", path, points, path.countPoints());\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkPath& path, SkPoint* points, int max) -> void {\n int count = path.getPoints(points, max);\n SkDebugf(\"%s point count: %d \", prefix, count);\n for (int i = 0; i < std::min(count, max) && points; ++i) {\n SkDebugf(\"(%1.8g,%1.8g) \", points[i].fX, points[i].fY);\n }\n SkDebugf(\"\\n\");\n };\n SkPath path;\n path.lineTo(20, 20);\n path.lineTo(-10, -10);\n SkPoint points[3];\n debugster(\"no points\", path, nullptr, 0);\n debugster(\"zero max\", path, points, 0);\n debugster(\"too small\", path, points, 2);\n debugster(\"just right\", path, points, path.countPoints());\n}\n",
"hash": "9bc86efda08cbcd9c6f7c5f220294a24",
"file": "SkPath_Reference",
"name": "SkPath::getPoints",
@@ -2178,7 +2178,7 @@
"stdout": "mask quad set\\n"
},
"SkPath_getVerbs": {
- "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkPath& path, uint8_t* verbs, int max) -> void {\n int count = path.getVerbs(verbs, max);\n SkDebugf(\"%s verb count: %d \", prefix, count);\n const char* verbStr[] = { \"move\", \"line\", \"quad\", \"conic\", \"cubic\", \"close\" };\n for (int i = 0; i < SkTMin(count, max) && verbs; ++i) {\n SkDebugf(\"%s \", verbStr[verbs[i]]);\n }\n SkDebugf(\"\\n\");\n };\n SkPath path;\n path.lineTo(20, 20);\n path.lineTo(-10, -10);\n uint8_t verbs[3];\n debugster(\"no verbs\", path, nullptr, 0);\n debugster(\"zero max\", path, verbs, 0);\n debugster(\"too small\", path, verbs, 2);\n debugster(\"just right\", path, verbs, path.countVerbs());\n}\n",
+ "code": "void draw(SkCanvas* canvas) {\n auto debugster = [](const char* prefix, const SkPath& path, uint8_t* verbs, int max) -> void {\n int count = path.getVerbs(verbs, max);\n SkDebugf(\"%s verb count: %d \", prefix, count);\n const char* verbStr[] = { \"move\", \"line\", \"quad\", \"conic\", \"cubic\", \"close\" };\n for (int i = 0; i < std::min(count, max) && verbs; ++i) {\n SkDebugf(\"%s \", verbStr[verbs[i]]);\n }\n SkDebugf(\"\\n\");\n };\n SkPath path;\n path.lineTo(20, 20);\n path.lineTo(-10, -10);\n uint8_t verbs[3];\n debugster(\"no verbs\", path, nullptr, 0);\n debugster(\"zero max\", path, verbs, 0);\n debugster(\"too small\", path, verbs, 2);\n debugster(\"just right\", path, verbs, path.countVerbs());\n}\n",
"hash": "2ec66880966a6133ddd9331ce7323438",
"file": "SkPath_Reference",
"name": "SkPath::getVerbs",
@@ -3982,7 +3982,7 @@
"name": "Image_Info_Color_Type_RGB_888"
},
"Illustrations_Path_Arc": {
- "code": "struct data {\n const char* name;\n char super;\n int yn[10];\n};\nconst data dataSet[] = {\n{ \"arcTo sweep\", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},\n{ \"drawArc\", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},\n{ \"addArc\", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},\n{ \"arcTo tangents\", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"arcTo radii\", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"conicTo\", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}\n};\n#define __degree_symbol__ \"\\xC2\" \"\\xB0\"\nconst char* headers[] = {\n \"Oval part\",\n \"force moveTo\",\n \"can draw 180\" __degree_symbol__,\n \"can draw 360\" __degree_symbol__,\n \"can draw greater than 360\" __degree_symbol__,\n \"ignored if radius is zero\",\n \"ignored if sweep is zero\",\n \"requires Path\",\n \"describes rotation\",\n \"describes perspective\",\n};\nconst char* yna[] = {\n \"n/a\",\n \"no\",\n \"yes\"\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPaint lp;\n lp.setAntiAlias(true);\n SkPaint tp(lp);\n SkPaint sp(tp);\n SkPaint bp(tp);\n bp.setFakeBoldText(true);\n sp.setTextSize(10);\n lp.setColor(SK_ColorGRAY);\n canvas->translate(0, 32);\n const int tl = 115;\n for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {\n canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);\n if (0 == col) {\n continue;\n }\n canvas->drawLine( tl + col * 35, 100, tl + 100 + col * 35, 0, lp);\n SkPoint pts[] = {{tl - 10.f + col * 35, 98}, {tl + 90.f + col * 35, -2}};\n SkVector v = pts[1] - pts[0];\n v.normalize();\n SkMatrix matrix;\n matrix.setSinCos(v.fY, v.fX, pts[0].fX, pts[0].fY);\n canvas->save();\n canvas->concat(matrix);\n canvas->drawText(headers[col -1], strlen(headers[col -1]), pts[0].fX, pts[0].fY, bp);\n canvas->restore();\n }\n for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {\n if (0 == row) {\n canvas->drawLine(tl, 100, tl + 350, 100, lp);\n } else {\n canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);\n }\n if (row == SK_ARRAY_COUNT(dataSet)) {\n break;\n }\n canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);\n if (dataSet[row].super) {\n SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));\n canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);\n }\n for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {\n int val = dataSet[row].yn[col];\n canvas->drawString(yna[SkTMin(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);\n if (val > 1) {\n char supe = '0' + val - 1;\n canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);\n }\n }\n }\n}\n",
+ "code": "struct data {\n const char* name;\n char super;\n int yn[10];\n};\nconst data dataSet[] = {\n{ \"arcTo sweep\", '1', {1, 3, 1, 0, 0, 0, 0, 1, 0, 0 }},\n{ \"drawArc\", 0, {1, -1, 1, 1, 1, 1, 1, 0, 0, 0 }},\n{ \"addArc\", 0, {1, 1, 1, 4, 0, 1, 1, 1, 0, 0 }},\n{ \"arcTo tangents\", '4', {0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"arcTo radii\", '5', {1, 0, 1, 0, 0, 0, 0, 1, 1, 0 }},\n{ \"conicTo\", 0, {1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }}\n};\n#define __degree_symbol__ \"\\xC2\" \"\\xB0\"\nconst char* headers[] = {\n \"Oval part\",\n \"force moveTo\",\n \"can draw 180\" __degree_symbol__,\n \"can draw 360\" __degree_symbol__,\n \"can draw greater than 360\" __degree_symbol__,\n \"ignored if radius is zero\",\n \"ignored if sweep is zero\",\n \"requires Path\",\n \"describes rotation\",\n \"describes perspective\",\n};\nconst char* yna[] = {\n \"n/a\",\n \"no\",\n \"yes\"\n};\n\nvoid draw(SkCanvas* canvas) {\n SkPaint lp;\n lp.setAntiAlias(true);\n SkPaint tp(lp);\n SkPaint sp(tp);\n SkPaint bp(tp);\n bp.setFakeBoldText(true);\n sp.setTextSize(10);\n lp.setColor(SK_ColorGRAY);\n canvas->translate(0, 32);\n const int tl = 115;\n for (unsigned col = 0; col <= SK_ARRAY_COUNT(headers); ++col) {\n canvas->drawLine(tl + col * 35, 100, tl + col * 35, 250, lp);\n if (0 == col) {\n continue;\n }\n canvas->drawLine( tl + col * 35, 100, tl + 100 + col * 35, 0, lp);\n SkPoint pts[] = {{tl - 10.f + col * 35, 98}, {tl + 90.f + col * 35, -2}};\n SkVector v = pts[1] - pts[0];\n v.normalize();\n SkMatrix matrix;\n matrix.setSinCos(v.fY, v.fX, pts[0].fX, pts[0].fY);\n canvas->save();\n canvas->concat(matrix);\n canvas->drawText(headers[col -1], strlen(headers[col -1]), pts[0].fX, pts[0].fY, bp);\n canvas->restore();\n }\n for (unsigned row = 0; row <= SK_ARRAY_COUNT(dataSet); ++row) {\n if (0 == row) {\n canvas->drawLine(tl, 100, tl + 350, 100, lp);\n } else {\n canvas->drawLine(5, 100 + row * 25, tl + 350, 100 + row * 25, lp);\n }\n if (row == SK_ARRAY_COUNT(dataSet)) {\n break;\n }\n canvas->drawString(dataSet[row].name, 5, 117 + row * 25, bp);\n if (dataSet[row].super) {\n SkScalar width = bp.measureText(dataSet[row].name, strlen(dataSet[row].name));\n canvas->drawText(&dataSet[row].super, 1, 8 + width, 112 + row * 25, sp);\n }\n for (unsigned col = 0; col < SK_ARRAY_COUNT(headers); ++col) {\n int val = dataSet[row].yn[col];\n canvas->drawString(yna[std::min(2, val + 1)], tl + 5 + col * 35, 117 + row * 25, tp);\n if (val > 1) {\n char supe = '0' + val - 1;\n canvas->drawText(&supe, 1, tl + 25 + col * 35, 112 + row * 25, sp);\n }\n }\n }\n}\n",
"width": 600,
"height": 300,
"hash": "e17e48e9d2182e9afc0f5d26b72c60f0",
diff --git a/src/android/SkBitmapRegionCodec.cpp b/src/android/SkBitmapRegionCodec.cpp
index 5cb9ccb..081d0bb 100644
--- a/src/android/SkBitmapRegionCodec.cpp
+++ b/src/android/SkBitmapRegionCodec.cpp
@@ -62,8 +62,8 @@
scaledOutX = outX / sampleSize;
scaledOutY = outY / sampleSize;
// We need to be safe here because getSupportedSubset() may have modified the subset.
- const int extraX = SkTMax(0, desiredSubset.width() - outX - subset.width());
- const int extraY = SkTMax(0, desiredSubset.height() - outY - subset.height());
+ const int extraX = std::max(0, desiredSubset.width() - outX - subset.width());
+ const int extraY = std::max(0, desiredSubset.height() - outY - subset.height());
const int scaledExtraX = extraX / sampleSize;
const int scaledExtraY = extraY / sampleSize;
scaledOutWidth += scaledOutX + scaledExtraX;
diff --git a/src/android/SkBitmapRegionDecoderPriv.h b/src/android/SkBitmapRegionDecoderPriv.h
index 5f1613a..905d460 100644
--- a/src/android/SkBitmapRegionDecoderPriv.h
+++ b/src/android/SkBitmapRegionDecoderPriv.h
@@ -35,16 +35,16 @@
inline SubsetType adjust_subset_rect(const SkISize& imageDims, SkIRect* subset, int* outX,
int* outY) {
// These must be at least zero, we can't start decoding the image at a negative coordinate.
- int left = SkTMax(0, subset->fLeft);
- int top = SkTMax(0, subset->fTop);
+ int left = std::max(0, subset->fLeft);
+ int top = std::max(0, subset->fTop);
// If input offsets are less than zero, we decode to an offset location in the output bitmap.
*outX = left - subset->fLeft;
*outY = top - subset->fTop;
// Make sure we don't decode pixels past the edge of the image or past the edge of the subset.
- int width = SkTMin(imageDims.width() - left, subset->width() - *outX);
- int height = SkTMin(imageDims.height() - top, subset->height() - *outY);
+ int width = std::min(imageDims.width() - left, subset->width() - *outX);
+ int height = std::min(imageDims.height() - top, subset->height() - *outY);
if (width <= 0 || height <= 0) {
return SubsetType::kOutside_SubsetType;
}
diff --git a/src/atlastext/SkAtlasTextTarget.cpp b/src/atlastext/SkAtlasTextTarget.cpp
index 118e331..a37b42a 100644
--- a/src/atlastext/SkAtlasTextTarget.cpp
+++ b/src/atlastext/SkAtlasTextTarget.cpp
@@ -176,7 +176,7 @@
}
const GrCaps& caps = *this->context()->internal().grContext()->priv().caps();
op->finalizeForTextTarget(fColor, caps);
- int n = SkTMin(kMaxBatchLookBack, fOps.count());
+ int n = std::min(kMaxBatchLookBack, fOps.count());
GrRecordingContext::Arenas arenas = this->arenas();
for (int i = 0; i < n; ++i) {
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index fc5d298..86ebac4 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -71,7 +71,7 @@
uint32_t maxColors = 1 << this->bitsPerPixel();
// Don't bother reading more than maxColors.
const uint32_t numColorsToRead =
- fNumColors == 0 ? maxColors : SkTMin(fNumColors, maxColors);
+ fNumColors == 0 ? maxColors : std::min(fNumColors, maxColors);
// Read the color table from the stream
colorBytes = numColorsToRead * fBytesPerColor;
@@ -479,7 +479,7 @@
// If the first byte read is not a flag, it indicates the number of
// pixels to set in RLE mode.
const uint8_t numPixels = flag;
- const int endX = SkTMin<int>(x + numPixels, width);
+ const int endX = std::min<int>(x + numPixels, width);
if (24 == this->bitsPerPixel()) {
// In RLE24, the second byte read is part of the pixel color.
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index e60100a..07f373b 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -71,7 +71,7 @@
uint32_t maxColors = 1 << this->bitsPerPixel();
// Don't bother reading more than maxColors.
const uint32_t numColorsToRead =
- fNumColors == 0 ? maxColors : SkTMin(fNumColors, maxColors);
+ fNumColors == 0 ? maxColors : std::min(fNumColors, maxColors);
// Read the color table from the stream
colorBytes = numColorsToRead * fBytesPerColor;
diff --git a/src/codec/SkParseEncodedOrigin.cpp b/src/codec/SkParseEncodedOrigin.cpp
index aaee8c2..1fa11ef 100644
--- a/src/codec/SkParseEncodedOrigin.cpp
+++ b/src/codec/SkParseEncodedOrigin.cpp
@@ -37,7 +37,7 @@
// Tag (2 bytes), Datatype (2 bytes), Number of elements (4 bytes), Data (4 bytes)
const uint32_t kEntrySize = 12;
const auto max = SkTo<uint32_t>((data_length - offset - 2) / kEntrySize);
- numEntries = SkTMin(numEntries, max);
+ numEntries = std::min(numEntries, max);
// Advance the data to the start of the entries.
data += offset + 2;
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index bcbf32b..a2ec989 100644
--- a/src/codec/SkRawCodec.cpp
+++ b/src/codec/SkRawCodec.cpp
@@ -257,7 +257,7 @@
data = SkData::MakeSubset(data.get(), 0, bytesRead);
}
} else {
- const size_t alreadyBuffered = SkTMin(fStreamBuffer.bytesWritten() - offset, size);
+ const size_t alreadyBuffered = std::min(fStreamBuffer.bytesWritten() - offset, size);
if (alreadyBuffered > 0 &&
!fStreamBuffer.read(data->writable_data(), offset, alreadyBuffered)) {
return nullptr;
@@ -301,7 +301,7 @@
// Try to read at least 8192 bytes to avoid to many small reads.
const size_t kMinSizeToRead = 8192;
const size_t sizeRequested = newSize - fStreamBuffer.bytesWritten();
- const size_t sizeToRead = SkTMax(kMinSizeToRead, sizeRequested);
+ const size_t sizeToRead = std::max(kMinSizeToRead, sizeRequested);
SkAutoSTMalloc<kMinSizeToRead, uint8> tempBuffer(sizeToRead);
const size_t bytesRead = fStream->read(tempBuffer.get(), sizeToRead);
if (bytesRead < sizeRequested) {
@@ -360,7 +360,7 @@
// This will allow read less than the requested "size", because the JPEG codec wants to
// handle also a partial JPEG file.
- const size_t bytesToRead = SkTMin(sum, fStream->getLength()) - offset;
+ const size_t bytesToRead = std::min(sum, fStream->getLength()) - offset;
if (bytesToRead == 0) {
return nullptr;
}
@@ -463,7 +463,7 @@
}
// DNG SDK preserves the aspect ratio, so it only needs to know the longer dimension.
- const int preferredSize = SkTMax(width, height);
+ const int preferredSize = std::max(width, height);
try {
// render() takes ownership of fHost, fInfo, fNegative and fDngStream when available.
std::unique_ptr<dng_host> host(fHost.release());
@@ -494,7 +494,7 @@
render.SetFinalPixelType(ttByte);
dng_point stage3_size = negative->Stage3Image()->Size();
- render.SetMaximumSize(SkTMax(stage3_size.h, stage3_size.v));
+ render.SetMaximumSize(std::max(stage3_size.h, stage3_size.v));
return render.Render();
} catch (...) {
@@ -759,7 +759,7 @@
}
// Limits the minimum size to be 80 on the short edge.
- const float shortEdge = static_cast<float>(SkTMin(dim.fWidth, dim.fHeight));
+ const float shortEdge = static_cast<float>(std::min(dim.fWidth, dim.fHeight));
if (desiredScale < 80.f / shortEdge) {
desiredScale = 80.f / shortEdge;
}
@@ -778,8 +778,8 @@
bool SkRawCodec::onDimensionsSupported(const SkISize& dim) {
const SkISize fullDim = this->dimensions();
- const float fullShortEdge = static_cast<float>(SkTMin(fullDim.fWidth, fullDim.fHeight));
- const float shortEdge = static_cast<float>(SkTMin(dim.fWidth, dim.fHeight));
+ const float fullShortEdge = static_cast<float>(std::min(fullDim.fWidth, fullDim.fHeight));
+ const float shortEdge = static_cast<float>(std::min(dim.fWidth, dim.fHeight));
SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEdge / shortEdge));
SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge));
diff --git a/src/codec/SkScalingCodec.h b/src/codec/SkScalingCodec.h
index 799ca38..40c472c 100644
--- a/src/codec/SkScalingCodec.h
+++ b/src/codec/SkScalingCodec.h
@@ -20,8 +20,8 @@
SkISize dim = this->dimensions();
// SkCodec treats zero dimensional images as errors, so the minimum size
// that we will recommend is 1x1.
- dim.fWidth = SkTMax(1, SkScalarRoundToInt(desiredScale * dim.fWidth));
- dim.fHeight = SkTMax(1, SkScalarRoundToInt(desiredScale * dim.fHeight));
+ dim.fWidth = std::max(1, SkScalarRoundToInt(desiredScale * dim.fWidth));
+ dim.fHeight = std::max(1, SkScalarRoundToInt(desiredScale * dim.fHeight));
return dim;
}
diff --git a/src/codec/SkStreamBuffer.cpp b/src/codec/SkStreamBuffer.cpp
index cdac862..835c05d 100644
--- a/src/codec/SkStreamBuffer.cpp
+++ b/src/codec/SkStreamBuffer.cpp
@@ -45,7 +45,7 @@
if (fHasLengthAndPosition) {
const size_t remaining = fStream->getLength() - fStream->getPosition() + fTrulyBuffered;
- fBytesBuffered = SkTMin(remaining, totalBytesToBuffer);
+ fBytesBuffered = std::min(remaining, totalBytesToBuffer);
} else {
const size_t extraBytes = totalBytesToBuffer - fBytesBuffered;
const size_t bytesBuffered = fStream->read(fBuffer + fBytesBuffered, extraBytes);
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 8a889b5..6cea0c6 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -397,8 +397,8 @@
return kSuccess;
}
- int minXOffset = SkTMin(dstX, subset.x());
- int minYOffset = SkTMin(dstY, subset.y());
+ int minXOffset = std::min(dstX, subset.x());
+ int minYOffset = std::min(dstY, subset.y());
dstX -= minXOffset;
dstY -= minYOffset;
frameRect.offset(-minXOffset, -minYOffset);
diff --git a/src/core/SkAnalyticEdge.cpp b/src/core/SkAnalyticEdge.cpp
index 2062512..a15b7f8 100644
--- a/src/core/SkAnalyticEdge.cpp
+++ b/src/core/SkAnalyticEdge.cpp
@@ -383,10 +383,10 @@
SkFDot6 diffY = SkFixedToFDot6(newy - fSnappedY);
slope = diffY ? quick_div(SkFixedToFDot6(newx - fSnappedX), diffY)
: SK_MaxS32;
- newSnappedY = SkTMin<SkFixed>(fQEdge.fQLastY, SkFixedRoundToFixed(newy));
+ newSnappedY = std::min<SkFixed>(fQEdge.fQLastY, SkFixedRoundToFixed(newy));
newSnappedX = newx - SkFixedMul(slope, newy - newSnappedY);
} else {
- newSnappedY = SkTMin(fQEdge.fQLastY, SnapY(newy));
+ newSnappedY = std::min(fQEdge.fQLastY, SnapY(newy));
newSnappedX = newx;
SkFDot6 diffY = SkFixedToFDot6(newSnappedY - fSnappedY);
slope = diffY ? quick_div(SkFixedToFDot6(newx - fSnappedX), diffY)
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index a5c7acb..bd7acca 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -185,10 +185,10 @@
const SkVector& devRadiiLR = devRRect.radii(SkRRect::kLowerRight_Corner);
const SkVector& devRadiiLL = devRRect.radii(SkRRect::kLowerLeft_Corner);
- const int devLeft = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiUL.fX, devRadiiLL.fX));
- const int devTop = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiUL.fY, devRadiiUR.fY));
- const int devRight = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiUR.fX, devRadiiLR.fX));
- const int devBot = SkScalarCeilToInt(SkTMax<SkScalar>(devRadiiLL.fY, devRadiiLR.fY));
+ const int devLeft = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fX, devRadiiLL.fX));
+ const int devTop = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUL.fY, devRadiiUR.fY));
+ const int devRight = SkScalarCeilToInt(std::max<SkScalar>(devRadiiUR.fX, devRadiiLR.fX));
+ const int devBot = SkScalarCeilToInt(std::max<SkScalar>(devRadiiLL.fY, devRadiiLR.fY));
// This is a conservative check for nine-patchability
if (devOrig.fLeft + devLeft + devBlurRadius >= devOrig.fRight - devRight - devBlurRadius ||
@@ -201,10 +201,10 @@
const SkVector& srcRadiiLR = srcRRect.radii(SkRRect::kLowerRight_Corner);
const SkVector& srcRadiiLL = srcRRect.radii(SkRRect::kLowerLeft_Corner);
- const SkScalar srcLeft = SkTMax<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX);
- const SkScalar srcTop = SkTMax<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY);
- const SkScalar srcRight = SkTMax<SkScalar>(srcRadiiUR.fX, srcRadiiLR.fX);
- const SkScalar srcBot = SkTMax<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY);
+ const SkScalar srcLeft = std::max<SkScalar>(srcRadiiUL.fX, srcRadiiLL.fX);
+ const SkScalar srcTop = std::max<SkScalar>(srcRadiiUL.fY, srcRadiiUR.fY);
+ const SkScalar srcRight = std::max<SkScalar>(srcRadiiUR.fX, srcRadiiLR.fX);
+ const SkScalar srcBot = std::max<SkScalar>(srcRadiiLL.fY, srcRadiiLR.fY);
int newRRWidth = 2*devBlurRadius + devLeft + devRight + 1;
int newRRHeight = 2*devBlurRadius + devTop + devBot + 1;
@@ -491,8 +491,8 @@
const SkVector& LR = rrect.radii(SkRRect::kLowerRight_Corner);
const SkVector& LL = rrect.radii(SkRRect::kLowerLeft_Corner);
- const SkScalar leftUnstretched = SkTMax(UL.fX, LL.fX) + SkIntToScalar(2 * margin.fX);
- const SkScalar rightUnstretched = SkTMax(UR.fX, LR.fX) + SkIntToScalar(2 * margin.fX);
+ const SkScalar leftUnstretched = std::max(UL.fX, LL.fX) + SkIntToScalar(2 * margin.fX);
+ const SkScalar rightUnstretched = std::max(UR.fX, LR.fX) + SkIntToScalar(2 * margin.fX);
// Extra space in the middle to ensure an unchanging piece for stretching. Use 3 to cover
// any fractional space on either side plus 1 for the part to stretch.
@@ -504,8 +504,8 @@
return kUnimplemented_FilterReturn;
}
- const SkScalar topUnstretched = SkTMax(UL.fY, UR.fY) + SkIntToScalar(2 * margin.fY);
- const SkScalar bottomUnstretched = SkTMax(LL.fY, LR.fY) + SkIntToScalar(2 * margin.fY);
+ const SkScalar topUnstretched = std::max(UL.fY, UR.fY) + SkIntToScalar(2 * margin.fY);
+ const SkScalar bottomUnstretched = std::max(LL.fY, LR.fY) + SkIntToScalar(2 * margin.fY);
const SkScalar totalSmallHeight = topUnstretched + bottomUnstretched + stretchSize;
if (totalSmallHeight >= rrect.rect().height()) {
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 17bf974..b7a73c2 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -537,7 +537,7 @@
{
inc_canvas();
this->init(sk_make_sp<SkNoPixelsDevice>(
- SkIRect::MakeWH(SkTMax(width, 0), SkTMax(height, 0)), fProps));
+ SkIRect::MakeWH(std::max(width, 0), std::max(height, 0)), fProps));
}
SkCanvas::SkCanvas(const SkIRect& bounds)
diff --git a/src/core/SkCompressedDataUtils.cpp b/src/core/SkCompressedDataUtils.cpp
index 3f7dc58..5583c61 100644
--- a/src/core/SkCompressedDataUtils.cpp
+++ b/src/core/SkCompressedDataUtils.cpp
@@ -268,7 +268,7 @@
static_assert(sizeof(ETC1Block) == sizeof(BC1Block));
totalSize += numBlocks * sizeof(ETC1Block);
- dimensions = {SkTMax(1, dimensions.width()/2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width()/2), std::max(1, dimensions.height()/2)};
}
break;
}
diff --git a/src/core/SkCubicMap.cpp b/src/core/SkCubicMap.cpp
index f5285e0..e6bf714 100644
--- a/src/core/SkCubicMap.cpp
+++ b/src/core/SkCubicMap.cpp
@@ -80,8 +80,8 @@
SkCubicMap::SkCubicMap(SkPoint p1, SkPoint p2) {
// Clamp X values only (we allow Ys outside [0..1]).
- p1.fX = SkTMin(SkTMax(p1.fX, 0.0f), 1.0f);
- p2.fX = SkTMin(SkTMax(p2.fX, 0.0f), 1.0f);
+ p1.fX = std::min(std::max(p1.fX, 0.0f), 1.0f);
+ p2.fX = std::min(std::max(p2.fX, 0.0f), 1.0f);
Sk2s s1 = Sk2s::Load(&p1) * 3;
Sk2s s2 = Sk2s::Load(&p2) * 3;
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 6bd36c6..609e40c 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -807,7 +807,7 @@
SkScalar sx = SkPoint::Length(matrix[SkMatrix::kMScaleX], matrix[SkMatrix::kMSkewY]);
SkScalar sy = SkPoint::Length(matrix[SkMatrix::kMSkewX], matrix[SkMatrix::kMScaleY]);
if (SkScalarsAreFinite(sx, sy)) {
- SkScalar scale = SkTMax(sx, sy);
+ SkScalar scale = std::max(sx, sy);
if (scale > 0) {
return scale;
}
diff --git a/src/core/SkDrawShadowInfo.cpp b/src/core/SkDrawShadowInfo.cpp
index 8912046..c8a4fe3 100644
--- a/src/core/SkDrawShadowInfo.cpp
+++ b/src/core/SkDrawShadowInfo.cpp
@@ -121,11 +121,11 @@
occluderZ = rec.fZPlaneParams.fZ;
} else {
occluderZ = compute_z(ambientBounds.fLeft, ambientBounds.fTop, rec.fZPlaneParams);
- occluderZ = SkTMax(occluderZ, compute_z(ambientBounds.fRight, ambientBounds.fTop,
+ occluderZ = std::max(occluderZ, compute_z(ambientBounds.fRight, ambientBounds.fTop,
rec.fZPlaneParams));
- occluderZ = SkTMax(occluderZ, compute_z(ambientBounds.fLeft, ambientBounds.fBottom,
+ occluderZ = std::max(occluderZ, compute_z(ambientBounds.fLeft, ambientBounds.fBottom,
rec.fZPlaneParams));
- occluderZ = SkTMax(occluderZ, compute_z(ambientBounds.fRight, ambientBounds.fBottom,
+ occluderZ = std::max(occluderZ, compute_z(ambientBounds.fRight, ambientBounds.fBottom,
rec.fZPlaneParams));
}
SkScalar ambientBlur;
diff --git a/src/core/SkDrawShadowInfo.h b/src/core/SkDrawShadowInfo.h
index c89c8f2..c1e7707 100644
--- a/src/core/SkDrawShadowInfo.h
+++ b/src/core/SkDrawShadowInfo.h
@@ -42,11 +42,11 @@
}
inline SkScalar AmbientBlurRadius(SkScalar height) {
- return SkTMin(height*kAmbientHeightFactor*kAmbientGeomFactor, kMaxAmbientRadius);
+ return std::min(height*kAmbientHeightFactor*kAmbientGeomFactor, kMaxAmbientRadius);
}
inline SkScalar AmbientRecipAlpha(SkScalar height) {
- return 1.0f + SkTMax(height*kAmbientHeightFactor, 0.0f);
+ return 1.0f + std::max(height*kAmbientHeightFactor, 0.0f);
}
inline SkScalar SpotBlurRadius(SkScalar occluderZ, SkScalar lightZ, SkScalar lightRadius) {
diff --git a/src/core/SkFont.cpp b/src/core/SkFont.cpp
index e2e3ef9..b0de674 100644
--- a/src/core/SkFont.cpp
+++ b/src/core/SkFont.cpp
@@ -27,7 +27,7 @@
#define kDefault_Hinting SkPaintDefaults_Hinting
static inline SkScalar valid_size(SkScalar size) {
- return SkTMax<SkScalar>(0, size);
+ return std::max<SkScalar>(0, size);
}
SkFont::SkFont(sk_sp<SkTypeface> face, SkScalar size, SkScalar scaleX, SkScalar skewX)
diff --git a/src/core/SkGlyph.cpp b/src/core/SkGlyph.cpp
index b0c7523..4765faf 100644
--- a/src/core/SkGlyph.cpp
+++ b/src/core/SkGlyph.cpp
@@ -201,8 +201,8 @@
SkScalar left = SK_ScalarMax,
right = SK_ScalarMin;
auto expandGap = [&left, &right](SkScalar v) {
- left = SkTMin(left, v);
- right = SkTMax(right, v);
+ left = std::min(left, v);
+ right = std::max(right, v);
};
// Handle all the different verbs for the path.
@@ -257,9 +257,9 @@
break;
}
case SkPath::kQuad_Verb: {
- SkScalar quadTop = SkTMin(SkTMin(pts[0].fY, pts[1].fY), pts[2].fY);
+ SkScalar quadTop = std::min(std::min(pts[0].fY, pts[1].fY), pts[2].fY);
if (bottomOffset < quadTop) { break; }
- SkScalar quadBottom = SkTMax(SkTMax(pts[0].fY, pts[1].fY), pts[2].fY);
+ SkScalar quadBottom = std::max(std::max(pts[0].fY, pts[1].fY), pts[2].fY);
if (topOffset > quadBottom) { break; }
addQuad(topOffset);
addQuad(bottomOffset);
@@ -272,10 +272,10 @@
}
case SkPath::kCubic_Verb: {
SkScalar quadTop =
- SkTMin(SkTMin(SkTMin(pts[0].fY, pts[1].fY), pts[2].fY), pts[3].fY);
+ std::min(std::min(std::min(pts[0].fY, pts[1].fY), pts[2].fY), pts[3].fY);
if (bottomOffset < quadTop) { break; }
SkScalar quadBottom =
- SkTMax(SkTMax(SkTMax(pts[0].fY, pts[1].fY), pts[2].fY), pts[3].fY);
+ std::max(std::max(std::max(pts[0].fY, pts[1].fY), pts[2].fY), pts[3].fY);
if (topOffset > quadBottom) { break; }
addCubic(topOffset);
addCubic(bottomOffset);
diff --git a/src/core/SkGlyphBuffer.h b/src/core/SkGlyphBuffer.h
index be97703..fe4da38 100644
--- a/src/core/SkGlyphBuffer.h
+++ b/src/core/SkGlyphBuffer.h
@@ -45,7 +45,7 @@
}
void reject(size_t index, int rejectedMaxDimension) {
- fRejectedMaxDimension = SkTMax(fRejectedMaxDimension, rejectedMaxDimension);
+ fRejectedMaxDimension = std::max(fRejectedMaxDimension, rejectedMaxDimension);
this->reject(index);
}
diff --git a/src/core/SkMathPriv.h b/src/core/SkMathPriv.h
index d0ce3b2..23b51bd 100644
--- a/src/core/SkMathPriv.h
+++ b/src/core/SkMathPriv.h
@@ -121,10 +121,6 @@
return (prod + (prod >> 8)) >> 8;
}
-static inline float SkPinToUnitFloat(float x) {
- return SkTMin(SkTMax(x, 0.0f), 1.0f);
-}
-
/**
* Swap byte order of a 4-byte value, e.g. 0xaarrggbb -> 0xbbggrraa.
*/
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index 748b7ea..21cf377 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -614,8 +614,8 @@
proc = proc_2_2;
}
}
- width = SkTMax(1, width >> 1);
- height = SkTMax(1, height >> 1);
+ width = std::max(1, width >> 1);
+ height = std::max(1, height >> 1);
rowBytes = SkToU32(SkColorTypeMinRowBytes(ct, width));
// We make the Info w/o any colorspace, since that storage is not under our control, and
@@ -654,7 +654,7 @@
// (or original_width) where i is the mipmap level.
// Continue scaling down until both axes are size 1.
- const int largestAxis = SkTMax(baseWidth, baseHeight);
+ const int largestAxis = std::max(baseWidth, baseHeight);
if (largestAxis < 2) {
// SkMipMap::Build requires a minimum size of 2.
return 0;
@@ -695,8 +695,8 @@
// For example, it contains levels 1-x instead of 0-x.
// This is because the image used to create SkMipMap is the base level.
// So subtract 1 from the mip level to get the index stored by SkMipMap.
- int width = SkTMax(1, baseWidth >> (level + 1));
- int height = SkTMax(1, baseHeight >> (level + 1));
+ int width = std::max(1, baseWidth >> (level + 1));
+ int height = std::max(1, baseHeight >> (level + 1));
return SkISize::Make(width, height);
}
@@ -712,7 +712,7 @@
#ifndef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAP_SCALE
// Use the smallest scale to match the GPU impl.
- const SkScalar scale = SkTMin(scaleSize.width(), scaleSize.height());
+ const SkScalar scale = std::min(scaleSize.width(), scaleSize.height());
#else
// Ideally we'd pick the smaller scale, to match Ganesh. But ignoring one of the
// scales can produce some atrocious results, so for now we use the geometric mean.
diff --git a/src/core/SkNormalMapSource.cpp b/src/core/SkNormalMapSource.cpp
index cc08e26..79359a4 100644
--- a/src/core/SkNormalMapSource.cpp
+++ b/src/core/SkNormalMapSource.cpp
@@ -180,7 +180,7 @@
SkPMColor tmpNormalColors[BUFFER_MAX];
do {
- int n = SkTMin(count, BUFFER_MAX);
+ int n = std::min(count, BUFFER_MAX);
fMapContext->shadeSpan(x, y, tmpNormalColors, n);
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 4074d6a..5afe53a 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1189,7 +1189,7 @@
SkVector delta = unitPts[1] - unitPts[0];
SkScalar d = delta.fX * delta.fX + delta.fY * delta.fY;
- SkScalar scaleFactorSquared = SkTMax(1 / d - 0.25f, 0.f);
+ SkScalar scaleFactorSquared = std::max(1 / d - 0.25f, 0.f);
SkScalar scaleFactor = SkScalarSqrt(scaleFactorSquared);
if ((arcSweep == SkPathDirection::kCCW) != SkToBool(arcLarge)) { // flipped from the original implementation
@@ -2088,9 +2088,9 @@
if (!SkScalarIsFinite(cross)) {
return kUnknown_DirChange;
}
- SkScalar smallest = SkTMin(fCurrPt.fX, SkTMin(fCurrPt.fY, SkTMin(fLastPt.fX, fLastPt.fY)));
- SkScalar largest = SkTMax(fCurrPt.fX, SkTMax(fCurrPt.fY, SkTMax(fLastPt.fX, fLastPt.fY)));
- largest = SkTMax(largest, -smallest);
+ SkScalar smallest = std::min(fCurrPt.fX, std::min(fCurrPt.fY, std::min(fLastPt.fX, fLastPt.fY)));
+ SkScalar largest = std::max(fCurrPt.fX, std::max(fCurrPt.fY, std::max(fLastPt.fX, fLastPt.fY)));
+ largest = std::max(largest, -smallest);
if (almost_equal(largest, largest + cross)) {
constexpr SkScalar nearlyZeroSqd = SK_ScalarNearlyZero * SK_ScalarNearlyZero;
diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp
index c429e5c..3527cd1 100644
--- a/src/core/SkRRect.cpp
+++ b/src/core/SkRRect.cpp
@@ -115,7 +115,7 @@
// miss the fact that a scale is required.
static double compute_min_scale(double rad1, double rad2, double limit, double curMin) {
if ((rad1 + rad2) > limit) {
- return SkTMin(curMin, limit / (rad1 + rad2));
+ return std::min(curMin, limit / (rad1 + rad2));
}
return curMin;
}
diff --git a/src/core/SkRWBuffer.cpp b/src/core/SkRWBuffer.cpp
index 462532f..626611f 100644
--- a/src/core/SkRWBuffer.cpp
+++ b/src/core/SkRWBuffer.cpp
@@ -11,6 +11,7 @@
#include "include/private/SkMalloc.h"
#include "include/private/SkTo.h"
+#include <algorithm>
#include <atomic>
#include <new>
@@ -40,7 +41,7 @@
//
size_t append(const void* src, size_t length) {
this->validate();
- size_t amount = SkTMin(this->avail(), length);
+ size_t amount = std::min(this->avail(), length);
memcpy(this->availData(), src, amount);
fUsed += amount;
this->validate();
@@ -59,7 +60,7 @@
private:
static size_t LengthToCapacity(size_t length) {
const size_t minSize = kMinAllocSize - sizeof(SkBufferBlock);
- return SkTMax(length, minSize);
+ return std::max(length, minSize);
}
};
@@ -71,7 +72,7 @@
static size_t LengthToCapacity(size_t length) {
const size_t minSize = kMinAllocSize - sizeof(SkBufferHead);
- return SkTMax(length, minSize);
+ return std::max(length, minSize);
}
static SkBufferHead* Alloc(size_t length) {
@@ -171,7 +172,7 @@
if (!fBlock) {
return 0;
}
- return SkTMin(fBlock->fCapacity, fRemaining);
+ return std::min(fBlock->fCapacity, fRemaining);
}
bool SkROBuffer::Iter::next() {
@@ -290,7 +291,7 @@
for (;;) {
size_t size = fIter.size();
SkASSERT(fLocalOffset <= size);
- size_t avail = SkTMin(size - fLocalOffset, request - bytesRead);
+ size_t avail = std::min(size - fLocalOffset, request - bytesRead);
if (dst) {
memcpy(dst, (const char*)fIter.data() + fLocalOffset, avail);
dst = (char*)dst + avail;
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 080a854..e97729c 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -61,7 +61,7 @@
const SkMatrix& initialCTM) {
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
- stop = SkTMin(stop, record.count());
+ stop = std::min(stop, record.count());
SkRecords::Draw draw(canvas, drawablePicts, nullptr, drawableCount, &initialCTM);
for (int i = start; i < stop; i++) {
record.visit(i, draw);
diff --git a/src/core/SkRect.cpp b/src/core/SkRect.cpp
index b3cabbe..c1e81a3 100644
--- a/src/core/SkRect.cpp
+++ b/src/core/SkRect.cpp
@@ -85,8 +85,8 @@
bool all_finite = (accum * 0 == 0).allTrue();
if (all_finite) {
- this->setLTRB(SkTMin(min[0], min[2]), SkTMin(min[1], min[3]),
- SkTMax(max[0], max[2]), SkTMax(max[1], max[3]));
+ this->setLTRB(std::min(min[0], min[2]), std::min(min[1], min[3]),
+ std::max(max[0], max[2]), std::max(max[1], max[3]));
} else {
this->setEmpty();
}
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 61197f8..ff39bd6 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -434,7 +434,7 @@
if (0 == limit) {
limit = fTotalByteLimit;
} else {
- limit = SkTMin(limit, fTotalByteLimit);
+ limit = std::min(limit, fTotalByteLimit);
}
}
return limit;
diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp
index 90a89ce..2df03b9 100644
--- a/src/core/SkScan_AAAPath.cpp
+++ b/src/core/SkScan_AAAPath.cpp
@@ -95,7 +95,7 @@
}
static void safely_add_alpha(SkAlpha* alpha, SkAlpha delta) {
- *alpha = SkTMin(0xFF, *alpha + delta);
+ *alpha = std::min(0xFF, *alpha + delta);
}
class AdditiveBlitter : public SkBlitter {
@@ -415,7 +415,7 @@
antialias -= x;
x = 0;
}
- len = SkTMin(len, fWidth - x);
+ len = std::min(len, fWidth - x);
SkASSERT(check(x, len));
if (x < fOffsetX) {
@@ -485,7 +485,7 @@
antialias -= x;
x = 0;
}
- len = SkTMin(len, fWidth - x);
+ len = std::min(len, fWidth - x);
SkASSERT(check(x, len));
if (x < fOffsetX) {
@@ -589,7 +589,7 @@
if (l2 > r2) {
std::swap(l2, r2);
}
- return (SkTMax(l1, l2) + SkTMin(r1, r2)) / 2;
+ return (std::max(l1, l2) + std::min(r1, r2)) / 2;
}
// Here we always send in l < SK_Fixed1, and the first alpha we want to compute is alphas[0]
@@ -1107,7 +1107,7 @@
SkAnalyticEdge* riteE = (SkAnalyticEdge*)leftE->fNext;
SkAnalyticEdge* currE = (SkAnalyticEdge*)riteE->fNext;
- SkFixed y = SkTMax(leftE->fUpperY, riteE->fUpperY);
+ SkFixed y = std::max(leftE->fUpperY, riteE->fUpperY);
for (;;) {
// We have to check fLowerY first because some edges might be alone (e.g., there's only
@@ -1155,9 +1155,9 @@
}
local_bot_fixed = std::min(local_bot_fixed, SkIntToFixed(stop_y));
- SkFixed left = SkTMax(leftBound, leftE->fX);
+ SkFixed left = std::max(leftBound, leftE->fX);
SkFixed dLeft = leftE->fDX;
- SkFixed rite = SkTMin(riteBound, riteE->fX);
+ SkFixed rite = std::min(riteBound, riteE->fX);
SkFixed dRite = riteE->fDX;
if (0 == (dLeft | dRite)) {
int fullLeft = SkFixedCeilToInt(left);
@@ -1326,8 +1326,8 @@
// Smooth jumping to integer y may make the last nextLeft/nextRite out of bound.
// Take them back into the bound here.
// Note that we substract kSnapHalf later so we have to add them to leftBound/riteBound
- SkFixed nextLeft = SkTMax(left + SkFixedMul(dLeft, dY), leftBound + kSnapHalf);
- SkFixed nextRite = SkTMin(rite + SkFixedMul(dRite, dY), riteBound + kSnapHalf);
+ SkFixed nextLeft = std::max(left + SkFixedMul(dLeft, dY), leftBound + kSnapHalf);
+ SkFixed nextRite = std::min(rite + SkFixedMul(dRite, dY), riteBound + kSnapHalf);
SkASSERT((left & kSnapMask) >= leftBound && (rite & kSnapMask) <= riteBound &&
(nextLeft & kSnapMask) >= leftBound && (nextRite & kSnapMask) <= riteBound);
blit_trapezoid_row(blitter,
@@ -1472,10 +1472,10 @@
blit_trapezoid_row(
blitter,
y,
- SkTMax(leftE->fSavedX, leftClip),
- SkTMin(riteE->fSavedX, rightClip),
- SkTMax(lowerLeft, leftClip),
- SkTMin(lowerRite, rightClip),
+ std::max(leftE->fSavedX, leftClip),
+ std::min(riteE->fSavedX, rightClip),
+ std::max(lowerLeft, leftClip),
+ std::min(lowerRite, rightClip),
leftE->fSavedDY,
riteE->fSavedDY,
fullAlpha,
@@ -1557,7 +1557,7 @@
bool skipIntersect) {
prevHead->fX = prevHead->fUpperX = leftClip;
nextTail->fX = nextTail->fUpperX = rightClip;
- SkFixed y = SkTMax(prevHead->fNext->fUpperY, SkIntToFixed(start_y));
+ SkFixed y = std::max(prevHead->fNext->fUpperY, SkIntToFixed(start_y));
SkFixed nextNextY = SK_MaxS32;
{
@@ -1596,7 +1596,7 @@
int w = 0;
bool in_interval = isInverse;
SkFixed prevX = prevHead->fX;
- SkFixed nextY = SkTMin(nextNextY, SkFixedCeilToFixed(y + 1));
+ SkFixed nextY = std::min(nextNextY, SkFixedCeilToFixed(y + 1));
bool isIntegralNextY = (nextY & (SK_Fixed1 - 1)) == 0;
SkAnalyticEdge* currE = prevHead->fNext;
SkAnalyticEdge* leftE = prevHead;
@@ -1699,9 +1699,9 @@
} else {
SkFixed rite = currE->fX;
currE->goY(nextY, yShift);
- SkFixed nextLeft = SkTMax(leftClip, leftE->fX);
- rite = SkTMin(rightClip, rite);
- SkFixed nextRite = SkTMin(rightClip, currE->fX);
+ SkFixed nextLeft = std::max(leftClip, leftE->fX);
+ rite = std::min(rightClip, rite);
+ SkFixed nextRite = std::min(rightClip, currE->fX);
blit_trapezoid_row(
blitter,
y >> 16,
@@ -1718,11 +1718,11 @@
(edges_too_close(prevRite, left, leftE->fX) ||
edges_too_close(currE, currE->fNext, nextY))),
true);
- prevRite = SkFixedCeilToInt(SkTMax(rite, currE->fX));
+ prevRite = SkFixedCeilToInt(std::max(rite, currE->fX));
}
} else {
if (isLeft) {
- left = SkTMax(currE->fX, leftClip);
+ left = std::max(currE->fX, leftClip);
leftDY = currE->fDY;
leftE = currE;
leftEnds = leftE->fLowerY == nextY;
@@ -1810,7 +1810,7 @@
y >> 16,
left,
rightClip,
- SkTMax(leftClip, leftE->fX),
+ std::max(leftClip, leftE->fX),
rightClip,
leftDY,
0,
@@ -1915,8 +1915,8 @@
// Otherwise, the edge drift may access an invalid address inside the mask.
SkIRect ir;
path.getBounds().roundOut(&ir);
- leftBound = SkTMax(leftBound, SkIntToFixed(ir.fLeft));
- rightBound = SkTMin(rightBound, SkIntToFixed(ir.fRight));
+ leftBound = std::max(leftBound, SkIntToFixed(ir.fLeft));
+ rightBound = std::min(rightBound, SkIntToFixed(ir.fRight));
}
if (!path.isInverseFillType() && path.isConvex() && count >= 2) {
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 9b21e4b..2c1128a 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -658,7 +658,7 @@
// every pixel row/column is significantly greater than zero. Hence
// Aanlytic AA is not likely to produce visible quality improvements,
// and Analytic AA might be slower than supersampling.
- return path.countPoints() < SkTMax(bounds.width(), bounds.height()) / 2 - 10;
+ return path.countPoints() < std::max(bounds.width(), bounds.height()) / 2 - 10;
#else
if (path.countPoints() >= path.getBounds().height()) {
// SAA is faster than AAA in this case even if there are no
diff --git a/src/core/SkScan_Hairline.cpp b/src/core/SkScan_Hairline.cpp
index f9365ce..589bd1c 100644
--- a/src/core/SkScan_Hairline.cpp
+++ b/src/core/SkScan_Hairline.cpp
@@ -310,7 +310,7 @@
static inline SkScalar max_component(const Sk2s& value) {
SkScalar components[2];
value.store(components);
- return SkTMax(components[0], components[1]);
+ return std::max(components[0], components[1]);
}
static inline int compute_cubic_segs(const SkPoint pts[4]) {
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 755414e..bb53e2c 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -155,8 +155,8 @@
size_t offset, size_t originalOffset)
: fFILE(std::move(file))
, fSize(size)
- , fOffset(SkTMin(offset, fSize))
- , fOriginalOffset(SkTMin(originalOffset, fSize))
+ , fOffset(std::min(offset, fSize))
+ , fOriginalOffset(std::min(originalOffset, fSize))
{ }
SkFILEStream::SkFILEStream(std::shared_ptr<FILE> file, size_t size, size_t offset)
@@ -221,7 +221,7 @@
}
bool SkFILEStream::seek(size_t position) {
- fOffset = SkTMin(SkSafeMath::Add(position, fOriginalOffset), fSize);
+ fOffset = std::min(SkSafeMath::Add(position, fOriginalOffset), fSize);
return true;
}
@@ -237,7 +237,7 @@
} else if (!SkTFitsIn<size_t>(offset)) {
fOffset = fSize;
} else {
- fOffset = SkTMin(SkSafeMath::Add(fOffset, (size_t) offset), fSize);
+ fOffset = std::min(SkSafeMath::Add(fOffset, (size_t) offset), fSize);
}
SkASSERT(fOffset >= fOriginalOffset && fOffset <= fSize);
@@ -524,7 +524,7 @@
if (fTail) {
if (fTail->avail() > 0) {
- size = SkTMin(fTail->avail(), count);
+ size = std::min(fTail->avail(), count);
buffer = fTail->append(buffer, size);
SkASSERT(count >= size);
count -= size;
@@ -536,7 +536,7 @@
fBytesWrittenBeforeTail += fTail->written();
}
- size = SkTMax<size_t>(count, SkDynamicMemoryWStream_MinBlockSize - sizeof(Block));
+ size = std::max<size_t>(count, SkDynamicMemoryWStream_MinBlockSize - sizeof(Block));
size = SkAlign4(size); // ensure we're always a multiple of 4 (see padToAlign4())
Block* block = (Block*)sk_malloc_throw(sizeof(Block) + size);
@@ -752,7 +752,7 @@
size_t bytesLeftToRead = count;
while (fCurrent != nullptr) {
size_t bytesLeftInCurrent = fCurrent->written() - fCurrentOffset;
- size_t bytesFromCurrent = SkTMin(bytesLeftToRead, bytesLeftInCurrent);
+ size_t bytesFromCurrent = std::min(bytesLeftToRead, bytesLeftInCurrent);
if (buffer) {
memcpy(buffer, fCurrent->start() + fCurrentOffset, bytesFromCurrent);
buffer = SkTAddOffset<void>(buffer, bytesFromCurrent);
@@ -777,7 +777,7 @@
size_t peek(void* buff, size_t bytesToPeek) const override {
SkASSERT(buff != nullptr);
- bytesToPeek = SkTMin(bytesToPeek, fSize - fOffset);
+ bytesToPeek = std::min(bytesToPeek, fSize - fOffset);
size_t bytesLeftToPeek = bytesToPeek;
char* buffer = static_cast<char*>(buff);
@@ -785,7 +785,7 @@
size_t currentOffset = fCurrentOffset;
while (bytesLeftToPeek) {
SkASSERT(current);
- size_t bytesFromCurrent = SkTMin(current->written() - currentOffset, bytesLeftToPeek);
+ size_t bytesFromCurrent = std::min(current->written() - currentOffset, bytesLeftToPeek);
memcpy(buffer, current->start() + currentOffset, bytesFromCurrent);
bytesLeftToPeek -= bytesFromCurrent;
buffer += bytesFromCurrent;
diff --git a/src/core/SkStrikeCache.cpp b/src/core/SkStrikeCache.cpp
index f92a98d..f90caa2 100644
--- a/src/core/SkStrikeCache.cpp
+++ b/src/core/SkStrikeCache.cpp
@@ -390,10 +390,10 @@
if (fTotalMemoryUsed > fCacheSizeLimit) {
bytesNeeded = fTotalMemoryUsed - fCacheSizeLimit;
}
- bytesNeeded = SkTMax(bytesNeeded, minBytesNeeded);
+ bytesNeeded = std::max(bytesNeeded, minBytesNeeded);
if (bytesNeeded) {
// no small purges!
- bytesNeeded = SkTMax(bytesNeeded, fTotalMemoryUsed >> 2);
+ bytesNeeded = std::max(bytesNeeded, fTotalMemoryUsed >> 2);
}
int countNeeded = 0;
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index aac6ee2..ec25e75 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -543,7 +543,7 @@
for (int index = 0; index < 3; ++index) {
for (int inner = index + 1; inner < 4; ++inner) {
SkVector testDiff = cubic[inner] - cubic[index];
- SkScalar testMax = SkTMax(SkScalarAbs(testDiff.fX), SkScalarAbs(testDiff.fY));
+ SkScalar testMax = std::max(SkScalarAbs(testDiff.fX), SkScalarAbs(testDiff.fY));
if (ptMax < testMax) {
outer1 = index;
outer2 = inner;
@@ -580,7 +580,7 @@
for (int index = 0; index < 2; ++index) {
for (int inner = index + 1; inner < 3; ++inner) {
SkVector testDiff = quad[inner] - quad[index];
- SkScalar testMax = SkTMax(SkScalarAbs(testDiff.fX), SkScalarAbs(testDiff.fY));
+ SkScalar testMax = std::max(SkScalarAbs(testDiff.fX), SkScalarAbs(testDiff.fY));
if (ptMax < testMax) {
outer1 = index;
outer2 = inner;
@@ -897,9 +897,9 @@
// are small, a straight line is good enough
SkScalar dist1 = pt_to_line(start, end, quadPts->fTangentEnd);
SkScalar dist2 = pt_to_line(end, start, quadPts->fTangentStart);
- if (SkTMax(dist1, dist2) <= fInvResScaleSquared) {
+ if (std::max(dist1, dist2) <= fInvResScaleSquared) {
return STROKER_RESULT(kDegenerate_ResultType, depth, quadPts,
- "SkTMax(dist1=%g, dist2=%g) <= fInvResScaleSquared", dist1, dist2);
+ "std::max(dist1=%g, dist2=%g) <= fInvResScaleSquared", dist1, dist2);
}
return STROKER_RESULT(kSplit_ResultType, depth, quadPts,
"(numerA=%g >= 0) == (numerB=%g >= 0)", numerA, numerB);
@@ -949,19 +949,19 @@
// Return true if the point is close to the bounds of the quad. This is used as a quick reject.
bool SkPathStroker::ptInQuadBounds(const SkPoint quad[3], const SkPoint& pt) const {
- SkScalar xMin = SkTMin(SkTMin(quad[0].fX, quad[1].fX), quad[2].fX);
+ SkScalar xMin = std::min(std::min(quad[0].fX, quad[1].fX), quad[2].fX);
if (pt.fX + fInvResScale < xMin) {
return false;
}
- SkScalar xMax = SkTMax(SkTMax(quad[0].fX, quad[1].fX), quad[2].fX);
+ SkScalar xMax = std::max(std::max(quad[0].fX, quad[1].fX), quad[2].fX);
if (pt.fX - fInvResScale > xMax) {
return false;
}
- SkScalar yMin = SkTMin(SkTMin(quad[0].fY, quad[1].fY), quad[2].fY);
+ SkScalar yMin = std::min(std::min(quad[0].fY, quad[1].fY), quad[2].fY);
if (pt.fY + fInvResScale < yMin) {
return false;
}
- SkScalar yMax = SkTMax(SkTMax(quad[0].fY, quad[1].fY), quad[2].fY);
+ SkScalar yMax = std::max(std::max(quad[0].fY, quad[1].fY), quad[2].fY);
if (pt.fY - fInvResScale > yMax) {
return false;
}
@@ -1143,7 +1143,7 @@
return false; // just abort if projected quad isn't representable
}
#if QUAD_STROKE_APPROX_EXTENDED_DEBUGGING
- SkDEBUGCODE(gMaxRecursion[fFoundTangents] = SkTMax(gMaxRecursion[fFoundTangents],
+ SkDEBUGCODE(gMaxRecursion[fFoundTangents] = std::max(gMaxRecursion[fFoundTangents],
fRecursionDepth + 1));
#endif
if (++fRecursionDepth > kRecursiveLimits[fFoundTangents]) {
@@ -1183,7 +1183,7 @@
return true;
}
#if QUAD_STROKE_APPROX_EXTENDED_DEBUGGING
- SkDEBUGCODE(gMaxRecursion[kConic_RecursiveLimit] = SkTMax(gMaxRecursion[kConic_RecursiveLimit],
+ SkDEBUGCODE(gMaxRecursion[kConic_RecursiveLimit] = std::max(gMaxRecursion[kConic_RecursiveLimit],
fRecursionDepth + 1));
#endif
if (++fRecursionDepth > kRecursiveLimits[kConic_RecursiveLimit]) {
@@ -1215,7 +1215,7 @@
return true;
}
#if QUAD_STROKE_APPROX_EXTENDED_DEBUGGING
- SkDEBUGCODE(gMaxRecursion[kQuad_RecursiveLimit] = SkTMax(gMaxRecursion[kQuad_RecursiveLimit],
+ SkDEBUGCODE(gMaxRecursion[kQuad_RecursiveLimit] = std::max(gMaxRecursion[kQuad_RecursiveLimit],
fRecursionDepth + 1));
#endif
if (++fRecursionDepth > kRecursiveLimits[kQuad_RecursiveLimit]) {
diff --git a/src/core/SkStrokeRec.cpp b/src/core/SkStrokeRec.cpp
index a668dab..bc42941 100644
--- a/src/core/SkStrokeRec.cpp
+++ b/src/core/SkStrokeRec.cpp
@@ -160,10 +160,10 @@
// since we're stroked, outset the rect by the radius (and join type, caps)
SkScalar multiplier = SK_Scalar1;
if (SkPaint::kMiter_Join == join) {
- multiplier = SkTMax(multiplier, miterLimit);
+ multiplier = std::max(multiplier, miterLimit);
}
if (SkPaint::kSquare_Cap == cap) {
- multiplier = SkTMax(multiplier, SK_ScalarSqrt2);
+ multiplier = std::max(multiplier, SK_ScalarSqrt2);
}
return strokeWidth/2 * multiplier;
}
diff --git a/src/core/SkTLList.h b/src/core/SkTLList.h
index 496ee9e..6d51329 100644
--- a/src/core/SkTLList.h
+++ b/src/core/SkTLList.h
@@ -151,7 +151,7 @@
this->validate();
}
- int count() const { return SkTMax(fCount ,0); }
+ int count() const { return std::max(fCount ,0); }
bool isEmpty() const { this->validate(); return 0 == fCount || -1 == fCount; }
bool operator== (const SkTLList& list) const {
diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp
index cab2812..589382b 100644
--- a/src/core/SkWriter32.cpp
+++ b/src/core/SkWriter32.cpp
@@ -75,7 +75,7 @@
void SkWriter32::growToAtLeast(size_t size) {
const bool wasExternal = (fExternal != nullptr) && (fData == fExternal);
- fCapacity = 4096 + SkTMax(size, fCapacity + (fCapacity / 2));
+ fCapacity = 4096 + std::max(size, fCapacity + (fCapacity / 2));
fInternal.realloc(fCapacity);
fData = fInternal.get();
diff --git a/src/core/SkZip.h b/src/core/SkZip.h
index 5561566..d13ecaf 100644
--- a/src/core/SkZip.h
+++ b/src/core/SkZip.h
@@ -191,8 +191,8 @@
size_t maxSize = 0;
for (size_t s : {Span<Ts>::Size(std::forward<Ts>(ts))...}) {
if (s != SIZE_MAX) {
- minSize = SkTMin(minSize, s);
- maxSize = SkTMax(maxSize, s);
+ minSize = std::min(minSize, s);
+ maxSize = std::max(maxSize, s);
}
}
SkASSERT(minSize == maxSize);
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp
index 93ea43f..4ad1165 100644
--- a/src/effects/SkDiscretePathEffect.cpp
+++ b/src/effects/SkDiscretePathEffect.cpp
@@ -103,7 +103,7 @@
} else {
int n = SkScalarRoundToInt(length / fSegLength);
constexpr int kMaxReasonableIterations = 100000;
- n = SkTMin(n, kMaxReasonableIterations);
+ n = std::min(n, kMaxReasonableIterations);
SkScalar delta = length / n;
SkScalar distance = 0;
diff --git a/src/effects/imagefilters/SkArithmeticImageFilter.cpp b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
index 1e91985..2148215 100644
--- a/src/effects/imagefilters/SkArithmeticImageFilter.cpp
+++ b/src/effects/imagefilters/SkArithmeticImageFilter.cpp
@@ -196,7 +196,7 @@
dst->addr(sect.fLeft, sect.fTop),
dst->rowBytes());
*src = SkPixmap(src->info().makeDimensions(sect.size()),
- src->addr(SkTMax(0, -srcDx), SkTMax(0, -srcDy)),
+ src->addr(std::max(0, -srcDx), std::max(0, -srcDy)),
src->rowBytes());
return true;
}
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index fae6224..909d27a 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -705,15 +705,15 @@
r = SkGetPackedR32(*p),
a = SkGetPackedA32(*p);
if (type == MorphType::kDilate) {
- B = SkTMax(b, B);
- G = SkTMax(g, G);
- R = SkTMax(r, R);
- A = SkTMax(a, A);
+ B = std::max(b, B);
+ G = std::max(g, G);
+ R = std::max(r, R);
+ A = std::max(a, A);
} else {
- B = SkTMin(b, B);
- G = SkTMin(g, G);
- R = SkTMin(r, R);
- A = SkTMin(a, A);
+ B = std::min(b, B);
+ G = std::min(g, G);
+ R = std::min(r, R);
+ A = std::min(a, A);
}
}
*dptr = SkPackARGB32(A, R, G, B);
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index fffad92..61f653c 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -704,7 +704,7 @@
: fIsValid(true)
, fWidth(width)
, fHeight(height)
- , fSampleCnt(SkTMax(1, sampleCnt))
+ , fSampleCnt(std::max(1, sampleCnt))
, fStencilBits(0) // We always create stencil buffers internally for vulkan
, fBackend(GrBackendApi::kVulkan)
, fVkInfo(vkInfo, layout.release()) {}
@@ -719,7 +719,7 @@
, fFramebufferOnly(false) // TODO: set this from mtlInfo.fTexture->framebufferOnly
, fWidth(width)
, fHeight(height)
- , fSampleCnt(SkTMax(1, sampleCnt))
+ , fSampleCnt(std::max(1, sampleCnt))
, fStencilBits(0)
, fBackend(GrBackendApi::kMetal)
, fMtlInfo(mtlInfo) {}
@@ -733,7 +733,7 @@
const GrGLFramebufferInfo& glInfo)
: fWidth(width)
, fHeight(height)
- , fSampleCnt(SkTMax(1, sampleCnt))
+ , fSampleCnt(std::max(1, sampleCnt))
, fStencilBits(stencilBits)
, fBackend(GrBackendApi::kOpenGL)
, fGLInfo(glInfo) {
@@ -749,7 +749,7 @@
: fIsValid(true)
, fWidth(width)
, fHeight(height)
- , fSampleCnt(SkTMax(1, sampleCnt))
+ , fSampleCnt(std::max(1, sampleCnt))
, fStencilBits(stencilBits)
, fMockInfo(mockInfo) {}
diff --git a/src/gpu/GrBufferAllocPool.cpp b/src/gpu/GrBufferAllocPool.cpp
index b110e0b..21dc13c 100644
--- a/src/gpu/GrBufferAllocPool.cpp
+++ b/src/gpu/GrBufferAllocPool.cpp
@@ -333,7 +333,7 @@
}
bool GrBufferAllocPool::createBlock(size_t requestSize) {
- size_t size = SkTMax(requestSize, kDefaultBufferSize);
+ size_t size = std::max(requestSize, kDefaultBufferSize);
VALIDATE();
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index f5d9209..1d61665 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -120,7 +120,7 @@
fAllowCoverageCounting = !options.fDisableCoverageCountingPaths;
- fMaxTextureSize = SkTMin(fMaxTextureSize, options.fMaxTextureSizeOverride);
+ fMaxTextureSize = std::min(fMaxTextureSize, options.fMaxTextureSizeOverride);
fMaxTileSize = fMaxTextureSize;
#if GR_TEST_UTILS
// If the max tile override is zero, it means we should use the max texture size.
diff --git a/src/gpu/GrCaps.h b/src/gpu/GrCaps.h
index 97a1957..d98890d 100644
--- a/src/gpu/GrCaps.h
+++ b/src/gpu/GrCaps.h
@@ -204,7 +204,7 @@
// Returns the number of samples to use when performing internal draws to the given config with
// MSAA or mixed samples. If 0, Ganesh should not attempt to use internal multisampling.
int internalMultisampleCount(const GrBackendFormat& format) const {
- return SkTMin(fInternalMultisampleCount, this->maxRenderTargetSampleCount(format));
+ return std::min(fInternalMultisampleCount, this->maxRenderTargetSampleCount(format));
}
virtual bool isFormatAsColorTypeRenderable(GrColorType ct, const GrBackendFormat& format,
diff --git a/src/gpu/GrDataUtils.cpp b/src/gpu/GrDataUtils.cpp
index 82e3c58..6efa24d 100644
--- a/src/gpu/GrDataUtils.cpp
+++ b/src/gpu/GrDataUtils.cpp
@@ -276,8 +276,8 @@
int desiredAlignment = (bytesPerPixel == 3) ? 12 : (bytesPerPixel > 4 ? bytesPerPixel : 4);
for (int currentMipLevel = 1; currentMipLevel < mipLevelCount; ++currentMipLevel) {
- levelDimensions = {SkTMax(1, levelDimensions.width() /2),
- SkTMax(1, levelDimensions.height()/2)};
+ levelDimensions = {std::max(1, levelDimensions.width() /2),
+ std::max(1, levelDimensions.height()/2)};
size_t trimmedSize = levelDimensions.area() * bytesPerPixel;
const size_t alignmentDiff = combinedBufferSize % desiredAlignment;
@@ -317,7 +317,7 @@
}
offset += levelSize;
- dimensions = {SkTMax(1, dimensions.width()/2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width()/2), std::max(1, dimensions.height()/2)};
}
}
diff --git a/src/gpu/GrDistanceFieldGenFromVector.cpp b/src/gpu/GrDistanceFieldGenFromVector.cpp
index b91cb35..a677482 100644
--- a/src/gpu/GrDistanceFieldGenFromVector.cpp
+++ b/src/gpu/GrDistanceFieldGenFromVector.cpp
@@ -631,10 +631,10 @@
SkASSERT((endRow <= height) && "EndRow > height!");
// Clip inside the distance field to avoid overflow
- startColumn = SkTMax(startColumn, 0);
- endColumn = SkTMin(endColumn, width);
- startRow = SkTMax(startRow, 0);
- endRow = SkTMin(endRow, height);
+ startColumn = std::max(startColumn, 0);
+ endColumn = std::min(endColumn, width);
+ startRow = std::max(startRow, 0);
+ endRow = std::min(endRow, height);
// for each row in the padded bounding box
for (int row = startRow; row < endRow; ++row) {
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index e86236c..18d4972 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -660,16 +660,16 @@
SkASSERT(kARGBDimensions[index].width() <= kMaxAtlasDim);
SkASSERT(kARGBDimensions[index].height() <= kMaxAtlasDim);
- fARGBDimensions.set(SkTMin<int>(kARGBDimensions[index].width(), maxTextureSize),
- SkTMin<int>(kARGBDimensions[index].height(), maxTextureSize));
- fMaxTextureSize = SkTMin<int>(maxTextureSize, kMaxAtlasDim);
+ fARGBDimensions.set(std::min<int>(kARGBDimensions[index].width(), maxTextureSize),
+ std::min<int>(kARGBDimensions[index].height(), maxTextureSize));
+ fMaxTextureSize = std::min<int>(maxTextureSize, kMaxAtlasDim);
}
SkISize GrDrawOpAtlasConfig::atlasDimensions(GrMaskFormat type) const {
if (kA8_GrMaskFormat == type) {
// A8 is always 2x the ARGB dimensions, clamped to the max allowed texture size
- return { SkTMin<int>(2 * fARGBDimensions.width(), fMaxTextureSize),
- SkTMin<int>(2 * fARGBDimensions.height(), fMaxTextureSize) };
+ return { std::min<int>(2 * fARGBDimensions.width(), fMaxTextureSize),
+ std::min<int>(2 * fARGBDimensions.height(), fMaxTextureSize) };
} else {
return fARGBDimensions;
}
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index 986b32c..a867fcb 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -427,7 +427,7 @@
: fView(std::move(view)), fSamplerState(samplerState) {
GrSurfaceProxy* proxy = this->proxy();
fSamplerState.setFilterMode(
- SkTMin(samplerState.filter(),
+ std::min(samplerState.filter(),
GrTextureProxy::HighestFilterMode(proxy->backendFormat().textureType())));
}
@@ -441,7 +441,7 @@
fSamplerState = samplerState;
GrSurfaceProxy* surfProxy = this->proxy();
fSamplerState.setFilterMode(
- SkTMin(samplerState.filter(),
+ std::min(samplerState.filter(),
GrTextureProxy::HighestFilterMode(surfProxy->backendFormat().textureType())));
}
@@ -453,7 +453,7 @@
fSamplerState = samplerState;
fSamplerState.setFilterMode(
- SkTMin(samplerState.filter(),
+ std::min(samplerState.filter(),
GrTextureProxy::HighestFilterMode(this->proxy()->backendFormat().textureType())));
}
#endif
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index af856b4..b4fa68f 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -203,7 +203,7 @@
GrProtected isProtected) {
int mipLevelCount = 1;
if (mipMapped == GrMipMapped::kYes) {
- mipLevelCount = 32 - SkCLZ(static_cast<uint32_t>(SkTMax(desc.fWidth, desc.fHeight)));
+ mipLevelCount = 32 - SkCLZ(static_cast<uint32_t>(std::max(desc.fWidth, desc.fHeight)));
}
uint32_t levelClearMask =
this->caps()->shouldInitializeTextures() ? (1 << mipLevelCount) - 1 : 0;
@@ -233,7 +233,7 @@
}
}
- int mipLevelCount = SkTMax(1, texelLevelCount);
+ int mipLevelCount = std::max(1, texelLevelCount);
uint32_t levelClearMask = 0;
if (this->caps()->shouldInitializeTextures()) {
if (texelLevelCount) {
@@ -789,7 +789,7 @@
SkColorType colorType = data->pixmap(0).colorType();
for (int i = 1; i < numMipLevels; ++i) {
- dimensions = {SkTMax(1, dimensions.width()/2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width()/2), std::max(1, dimensions.height()/2)};
if (dimensions != data->pixmap(i).dimensions()) {
return false;
}
diff --git a/src/gpu/GrMesh.h b/src/gpu/GrMesh.h
index b076785..c3da80b 100644
--- a/src/gpu/GrMesh.h
+++ b/src/gpu/GrMesh.h
@@ -250,7 +250,7 @@
SkASSERT(fIndexData.fPatternRepeatCount > 0);
int baseRepetition = 0;
do {
- int repeatCount = SkTMin(fPatternData.fMaxPatternRepetitionsInIndexBuffer,
+ int repeatCount = std::min(fPatternData.fMaxPatternRepetitionsInIndexBuffer,
fIndexData.fPatternRepeatCount - baseRepetition);
int indexCount = fIndexData.fIndexCount * repeatCount;
// A patterned index buffer must contain indices in the range [0..vertexCount].
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 12d658f..7f26afc 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -809,7 +809,7 @@
op->bounds().fRight, op->bounds().fBottom);
GrOP_INFO(SkTabString(op->dumpInfo(), 1).c_str());
GrOP_INFO("\tOutcome:\n");
- int maxCandidates = SkTMin(kMaxOpChainDistance, fOpChains.count());
+ int maxCandidates = std::min(kMaxOpChainDistance, fOpChains.count());
if (maxCandidates) {
int i = 0;
while (true) {
@@ -846,7 +846,7 @@
for (int i = 0; i < fOpChains.count() - 1; ++i) {
OpChain& chain = fOpChains[i];
- int maxCandidateIdx = SkTMin(i + kMaxOpChainDistance, fOpChains.count() - 1);
+ int maxCandidateIdx = std::min(i + kMaxOpChainDistance, fOpChains.count() - 1);
int j = i + 1;
while (true) {
OpChain& candidate = fOpChains[j];
diff --git a/src/gpu/GrPersistentCacheUtils.h b/src/gpu/GrPersistentCacheUtils.h
index b460184..f38d78b 100644
--- a/src/gpu/GrPersistentCacheUtils.h
+++ b/src/gpu/GrPersistentCacheUtils.h
@@ -40,7 +40,7 @@
writer.write32(shaderType);
for (int i = 0; i < kGrShaderTypeCount; ++i) {
writer.writeString(shaders[i].c_str(), shaders[i].size());
- writer.writePad(&inputs[SkTMin(i, numInputs - 1)], sizeof(SkSL::Program::Inputs));
+ writer.writePad(&inputs[std::min(i, numInputs - 1)], sizeof(SkSL::Program::Inputs));
}
writer.writeBool(SkToBool(meta));
if (meta) {
diff --git a/src/gpu/GrPrimitiveProcessor.cpp b/src/gpu/GrPrimitiveProcessor.cpp
index ade7e4d..e5f01be 100644
--- a/src/gpu/GrPrimitiveProcessor.cpp
+++ b/src/gpu/GrPrimitiveProcessor.cpp
@@ -55,7 +55,7 @@
static inline GrSamplerState::Filter clamp_filter(GrTextureType type,
GrSamplerState::Filter requestedFilter) {
if (GrTextureTypeHasRestrictedSampling(type)) {
- return SkTMin(requestedFilter, GrSamplerState::Filter::kBilerp);
+ return std::min(requestedFilter, GrSamplerState::Filter::kBilerp);
}
return requestedFilter;
}
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 5360dcd..008e2ba 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -561,10 +561,10 @@
if (SkRRect::kComplex_Type == clipRRect.getType()) {
const SkVector& insetTR = clipRRect.radii(SkRRect::kUpperRight_Corner);
const SkVector& insetBL = clipRRect.radii(SkRRect::kLowerLeft_Corner);
- insetTL.fX = SkTMax(insetTL.x(), insetBL.x());
- insetTL.fY = SkTMax(insetTL.y(), insetTR.y());
- insetBR.fX = SkTMax(insetBR.x(), insetTR.x());
- insetBR.fY = SkTMax(insetBR.y(), insetBL.y());
+ insetTL.fX = std::max(insetTL.x(), insetBL.x());
+ insetTL.fY = std::max(insetTL.y(), insetTR.y());
+ insetBR.fX = std::max(insetBR.x(), insetTR.x());
+ insetBR.fY = std::max(insetBR.y(), insetBL.y());
}
const SkRect& bounds = clipRRect.getBounds();
if (insetTL.x() + insetBR.x() >= bounds.width() ||
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 655739f..c49927c 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1330,11 +1330,11 @@
SkScalar maxOffset;
if (rrect.isRect()) {
// Manhattan distance works better for rects
- maxOffset = SkTMax(SkTMax(SkTAbs(spotShadowRRect.rect().fLeft -
+ maxOffset = std::max(std::max(SkTAbs(spotShadowRRect.rect().fLeft -
rrect.rect().fLeft),
SkTAbs(spotShadowRRect.rect().fTop -
rrect.rect().fTop)),
- SkTMax(SkTAbs(spotShadowRRect.rect().fRight -
+ std::max(SkTAbs(spotShadowRRect.rect().fRight -
rrect.rect().fRight),
SkTAbs(spotShadowRRect.rect().fBottom -
rrect.rect().fBottom)));
@@ -1348,10 +1348,10 @@
rrect.rect().fRight - dr,
spotShadowRRect.rect().fBottom -
rrect.rect().fBottom - dr);
- maxOffset = SkScalarSqrt(SkTMax(SkPointPriv::LengthSqd(upperLeftOffset),
+ maxOffset = SkScalarSqrt(std::max(SkPointPriv::LengthSqd(upperLeftOffset),
SkPointPriv::LengthSqd(lowerRightOffset))) + dr;
}
- insetWidth += SkTMax(blurOutset, maxOffset);
+ insetWidth += std::max(blurOutset, maxOffset);
}
// Outset the shadow rrect to the border of the penumbra
diff --git a/src/gpu/GrRenderTargetProxy.h b/src/gpu/GrRenderTargetProxy.h
index b67554c..69c647c 100644
--- a/src/gpu/GrRenderTargetProxy.h
+++ b/src/gpu/GrRenderTargetProxy.h
@@ -41,7 +41,7 @@
*/
void setNeedsStencil(int8_t numStencilSamples) {
SkASSERT(numStencilSamples >= fSampleCnt);
- fNumStencilSamples = SkTMax(numStencilSamples, fNumStencilSamples);
+ fNumStencilSamples = std::max(numStencilSamples, fNumStencilSamples);
}
/**
diff --git a/src/gpu/GrResourceAllocator.cpp b/src/gpu/GrResourceAllocator.cpp
index feaf900..1b46f42 100644
--- a/src/gpu/GrResourceAllocator.cpp
+++ b/src/gpu/GrResourceAllocator.cpp
@@ -451,8 +451,8 @@
cur->end(),
cur->proxy()->priv().getProxyRefCnt(),
cur->proxy()->testingOnly_getBackingRefCnt());
- min = SkTMin(min, cur->start());
- max = SkTMax(max, cur->end());
+ min = std::min(min, cur->start());
+ max = std::max(max, cur->end());
}
// Draw a graph of the useage intervals
diff --git a/src/gpu/GrResourceCache.cpp b/src/gpu/GrResourceCache.cpp
index 5b0fafc..b42762f 100644
--- a/src/gpu/GrResourceCache.cpp
+++ b/src/gpu/GrResourceCache.cpp
@@ -145,8 +145,8 @@
SkDEBUGCODE(++fCount;)
fBytes += size;
#if GR_CACHE_STATS
- fHighWaterCount = SkTMax(this->getResourceCount(), fHighWaterCount);
- fHighWaterBytes = SkTMax(fBytes, fHighWaterBytes);
+ fHighWaterCount = std::max(this->getResourceCount(), fHighWaterCount);
+ fHighWaterBytes = std::max(fBytes, fHighWaterBytes);
#endif
if (GrBudgetedType::kBudgeted == resource->resourcePriv().budgetedType()) {
++fBudgetedCount;
@@ -154,8 +154,8 @@
TRACE_COUNTER2("skia.gpu.cache", "skia budget", "used",
fBudgetedBytes, "free", fMaxBytes - fBudgetedBytes);
#if GR_CACHE_STATS
- fBudgetedHighWaterCount = SkTMax(fBudgetedCount, fBudgetedHighWaterCount);
- fBudgetedHighWaterBytes = SkTMax(fBudgetedBytes, fBudgetedHighWaterBytes);
+ fBudgetedHighWaterCount = std::max(fBudgetedCount, fBudgetedHighWaterCount);
+ fBudgetedHighWaterBytes = std::max(fBudgetedBytes, fBudgetedHighWaterBytes);
#endif
}
if (resource->resourcePriv().getScratchKey().isValid() &&
@@ -479,8 +479,8 @@
++fBudgetedCount;
fBudgetedBytes += size;
#if GR_CACHE_STATS
- fBudgetedHighWaterBytes = SkTMax(fBudgetedBytes, fBudgetedHighWaterBytes);
- fBudgetedHighWaterCount = SkTMax(fBudgetedCount, fBudgetedHighWaterCount);
+ fBudgetedHighWaterBytes = std::max(fBudgetedBytes, fBudgetedHighWaterBytes);
+ fBudgetedHighWaterCount = std::max(fBudgetedCount, fBudgetedHighWaterCount);
#endif
if (!resource->resourcePriv().isPurgeable() && !resource->cacheAccess().hasRef()) {
++fNumBudgetedResourcesFlushWillMakePurgeable;
@@ -580,7 +580,7 @@
void GrResourceCache::purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources) {
- const size_t tmpByteBudget = SkTMax((size_t)0, fBytes - bytesToPurge);
+ const size_t tmpByteBudget = std::max((size_t)0, fBytes - bytesToPurge);
bool stillOverbudget = tmpByteBudget < fBytes;
if (preferScratchResources && bytesToPurge < fPurgeableBytes) {
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 2b43fdf..25835a7 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -196,7 +196,7 @@
auto adjust = [](int value) {
static const int kMagicTol = 1024;
- value = SkTMax(kMinScratchTextureSize, value);
+ value = std::max(kMinScratchTextureSize, value);
if (SkIsPow2(value)) {
return value;
@@ -477,7 +477,7 @@
}
// bin by pow2 with a reasonable min
static const size_t MIN_SIZE = 1 << 12;
- size_t allocSize = SkTMax(MIN_SIZE, GrNextSizePow2(size));
+ size_t allocSize = std::max(MIN_SIZE, GrNextSizePow2(size));
GrScratchKey key;
GrGpuBuffer::ComputeScratchKeyForDynamicVBO(allocSize, intendedType, &key);
diff --git a/src/gpu/GrStencilSettings.cpp b/src/gpu/GrStencilSettings.cpp
index 41957ff..65dca87 100644
--- a/src/gpu/GrStencilSettings.cpp
+++ b/src/gpu/GrStencilSettings.cpp
@@ -177,8 +177,8 @@
int clipBit = 1 << (numStencilBits - 1);
int userMask = clipBit - 1;
- GrUserStencilOp maxOp = SkTMax(user.fPassOp, user.fFailOp);
- SkDEBUGCODE(GrUserStencilOp otherOp = SkTMin(user.fPassOp, user.fFailOp);)
+ GrUserStencilOp maxOp = std::max(user.fPassOp, user.fFailOp);
+ SkDEBUGCODE(GrUserStencilOp otherOp = std::min(user.fPassOp, user.fFailOp);)
if (maxOp <= kLastUserOnlyStencilOp) {
// Ops that only modify user bits.
fWriteMask = user.fWriteMask & userMask;
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 024b9ef..e387a06 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -1203,7 +1203,7 @@
SkArenaAlloc& alloc) {
TESS_LOG("found coincident verts at %g, %g; merging %g into %g\n",
src->fPoint.fX, src->fPoint.fY, src->fID, dst->fID);
- dst->fAlpha = SkTMax(src->fAlpha, dst->fAlpha);
+ dst->fAlpha = std::max(src->fAlpha, dst->fAlpha);
if (src->fPartner) {
src->fPartner->fPartner = dst;
}
@@ -1327,7 +1327,7 @@
rewind(activeEdges, current, top ? top : v, c);
split_edge(left, v, activeEdges, current, c, alloc);
split_edge(right, v, activeEdges, current, c, alloc);
- v->fAlpha = SkTMax(v->fAlpha, alpha);
+ v->fAlpha = std::max(v->fAlpha, alpha);
return true;
}
return intersect_edge_pair(left, right, activeEdges, current, c, alloc);
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 39a2d47..37f5d65 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -30,10 +30,10 @@
bool addRect(int w, int h, SkIPoint16* loc, int maxAtlasSize) {
// Pad all paths except those that are expected to take up an entire physical texture.
if (w < maxAtlasSize) {
- w = SkTMin(w + kPadding, maxAtlasSize);
+ w = std::min(w + kPadding, maxAtlasSize);
}
if (h < maxAtlasSize) {
- h = SkTMin(h + kPadding, maxAtlasSize);
+ h = std::min(h + kPadding, maxAtlasSize);
}
if (!fRectanizer.addRect(w, h, loc)) {
return false;
@@ -85,7 +85,7 @@
GrCCAtlas::GrCCAtlas(CoverageType coverageType, const Specs& specs, const GrCaps& caps)
: fCoverageType(coverageType)
- , fMaxTextureSize(SkTMax(SkTMax(specs.fMinHeight, specs.fMinWidth),
+ , fMaxTextureSize(std::max(std::max(specs.fMinHeight, specs.fMinWidth),
specs.fMaxPreferredTextureSize)) {
// Caller should have cropped any paths to the destination render target instead of asking for
// an atlas larger than maxRenderTargetSize.
@@ -94,7 +94,7 @@
// Begin with the first pow2 dimensions whose area is theoretically large enough to contain the
// pending paths, favoring height over width if necessary.
- int log2area = SkNextLog2(SkTMax(specs.fApproxNumPixels, 1));
+ int log2area = SkNextLog2(std::max(specs.fApproxNumPixels, 1));
fHeight = 1 << ((log2area + 1) / 2);
fWidth = 1 << (log2area / 2);
@@ -104,8 +104,8 @@
if (fWidth < specs.fMinWidth || fHeight < specs.fMinHeight) {
// They want to stuff a particularly large path into the atlas. Just punt and go with their
// min width and height. The atlas will grow as needed.
- fWidth = SkTMin(specs.fMinWidth + kPadding, fMaxTextureSize);
- fHeight = SkTMin(specs.fMinHeight + kPadding, fMaxTextureSize);
+ fWidth = std::min(specs.fMinWidth + kPadding, fMaxTextureSize);
+ fHeight = std::min(specs.fMinHeight + kPadding, fMaxTextureSize);
}
fTopNode = std::make_unique<Node>(nullptr, 0, 0, fWidth, fHeight);
@@ -139,8 +139,8 @@
}
offset->set(location.x() - devIBounds.left(), location.y() - devIBounds.top());
- fDrawBounds.fWidth = SkTMax(fDrawBounds.width(), location.x() + devIBounds.width());
- fDrawBounds.fHeight = SkTMax(fDrawBounds.height(), location.y() + devIBounds.height());
+ fDrawBounds.fWidth = std::max(fDrawBounds.width(), location.x() + devIBounds.width());
+ fDrawBounds.fHeight = std::max(fDrawBounds.height(), location.y() + devIBounds.height());
return true;
}
@@ -158,11 +158,11 @@
}
if (fHeight <= fWidth) {
int top = fHeight;
- fHeight = SkTMin(fHeight * 2, fMaxTextureSize);
+ fHeight = std::min(fHeight * 2, fMaxTextureSize);
fTopNode = std::make_unique<Node>(std::move(fTopNode), 0, top, fWidth, fHeight);
} else {
int left = fWidth;
- fWidth = SkTMin(fWidth * 2, fMaxTextureSize);
+ fWidth = std::min(fWidth * 2, fMaxTextureSize);
fTopNode = std::make_unique<Node>(std::move(fTopNode), left, 0, fWidth, fHeight);
}
} while (!fTopNode->addRect(w, h, loc, fMaxTextureSize));
@@ -217,7 +217,7 @@
SkASSERT(!fTextureProxy->isInstantiated()); // This method should only be called once.
// Caller should have cropped any paths to the destination render target instead of asking for
// an atlas larger than maxRenderTargetSize.
- SkASSERT(SkTMax(fHeight, fWidth) <= fMaxTextureSize);
+ SkASSERT(std::max(fHeight, fWidth) <= fMaxTextureSize);
SkASSERT(fMaxTextureSize <= onFlushRP->caps()->maxRenderTargetSize());
// Finalize the content size of our proxy. The GPU can potentially make optimizations if it
diff --git a/src/gpu/ccpr/GrCCAtlas.h b/src/gpu/ccpr/GrCCAtlas.h
index 2ad4061..06909ae 100644
--- a/src/gpu/ccpr/GrCCAtlas.h
+++ b/src/gpu/ccpr/GrCCAtlas.h
@@ -169,8 +169,8 @@
};
inline void GrCCAtlas::Specs::accountForSpace(int width, int height) {
- fMinWidth = SkTMax(width, fMinWidth);
- fMinHeight = SkTMax(height, fMinHeight);
+ fMinWidth = std::max(width, fMinWidth);
+ fMinHeight = std::max(height, fMinHeight);
fApproxNumPixels += (width + kPadding) * (height + kPadding);
}
diff --git a/src/gpu/ccpr/GrCCDrawPathsOp.cpp b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
index d1389cf..4dbe087 100644
--- a/src/gpu/ccpr/GrCCDrawPathsOp.cpp
+++ b/src/gpu/ccpr/GrCCDrawPathsOp.cpp
@@ -41,7 +41,7 @@
}
std::unique_ptr<GrCCDrawPathsOp> op;
- float conservativeSize = SkTMax(conservativeDevBounds.height(), conservativeDevBounds.width());
+ float conservativeSize = std::max(conservativeDevBounds.height(), conservativeDevBounds.width());
if (conservativeSize > GrCoverageCountingPathRenderer::kPathCropThreshold) {
// The path is too large. Crop it or analytic AA can run out of fp32 precision.
SkPath croppedDevPath;
@@ -80,7 +80,7 @@
GrPaint&& paint) {
// The path itself should have been cropped if larger than kPathCropThreshold. If it had a
// stroke, that would have further inflated its draw bounds.
- SkASSERT(SkTMax(conservativeDevBounds.height(), conservativeDevBounds.width()) <
+ SkASSERT(std::max(conservativeDevBounds.height(), conservativeDevBounds.width()) <
GrCoverageCountingPathRenderer::kPathCropThreshold +
GrCoverageCountingPathRenderer::kMaxBoundsInflationFromStroke*2 + 1);
@@ -286,7 +286,7 @@
return false; // Don't cache a path mask until at least its second hit.
}
- int shapeMaxDimension = SkTMax(
+ int shapeMaxDimension = std::max(
fShapeConservativeIBounds.height(), fShapeConservativeIBounds.width());
if (shapeMaxDimension > maxRenderTargetSize) {
return false; // This path isn't cachable.
diff --git a/src/gpu/ccpr/GrCCFillGeometry.cpp b/src/gpu/ccpr/GrCCFillGeometry.cpp
index 75b7fd0..68ad448 100644
--- a/src/gpu/ccpr/GrCCFillGeometry.cpp
+++ b/src/gpu/ccpr/GrCCFillGeometry.cpp
@@ -795,7 +795,7 @@
fVerbs.push_back(Verb::kEndOpenContour);
}
- fCurrContourTallies.fTriangles = SkTMax(fanSize - 2, 0);
+ fCurrContourTallies.fTriangles = std::max(fanSize - 2, 0);
SkDEBUGCODE(fBuildingContour = false);
return fCurrContourTallies;
diff --git a/src/gpu/ccpr/GrCCFiller.cpp b/src/gpu/ccpr/GrCCFiller.cpp
index ec61966..5295104 100644
--- a/src/gpu/ccpr/GrCCFiller.cpp
+++ b/src/gpu/ccpr/GrCCFiller.cpp
@@ -210,7 +210,7 @@
const auto& lastBatch = fBatches.back();
int maxMeshes = 1 + fScissorSubBatches.count() - lastBatch.fEndScissorSubBatchIdx;
- fMaxMeshesPerDraw = SkTMax(fMaxMeshesPerDraw, maxMeshes);
+ fMaxMeshesPerDraw = std::max(fMaxMeshesPerDraw, maxMeshes);
const auto& lastScissorSubBatch = fScissorSubBatches[lastBatch.fEndScissorSubBatchIdx - 1];
PrimitiveTallies batchTotalCounts = fTotalPrimitiveCounts[(int)GrScissorTest::kDisabled] -
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.cpp b/src/gpu/ccpr/GrCCPerFlushResources.cpp
index d4788a6..bc3e8ac 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.cpp
+++ b/src/gpu/ccpr/GrCCPerFlushResources.cpp
@@ -171,7 +171,7 @@
// Overallocate by one point so we can call Sk4f::Store at the final SkPoint in the array.
// (See transform_path_pts below.)
// FIXME: instead use built-in instructions to write only the first two lanes of an Sk4f.
- : fLocalDevPtsBuffer(SkTMax(specs.fRenderedPathStats[kFillIdx].fMaxPointsPerPath,
+ : fLocalDevPtsBuffer(std::max(specs.fRenderedPathStats[kFillIdx].fMaxPointsPerPath,
specs.fRenderedPathStats[kStrokeIdx].fMaxPointsPerPath) + 1)
, fFiller((CoverageType::kFP16_CoverageCount == coverageType)
? GrCCFiller::Algorithm::kCoverageCount
diff --git a/src/gpu/ccpr/GrCCPerFlushResources.h b/src/gpu/ccpr/GrCCPerFlushResources.h
index ba3878a..8f90946 100644
--- a/src/gpu/ccpr/GrCCPerFlushResources.h
+++ b/src/gpu/ccpr/GrCCPerFlushResources.h
@@ -193,7 +193,7 @@
};
inline void GrCCRenderedPathStats::statPath(const SkPath& path) {
- fMaxPointsPerPath = SkTMax(fMaxPointsPerPath, path.countPoints());
+ fMaxPointsPerPath = std::max(fMaxPointsPerPath, path.countPoints());
fNumTotalSkPoints += path.countPoints();
fNumTotalSkVerbs += path.countVerbs();
fNumTotalConicWeights += SkPathPriv::ConicWeightCnt(path);
diff --git a/src/gpu/ccpr/GrCCStrokeGeometry.cpp b/src/gpu/ccpr/GrCCStrokeGeometry.cpp
index 40884d7..2fbd595 100644
--- a/src/gpu/ccpr/GrCCStrokeGeometry.cpp
+++ b/src/gpu/ccpr/GrCCStrokeGeometry.cpp
@@ -82,7 +82,7 @@
// Find the angle of curvature where the arc height above a simple line from point A to point B
// is equal to kMaxErrorFromLinearization.
- float r = SkTMax(1 - kMaxErrorFromLinearization / fCurrStrokeRadius, 0.f);
+ float r = std::max(1 - kMaxErrorFromLinearization / fCurrStrokeRadius, 0.f);
fMaxCurvatureCosTheta = 2*r*r - 1;
fCurrContourFirstPtIdx = -1;
@@ -155,7 +155,7 @@
// Decide how many flat line segments to chop the curve into.
int numSegments = wangs_formula_quadratic(p0, p1, p2);
- numSegments = SkTMin(numSegments, 1 << kMaxNumLinearSegmentsLog2);
+ numSegments = std::min(numSegments, 1 << kMaxNumLinearSegmentsLog2);
if (numSegments <= 1) {
this->rotateTo(leftJoinVerb, normals[0]);
this->lineTo(Verb::kInternalRoundJoin, P[2]);
@@ -283,7 +283,7 @@
// Decide how many flat line segments to chop the curve into.
int numSegments = wangs_formula_cubic(p0, p1, p2, p3);
- numSegments = SkTMin(numSegments, 1 << kMaxNumLinearSegmentsLog2);
+ numSegments = std::min(numSegments, 1 << kMaxNumLinearSegmentsLog2);
if (numSegments <= 1) {
this->rotateTo(leftJoinVerb, normals[0]);
this->lineTo(leftJoinVerb, P[3]);
diff --git a/src/gpu/ccpr/GrCCStroker.cpp b/src/gpu/ccpr/GrCCStroker.cpp
index 000e530..540e9b0 100644
--- a/src/gpu/ccpr/GrCCStroker.cpp
+++ b/src/gpu/ccpr/GrCCStroker.cpp
@@ -569,7 +569,7 @@
}
int start = (fBatches.count() < 2) ? 0 : fBatches[fBatches.count() - 2].fEndScissorSubBatch;
int end = fBatches.back().fEndScissorSubBatch;
- fMaxNumScissorSubBatches = SkTMax(fMaxNumScissorSubBatches, end - start);
+ fMaxNumScissorSubBatches = std::max(fMaxNumScissorSubBatches, end - start);
fHasOpenBatch = false;
return fBatches.count() - 1;
}
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index ab13d86..9ed9c10 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -206,7 +206,7 @@
if (!clipPath.isInitialized()) {
// This ClipPath was just created during lookup. Initialize it.
const SkRect& pathDevBounds = deviceSpacePath.getBounds();
- if (SkTMax(pathDevBounds.height(), pathDevBounds.width()) > kPathCropThreshold) {
+ if (std::max(pathDevBounds.height(), pathDevBounds.width()) > kPathCropThreshold) {
// The path is too large. Crop it or analytic AA can run out of fp32 precision.
SkPath croppedPath;
int maxRTSize = caps.maxRenderTargetSize();
@@ -243,10 +243,10 @@
GrCCPerFlushResourceSpecs specs;
int maxPreferredRTSize = onFlushRP->caps()->maxPreferredRenderTargetSize();
- specs.fCopyAtlasSpecs.fMaxPreferredTextureSize = SkTMin(2048, maxPreferredRTSize);
+ specs.fCopyAtlasSpecs.fMaxPreferredTextureSize = std::min(2048, maxPreferredRTSize);
SkASSERT(0 == specs.fCopyAtlasSpecs.fMinTextureSize);
specs.fRenderedAtlasSpecs.fMaxPreferredTextureSize = maxPreferredRTSize;
- specs.fRenderedAtlasSpecs.fMinTextureSize = SkTMin(512, maxPreferredRTSize);
+ specs.fRenderedAtlasSpecs.fMinTextureSize = std::min(512, maxPreferredRTSize);
// Move the per-opsTask paths that are about to be flushed from fPendingPaths to fFlushingPaths,
// and count them up so we can preallocate buffers.
@@ -367,7 +367,7 @@
// Inflate for a minimum stroke width of 1. In some cases when the stroke is less than 1px
// wide, we may inflate it to 1px and instead reduce the opacity.
*inflationRadius = SkStrokeRec::GetInflationRadius(
- stroke.getJoin(), stroke.getMiter(), stroke.getCap(), SkTMax(strokeDevWidth, 1.f));
+ stroke.getJoin(), stroke.getMiter(), stroke.getCap(), std::max(strokeDevWidth, 1.f));
}
return strokeDevWidth;
}
diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp
index 693a423..1d364e2 100644
--- a/src/gpu/dawn/GrDawnGpu.cpp
+++ b/src/gpu/dawn/GrDawnGpu.cpp
@@ -345,8 +345,8 @@
dstTexture.origin = {0, 0, 0};
wgpu::Extent3D copySize = {(uint32_t) w, (uint32_t) h, 1};
copyEncoder.CopyBufferToTexture(&srcBuffer, &dstTexture, ©Size);
- w = SkTMax(1, w / 2);
- h = SkTMax(1, h / 2);
+ w = std::max(1, w / 2);
+ h = std::max(1, h / 2);
}
wgpu::CommandBuffer cmdBuf = copyEncoder.Finish();
fQueue.Submit(1, &cmdBuf);
diff --git a/src/gpu/dawn/GrDawnStencilAttachment.cpp b/src/gpu/dawn/GrDawnStencilAttachment.cpp
index b96107b..09e8cfd 100644
--- a/src/gpu/dawn/GrDawnStencilAttachment.cpp
+++ b/src/gpu/dawn/GrDawnStencilAttachment.cpp
@@ -53,7 +53,7 @@
uint64_t size = this->width();
size *= this->height();
size *= 32;
- size *= SkTMax(1,this->numSamples());
+ size *= std::max(1,this->numSamples());
return static_cast<size_t>(size / 8);
}
diff --git a/src/gpu/dawn/GrDawnTexture.cpp b/src/gpu/dawn/GrDawnTexture.cpp
index 7515c23..81f898e 100644
--- a/src/gpu/dawn/GrDawnTexture.cpp
+++ b/src/gpu/dawn/GrDawnTexture.cpp
@@ -172,7 +172,7 @@
copyEncoder.CopyBufferToTexture(&srcBuffer, &dstTexture, ©Size);
x /= 2;
y /= 2;
- width = SkTMax(1u, width / 2);
- height = SkTMax(1u, height / 2);
+ width = std::max(1u, width / 2);
+ height = std::max(1u, height / 2);
}
}
diff --git a/src/gpu/dawn/GrDawnUniformHandler.cpp b/src/gpu/dawn/GrDawnUniformHandler.cpp
index 558fc75..8701b96 100644
--- a/src/gpu/dawn/GrDawnUniformHandler.cpp
+++ b/src/gpu/dawn/GrDawnUniformHandler.cpp
@@ -188,7 +188,7 @@
uint32_t uniformOffset = *currentOffset + offsetDiff;
SkASSERT(sizeof(float) == 4);
if (arrayCount) {
- uint32_t elementSize = SkTMax<uint32_t>(16, grsltype_to_size(type));
+ uint32_t elementSize = std::max<uint32_t>(16, grsltype_to_size(type));
SkASSERT(0 == (elementSize & 0xF));
*currentOffset = uniformOffset + elementSize * arrayCount;
} else {
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index f3a6be4..864e74c 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -167,7 +167,7 @@
GrSamplerState params) {
SkASSERT(numActiveViews <= kMaxTextures);
// Just to make sure we don't try to add too many proxies
- numActiveViews = SkTMin(numActiveViews, kMaxTextures);
+ numActiveViews = std::min(numActiveViews, kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
fAtlasDimensions = views[0].proxy()->dimensions();
diff --git a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
index 6010369..33b6171 100644
--- a/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
+++ b/src/gpu/effects/GrCircleBlurFragmentProcessor.fp
@@ -203,7 +203,7 @@
// half-plane. Similarly, in the extreme high ratio cases circle becomes a point WRT to the
// Guassian and the profile texture is a just a Gaussian evaluation. However, we haven't yet
// implemented this latter optimization.
- sigmaToCircleRRatio = SkTMin(sigmaToCircleRRatio, 8.f);
+ sigmaToCircleRRatio = std::min(sigmaToCircleRRatio, 8.f);
SkFixed sigmaToCircleRRatioFixed;
static const SkScalar kHalfPlaneThreshold = 0.1f;
bool useHalfPlaneApprox = false;
diff --git a/src/gpu/effects/GrCircleEffect.fp b/src/gpu/effects/GrCircleEffect.fp
index 957497a..ac06c7c 100644
--- a/src/gpu/effects/GrCircleEffect.fp
+++ b/src/gpu/effects/GrCircleEffect.fp
@@ -35,7 +35,7 @@
if (GrProcessorEdgeTypeIsInverseFill((GrClipEdgeType) edgeType)) {
effectiveRadius -= 0.5f;
// When the radius is 0.5 effectiveRadius is 0 which causes an inf * 0 in the shader.
- effectiveRadius = SkTMax(0.001f, effectiveRadius);
+ effectiveRadius = std::max(0.001f, effectiveRadius);
} else {
effectiveRadius += 0.5f;
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.fp b/src/gpu/effects/GrConfigConversionEffect.fp
index 22f4134..1ac027f 100644
--- a/src/gpu/effects/GrConfigConversionEffect.fp
+++ b/src/gpu/effects/GrConfigConversionEffect.fp
@@ -30,9 +30,9 @@
for (int x = 0; x < kSize; ++x) {
uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[kSize*y + x]);
color[3] = y;
- color[2] = SkTMin(x, y);
- color[1] = SkTMin(x, y);
- color[0] = SkTMin(x, y);
+ color[2] = std::min(x, y);
+ color[1] = std::min(x, y);
+ color[0] = std::min(x, y);
}
}
memset(firstRead, 0, kSize * kSize * sizeof(uint32_t));
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index f8cab87..8eb7733 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -255,7 +255,7 @@
GrSamplerState params) {
SkASSERT(numViews <= kMaxTextures);
// Just to make sure we don't try to add too many proxies
- numViews = SkTMin(numViews, kMaxTextures);
+ numViews = std::min(numViews, kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
fAtlasDimensions = views[0].proxy()->dimensions();
@@ -549,7 +549,7 @@
GrSamplerState params) {
SkASSERT(numViews <= kMaxTextures);
// Just to make sure we don't try to add too many proxies
- numViews = SkTMin(numViews, kMaxTextures);
+ numViews = std::min(numViews, kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
fAtlasDimensions = views[0].proxy()->dimensions();
@@ -873,7 +873,7 @@
GrSamplerState params) {
SkASSERT(numViews <= kMaxTextures);
// Just to make sure we don't try to add too many proxies
- numViews = SkTMin(numViews, kMaxTextures);
+ numViews = std::min(numViews, kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
fAtlasDimensions = views[0].proxy()->dimensions();
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 335f67e..1dda0c9 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -632,7 +632,7 @@
rect.fRight -= r1.fX;
rect.fBottom -= r1.fY;
if (fScaleUniform.isValid()) {
- float scale = SkTMax(SkTMax(r0.fX, r0.fY), SkTMax(r1.fX, r1.fY));
+ float scale = std::max(std::max(r0.fX, r0.fY), std::max(r1.fX, r1.fY));
float scaleSqd = scale * scale;
pdman.set4f(fInvRadiiSqdUniform, scaleSqd / (r0.fX * r0.fX),
scaleSqd / (r0.fY * r0.fY),
diff --git a/src/gpu/effects/GrRectBlurEffect.fp b/src/gpu/effects/GrRectBlurEffect.fp
index 707912b..5ce2c64 100644
--- a/src/gpu/effects/GrRectBlurEffect.fp
+++ b/src/gpu/effects/GrRectBlurEffect.fp
@@ -54,7 +54,7 @@
// texels for each dst pixel.
int minWidth = 2 * sk_float_ceil2int(sixSigma);
// Bin by powers of 2 with a minimum so we get good profile reuse.
- int width = SkTMax(SkNextPow2(minWidth), 32);
+ int width = std::max(SkNextPow2(minWidth), 32);
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
diff --git a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
index 80acea4..68eeb04 100644
--- a/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
+++ b/src/gpu/effects/generated/GrCircleBlurFragmentProcessor.cpp
@@ -180,7 +180,7 @@
// half-plane. Similarly, in the extreme high ratio cases circle becomes a point WRT to the
// Guassian and the profile texture is a just a Gaussian evaluation. However, we haven't yet
// implemented this latter optimization.
- sigmaToCircleRRatio = SkTMin(sigmaToCircleRRatio, 8.f);
+ sigmaToCircleRRatio = std::min(sigmaToCircleRRatio, 8.f);
SkFixed sigmaToCircleRRatioFixed;
static const SkScalar kHalfPlaneThreshold = 0.1f;
bool useHalfPlaneApprox = false;
diff --git a/src/gpu/effects/generated/GrCircleEffect.cpp b/src/gpu/effects/generated/GrCircleEffect.cpp
index e616fee..233f576 100644
--- a/src/gpu/effects/generated/GrCircleEffect.cpp
+++ b/src/gpu/effects/generated/GrCircleEffect.cpp
@@ -68,7 +68,7 @@
effectiveRadius -= 0.5f;
// When the radius is 0.5 effectiveRadius is 0 which causes an inf * 0 in the
// shader.
- effectiveRadius = SkTMax(0.001f, effectiveRadius);
+ effectiveRadius = std::max(0.001f, effectiveRadius);
} else {
effectiveRadius += 0.5f;
}
diff --git a/src/gpu/effects/generated/GrConfigConversionEffect.h b/src/gpu/effects/generated/GrConfigConversionEffect.h
index d2e186e..b1da7c4 100644
--- a/src/gpu/effects/generated/GrConfigConversionEffect.h
+++ b/src/gpu/effects/generated/GrConfigConversionEffect.h
@@ -39,9 +39,9 @@
for (int x = 0; x < kSize; ++x) {
uint8_t* color = reinterpret_cast<uint8_t*>(&srcData[kSize * y + x]);
color[3] = y;
- color[2] = SkTMin(x, y);
- color[1] = SkTMin(x, y);
- color[0] = SkTMin(x, y);
+ color[2] = std::min(x, y);
+ color[1] = std::min(x, y);
+ color[0] = std::min(x, y);
}
}
memset(firstRead, 0, kSize * kSize * sizeof(uint32_t));
diff --git a/src/gpu/effects/generated/GrRectBlurEffect.h b/src/gpu/effects/generated/GrRectBlurEffect.h
index 76bad89..8a9f44c 100644
--- a/src/gpu/effects/generated/GrRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRectBlurEffect.h
@@ -37,7 +37,7 @@
// conservatively choose to have 2 texels for each dst pixel.
int minWidth = 2 * sk_float_ceil2int(sixSigma);
// Bin by powers of 2 with a minimum so we get good profile reuse.
- int width = SkTMax(SkNextPow2(minWidth), 32);
+ int width = std::max(SkNextPow2(minWidth), 32);
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
diff --git a/src/gpu/geometry/GrPathUtils.cpp b/src/gpu/geometry/GrPathUtils.cpp
index f4b8081..625b9d6 100644
--- a/src/gpu/geometry/GrPathUtils.cpp
+++ b/src/gpu/geometry/GrPathUtils.cpp
@@ -35,7 +35,7 @@
if (stretch <= 0) {
// We have degenerate bounds or some degenerate matrix. Thus we set the tolerance to be the
// max of the path pathBounds width and height.
- srcTol = SkTMax(pathBounds.width(), pathBounds.height());
+ srcTol = std::max(pathBounds.width(), pathBounds.height());
} else {
srcTol = devTol / stretch;
}
@@ -71,7 +71,7 @@
if (pow2 < 1) {
pow2 = 1;
}
- return SkTMin(pow2, kMaxPointsPerCurve);
+ return std::min(pow2, kMaxPointsPerCurve);
}
}
}
@@ -106,7 +106,7 @@
// You should have called scaleToleranceToSrc, which guarantees this
SkASSERT(tol >= gMinCurveTol);
- SkScalar d = SkTMax(
+ SkScalar d = std::max(
SkPointPriv::DistanceToLineSegmentBetweenSqd(points[1], points[0], points[3]),
SkPointPriv::DistanceToLineSegmentBetweenSqd(points[2], points[0], points[3]));
d = SkScalarSqrt(d);
@@ -127,7 +127,7 @@
if (pow2 < 1) {
pow2 = 1;
}
- return SkTMin(pow2, kMaxPointsPerCurve);
+ return std::min(pow2, kMaxPointsPerCurve);
}
}
}
diff --git a/src/gpu/geometry/GrShape.cpp b/src/gpu/geometry/GrShape.cpp
index 8c29746..11111e4 100644
--- a/src/gpu/geometry/GrShape.cpp
+++ b/src/gpu/geometry/GrShape.cpp
@@ -727,14 +727,14 @@
SkVector outset;
// If we allowed a rotation angle for rrects we could capture all cases here.
if (fLineData.fPts[0].fY == fLineData.fPts[1].fY) {
- rect.fLeft = SkTMin(fLineData.fPts[0].fX, fLineData.fPts[1].fX);
- rect.fRight = SkTMax(fLineData.fPts[0].fX, fLineData.fPts[1].fX);
+ rect.fLeft = std::min(fLineData.fPts[0].fX, fLineData.fPts[1].fX);
+ rect.fRight = std::max(fLineData.fPts[0].fX, fLineData.fPts[1].fX);
rect.fTop = rect.fBottom = fLineData.fPts[0].fY;
outset.fY = fStyle.strokeRec().getWidth() / 2.f;
outset.fX = SkPaint::kButt_Cap == fStyle.strokeRec().getCap() ? 0.f : outset.fY;
} else if (fLineData.fPts[0].fX == fLineData.fPts[1].fX) {
- rect.fTop = SkTMin(fLineData.fPts[0].fY, fLineData.fPts[1].fY);
- rect.fBottom = SkTMax(fLineData.fPts[0].fY, fLineData.fPts[1].fY);
+ rect.fTop = std::min(fLineData.fPts[0].fY, fLineData.fPts[1].fY);
+ rect.fBottom = std::max(fLineData.fPts[0].fY, fLineData.fPts[1].fY);
rect.fLeft = rect.fRight = fLineData.fPts[0].fX;
outset.fX = fStyle.strokeRec().getWidth() / 2.f;
outset.fY = SkPaint::kButt_Cap == fStyle.strokeRec().getCap() ? 0.f : outset.fX;
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 1f2f80b..6a1bf56 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -408,7 +408,7 @@
static const uint8_t kMaxSaneSamplers = 32;
GrGLint maxSamplers;
GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_IMAGE_UNITS, &maxSamplers);
- shaderCaps->fMaxFragmentSamplers = SkTMin<GrGLint>(kMaxSaneSamplers, maxSamplers);
+ shaderCaps->fMaxFragmentSamplers = std::min<GrGLint>(kMaxSaneSamplers, maxSamplers);
// SGX and Mali GPUs have tiled architectures that have trouble with frequently changing VBOs.
// We've measured a performance increase using non-VBO vertex data for dynamic content on these
@@ -547,18 +547,18 @@
GR_GL_GetIntegerv(gli, GR_GL_MAX_TEXTURE_SIZE, &fMaxTextureSize);
if (fDriverBugWorkarounds.max_texture_size_limit_4096) {
- fMaxTextureSize = SkTMin(fMaxTextureSize, 4096);
+ fMaxTextureSize = std::min(fMaxTextureSize, 4096);
}
GR_GL_GetIntegerv(gli, GR_GL_MAX_RENDERBUFFER_SIZE, &fMaxRenderTargetSize);
// Our render targets are always created with textures as the color
// attachment, hence this min:
- fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize);
+ fMaxRenderTargetSize = std::min(fMaxTextureSize, fMaxRenderTargetSize);
fMaxPreferredRenderTargetSize = fMaxRenderTargetSize;
if (kARM_GrGLVendor == ctxInfo.vendor()) {
// On Mali G71, RT's above 4k have been observed to incur a performance cost.
- fMaxPreferredRenderTargetSize = SkTMin(4096, fMaxPreferredRenderTargetSize);
+ fMaxPreferredRenderTargetSize = std::min(4096, fMaxPreferredRenderTargetSize);
}
fGpuTracingSupport = ctxInfo.hasExtension("GL_EXT_debug_marker");
@@ -3104,7 +3104,7 @@
GR_GL_GetIntegerv(gli, GR_GL_MAX_SAMPLES, &maxSampleCnt);
}
// Chrome has a mock GL implementation that returns 0.
- maxSampleCnt = SkTMax(1, maxSampleCnt);
+ maxSampleCnt = std::max(1, maxSampleCnt);
static constexpr int kDefaultSamples[] = {1, 2, 4, 8};
int count = SK_ARRAY_COUNT(kDefaultSamples);
@@ -4129,7 +4129,7 @@
return 0;
}
- requestedCount = SkTMax(1, requestedCount);
+ requestedCount = std::max(1, requestedCount);
if (1 == requestedCount) {
return info.fColorSampleCounts[0] == 1 ? 1 : 0;
}
@@ -4138,7 +4138,7 @@
if (info.fColorSampleCounts[i] >= requestedCount) {
int count = info.fColorSampleCounts[i];
if (fDriverBugWorkarounds.max_msaa_sample_count_4) {
- count = SkTMin(count, 4);
+ count = std::min(count, 4);
}
return count;
}
@@ -4154,7 +4154,7 @@
}
int count = table[table.count() - 1];
if (fDriverBugWorkarounds.max_msaa_sample_count_4) {
- count = SkTMin(count, 4);
+ count = std::min(count, 4);
}
return count;
}
diff --git a/src/gpu/gl/GrGLGLSL.cpp b/src/gpu/gl/GrGLGLSL.cpp
index 2ad38bc..c33025e 100644
--- a/src/gpu/gl/GrGLGLSL.cpp
+++ b/src/gpu/gl/GrGLGLSL.cpp
@@ -26,7 +26,7 @@
GrGLVersion glVer = GrGLGetVersion(gl);
uint32_t glMajor = GR_GL_MAJOR_VER(glVer),
glMinor = GR_GL_MINOR_VER(glVer);
- ver = SkTMin(ver, GR_GLSL_VER(glMajor, 10 * glMinor));
+ ver = std::min(ver, GR_GLSL_VER(glMajor, 10 * glMinor));
if (GR_IS_GR_GL(gl->fStandard)) {
SkASSERT(ver >= GR_GLSL_VER(1,10));
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 2f033f8..7697ebb 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1041,8 +1041,8 @@
continue;
}
int twoToTheMipLevel = 1 << currentMipLevel;
- const int currentWidth = SkTMax(1, width / twoToTheMipLevel);
- const int currentHeight = SkTMax(1, height / twoToTheMipLevel);
+ const int currentWidth = std::max(1, width / twoToTheMipLevel);
+ const int currentHeight = std::max(1, height / twoToTheMipLevel);
const size_t trimRowBytes = currentWidth * bpp;
const size_t rowBytes = texels[currentMipLevel].fRowBytes;
@@ -1121,7 +1121,7 @@
}
offset += levelDataSize;
- dimensions = {SkTMax(1, dimensions.width()/2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width()/2), std::max(1, dimensions.height()/2)};
}
} else {
size_t offset = 0;
@@ -1146,7 +1146,7 @@
}
offset += levelDataSize;
- dimensions = {SkTMax(1, dimensions.width()/2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width()/2), std::max(1, dimensions.height()/2)};
}
}
return true;
@@ -1380,8 +1380,8 @@
GL_CALL(PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1));
for (int i = 0; i < mipLevelCount; ++i) {
if (levelClearMask & (1U << i)) {
- int levelWidth = SkTMax(1, texDesc.fSize.width() >> i);
- int levelHeight = SkTMax(1, texDesc.fSize.height() >> i);
+ int levelWidth = std::max(1, texDesc.fSize.width() >> i);
+ int levelHeight = std::max(1, texDesc.fSize.height() >> i);
// Levels only get smaller as we proceed. Once we create a zeros use it for all
// smaller levels that need clearing.
if (!zeros) {
@@ -1668,7 +1668,7 @@
CLEAR_ERROR_BEFORE_ALLOC(this->glInterface());
if (this->glCaps().formatSupportsTexStorage(format)) {
GL_ALLOC_CALL(this->glInterface(),
- TexStorage2D(GR_GL_TEXTURE_2D, SkTMax(mipLevelCount, 1), internalFormat,
+ TexStorage2D(GR_GL_TEXTURE_2D, std::max(mipLevelCount, 1), internalFormat,
dimensions.width(), dimensions.height()));
success = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(this->glInterface()));
} else {
@@ -1678,8 +1678,8 @@
if (externalFormat && externalType) {
for (int level = 0; level < mipLevelCount && error == GR_GL_NO_ERROR; level++) {
const int twoToTheMipLevel = 1 << level;
- const int currentWidth = SkTMax(1, dimensions.width() / twoToTheMipLevel);
- const int currentHeight = SkTMax(1, dimensions.height() / twoToTheMipLevel);
+ const int currentWidth = std::max(1, dimensions.width() / twoToTheMipLevel);
+ const int currentHeight = std::max(1, dimensions.height() / twoToTheMipLevel);
GL_ALLOC_CALL(
this->glInterface(),
TexImage2D(GR_GL_TEXTURE_2D, level, internalFormat, currentWidth,
@@ -1789,7 +1789,7 @@
// This is purely a workaround for a spurious warning generated by gcc. Otherwise the above
// assert would be sufficient. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=5912
- int numWindows = SkTMin(windowState.numWindows(), int(GrWindowRectangles::kMaxWindows));
+ int numWindows = std::min(windowState.numWindows(), int(GrWindowRectangles::kMaxWindows));
SkASSERT(windowState.numWindows() == numWindows);
GrNativeRect glwindows[GrWindowRectangles::kMaxWindows];
@@ -2490,7 +2490,7 @@
this->setupGeometry(nullptr, mesh.vertexBuffer(), 0, mesh.instanceBuffer(),
baseInstance + i, GrPrimitiveRestart::kNo);
GL_CALL(DrawArraysInstanced(glPrimType, baseVertex, vertexCount,
- SkTMin(instanceCount - i, maxInstances)));
+ std::min(instanceCount - i, maxInstances)));
fStats.incNumDraws();
}
}
@@ -2507,7 +2507,7 @@
this->setupGeometry(mesh.indexBuffer(), mesh.vertexBuffer(), baseVertex,
mesh.instanceBuffer(), baseInstance + i, mesh.primitiveRestart());
GL_CALL(DrawElementsInstanced(glPrimType, indexCount, GR_GL_UNSIGNED_SHORT, elementPtr,
- SkTMin(instanceCount - i, maxInstances)));
+ std::min(instanceCount - i, maxInstances)));
fStats.incNumDraws();
}
}
@@ -3707,8 +3707,8 @@
GL_CALL(FramebufferTexture2D(GR_GL_FRAMEBUFFER, GR_GL_COLOR_ATTACHMENT0, GR_GL_TEXTURE_2D,
glTex->textureID(), level));
- width = SkTMax(1, width / 2);
- height = SkTMax(1, height / 2);
+ width = std::max(1, width / 2);
+ height = std::max(1, height / 2);
this->flushViewport(width, height);
GL_CALL(DrawArrays(GR_GL_TRIANGLE_STRIP, 0, 4));
@@ -3851,8 +3851,8 @@
GL_CALL(TexSubImage2D(GR_GL_TEXTURE_2D, i, 0, 0, levelDimensions.width(),
levelDimensions.height(), externalFormat, externalType,
pixelStorage.get()));
- levelDimensions = {SkTMax(1, levelDimensions.width() /2),
- SkTMax(1, levelDimensions.height()/2)};
+ levelDimensions = {std::max(1, levelDimensions.width() /2),
+ std::max(1, levelDimensions.height()/2)};
}
}
// Unbind this texture from the scratch texture unit.
diff --git a/src/gpu/gradients/GrGradientBitmapCache.cpp b/src/gpu/gradients/GrGradientBitmapCache.cpp
index fdbc0fc..a1f6082 100644
--- a/src/gpu/gradients/GrGradientBitmapCache.cpp
+++ b/src/gpu/gradients/GrGradientBitmapCache.cpp
@@ -150,7 +150,7 @@
// Historically, stops have been mapped to [0, 256], with 256 then nudged to the next
// smaller value, then truncate for the texture index. This seems to produce the best
// results for some common distributions, so we preserve the behavior.
- int nextIndex = SkTMin(positions[i] * fResolution,
+ int nextIndex = std::min(positions[i] * fResolution,
SkIntToScalar(fResolution - 1));
if (nextIndex > prevIndex) {
diff --git a/src/gpu/gradients/GrTwoPointConicalGradientLayout.fp b/src/gpu/gradients/GrTwoPointConicalGradientLayout.fp
index 6de2452..4322d6f 100644
--- a/src/gpu/gradients/GrTwoPointConicalGradientLayout.fp
+++ b/src/gpu/gradients/GrTwoPointConicalGradientLayout.fp
@@ -252,7 +252,7 @@
radius2 += offset;
}
} else if (type == static_cast<int>(Type::kStrip)) {
- radius1 = SkTMax(radius1, .1f); // Make sure that the radius is non-zero
+ radius1 = std::max(radius1, .1f); // Make sure that the radius is non-zero
radius2 = radius1;
// Make sure that the centers are different
if (SkScalarNearlyZero(SkPoint::Distance(center1, center2))) {
diff --git a/src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.cpp b/src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.cpp
index 69d4d76..5b5b1d8 100644
--- a/src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.cpp
+++ b/src/gpu/gradients/generated/GrTwoPointConicalGradientLayout.cpp
@@ -176,7 +176,7 @@
radius2 += offset;
}
} else if (type == static_cast<int>(Type::kStrip)) {
- radius1 = SkTMax(radius1, .1f); // Make sure that the radius is non-zero
+ radius1 = std::max(radius1, .1f); // Make sure that the radius is non-zero
radius2 = radius1;
// Make sure that the centers are different
if (SkScalarNearlyZero(SkPoint::Distance(center1, center2))) {
diff --git a/src/gpu/mock/GrMockCaps.h b/src/gpu/mock/GrMockCaps.h
index 96e8dce..d76d04d 100644
--- a/src/gpu/mock/GrMockCaps.h
+++ b/src/gpu/mock/GrMockCaps.h
@@ -22,7 +22,7 @@
fMapBufferFlags = options.fMapBufferFlags;
fBufferMapThreshold = SK_MaxS32; // Overridable in GrContextOptions.
fMaxTextureSize = options.fMaxTextureSize;
- fMaxRenderTargetSize = SkTMin(options.fMaxRenderTargetSize, fMaxTextureSize);
+ fMaxRenderTargetSize = std::min(options.fMaxRenderTargetSize, fMaxTextureSize);
fMaxPreferredRenderTargetSize = fMaxRenderTargetSize;
fMaxVertexAttributes = options.fMaxVertexAttributes;
fSampleLocationsSupport = true;
@@ -92,7 +92,7 @@
}
int getRenderTargetSampleCount(int requestCount, GrColorType ct) const {
- requestCount = SkTMax(requestCount, 1);
+ requestCount = std::max(requestCount, 1);
switch (fOptions.fConfigOptions[(int)ct].fRenderability) {
case GrMockOptions::ConfigOptions::Renderability::kNo:
diff --git a/src/gpu/mock/GrMockStencilAttachment.h b/src/gpu/mock/GrMockStencilAttachment.h
index a058944..63b7b4e 100644
--- a/src/gpu/mock/GrMockStencilAttachment.h
+++ b/src/gpu/mock/GrMockStencilAttachment.h
@@ -20,7 +20,7 @@
private:
size_t onGpuMemorySize() const override {
- return SkTMax(1, (int)(this->bits() / sizeof(char))) * this->width() * this->height();
+ return std::max(1, (int)(this->bits() / sizeof(char))) * this->width() * this->height();
}
typedef GrStencilAttachment INHERITED;
diff --git a/src/gpu/mtl/GrMtlCaps.mm b/src/gpu/mtl/GrMtlCaps.mm
index b1cd659..5436a54 100644
--- a/src/gpu/mtl/GrMtlCaps.mm
+++ b/src/gpu/mtl/GrMtlCaps.mm
@@ -394,7 +394,7 @@
}
int GrMtlCaps::getRenderTargetSampleCount(int requestedCount, MTLPixelFormat format) const {
- requestedCount = SkTMax(requestedCount, 1);
+ requestedCount = std::max(requestedCount, 1);
const FormatInfo& formatInfo = this->getFormatInfo(format);
if (!(formatInfo.fFlags & FormatInfo::kRenderable_Flag)) {
return 0;
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 98e99c0..1d467d5 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -319,8 +319,8 @@
destinationLevel: currentMipLevel
destinationOrigin: origin];
}
- currentWidth = SkTMax(1, currentWidth/2);
- currentHeight = SkTMax(1, currentHeight/2);
+ currentWidth = std::max(1, currentWidth/2);
+ currentHeight = std::max(1, currentHeight/2);
layerHeight = currentHeight;
}
#ifdef SK_BUILD_FOR_MAC
@@ -367,8 +367,8 @@
individualMipOffsets.push_back(combinedBufferSize);
combinedBufferSize += trimmedSize;
}
- currentWidth = SkTMax(1, currentWidth/2);
- currentHeight = SkTMax(1, currentHeight/2);
+ currentWidth = std::max(1, currentWidth/2);
+ currentHeight = std::max(1, currentHeight/2);
}
SkASSERT(combinedBufferSize > 0 && !individualMipOffsets.empty());
@@ -410,8 +410,8 @@
destinationLevel: currentMipLevel
destinationOrigin: origin];
}
- currentWidth = SkTMax(1, currentWidth/2);
- currentHeight = SkTMax(1, currentHeight/2);
+ currentWidth = std::max(1, currentWidth/2);
+ currentHeight = std::max(1, currentHeight/2);
}
if (mipLevelCount < (int) tex->mtlTexture().mipmapLevelCount) {
@@ -605,8 +605,8 @@
destinationLevel: currentMipLevel
destinationOrigin: origin];
- levelDimensions = {SkTMax(1, levelDimensions.width() /2),
- SkTMax(1, levelDimensions.height()/2)};
+ levelDimensions = {std::max(1, levelDimensions.width() /2),
+ std::max(1, levelDimensions.height()/2)};
}
#ifdef SK_BUILD_FOR_MAC
[transferBuffer didModifyRange: NSMakeRange(bufferOffset, dataSize)];
@@ -967,8 +967,8 @@
destinationLevel: currentMipLevel
destinationOrigin: origin];
- levelDimensions = { SkTMax(1, levelDimensions.width() / 2),
- SkTMax(1, levelDimensions.height() / 2) };
+ levelDimensions = { std::max(1, levelDimensions.width() / 2),
+ std::max(1, levelDimensions.height() / 2) };
}
#ifdef SK_BUILD_FOR_MAC
[transferBuffer didModifyRange: NSMakeRange(0, transferBufferSize)];
diff --git a/src/gpu/ops/GrAAConvexTessellator.cpp b/src/gpu/ops/GrAAConvexTessellator.cpp
index e5b84ec..723e044 100644
--- a/src/gpu/ops/GrAAConvexTessellator.cpp
+++ b/src/gpu/ops/GrAAConvexTessellator.cpp
@@ -586,7 +586,7 @@
SkScalar dotProd = normal1.dot(normal2);
// The max is because this could go slightly negative if precision causes
// us to become slightly concave.
- SkScalar sinHalfAngleSq = SkTMax(SkScalarHalf(SK_Scalar1 + dotProd), 0.f);
+ SkScalar sinHalfAngleSq = std::max(SkScalarHalf(SK_Scalar1 + dotProd), 0.f);
SkScalar lengthSq = sk_ieee_float_divide(outsetSq, sinHalfAngleSq);
if (lengthSq > miterLimitSq) {
// just bevel it
diff --git a/src/gpu/ops/GrAAHairLinePathRenderer.cpp b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
index ad86615..9b4fad7 100644
--- a/src/gpu/ops/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/ops/GrAAHairLinePathRenderer.cpp
@@ -226,7 +226,7 @@
// +1 since we're ignoring the mantissa contribution.
int log = get_float_exp(dsqd/(gSubdivTol*gSubdivTol)) + 1;
- log = SkTMin(SkTMax(0, log), kMaxSub);
+ log = std::min(std::max(0, log), kMaxSub);
return log;
}
}
diff --git a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
index 80596a3..706b8dc 100644
--- a/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
+++ b/src/gpu/ops/GrAALinearizingConvexPathRenderer.cpp
@@ -271,7 +271,7 @@
indexCount = 0;
}
if (vertexCount + currentVertices > maxVertices) {
- maxVertices = SkTMax(vertexCount + currentVertices, maxVertices * 2);
+ maxVertices = std::max(vertexCount + currentVertices, maxVertices * 2);
if (maxVertices * vertexStride > SK_MaxS32) {
sk_free(vertices);
sk_free(indices);
@@ -281,7 +281,7 @@
}
int currentIndices = tess.numIndices();
if (indexCount + currentIndices > maxIndices) {
- maxIndices = SkTMax(indexCount + currentIndices, maxIndices * 2);
+ maxIndices = std::max(indexCount + currentIndices, maxIndices * 2);
if (maxIndices * sizeof(uint16_t) > SK_MaxS32) {
sk_free(vertices);
sk_free(indices);
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 70584fe..03667f6 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -215,19 +215,19 @@
// Clip position and texCoords to the clipRect
unsigned int delta;
- delta = SkTMin(SkTMax(clipRect.fLeft - positionRect.fLeft, 0), positionRectWidth);
+ delta = std::min(std::max(clipRect.fLeft - positionRect.fLeft, 0), positionRectWidth);
coordsRectL += delta;
positionRect.fLeft += delta;
- delta = SkTMin(SkTMax(clipRect.fTop - positionRect.fTop, 0), positionRectHeight);
+ delta = std::min(std::max(clipRect.fTop - positionRect.fTop, 0), positionRectHeight);
coordsRectT += delta;
positionRect.fTop += delta;
- delta = SkTMin(SkTMax(positionRect.fRight - clipRect.fRight, 0), positionRectWidth);
+ delta = std::min(std::max(positionRect.fRight - clipRect.fRight, 0), positionRectWidth);
coordsRectR -= delta;
positionRect.fRight -= delta;
- delta = SkTMin(SkTMax(positionRect.fBottom - clipRect.fBottom, 0), positionRectHeight);
+ delta = std::min(std::max(positionRect.fBottom - clipRect.fBottom, 0), positionRectHeight);
coordsRectB -= delta;
positionRect.fBottom -= delta;
diff --git a/src/gpu/ops/GrFillRRectOp.cpp b/src/gpu/ops/GrFillRRectOp.cpp
index 381c44a..04d8a9b 100644
--- a/src/gpu/ops/GrFillRRectOp.cpp
+++ b/src/gpu/ops/GrFillRRectOp.cpp
@@ -820,7 +820,7 @@
if (devRadii[1] < devRadii[0]) {
devRadii = SkNx_shuffle<1,0>(devRadii);
}
- float minDevRadius = SkTMax(devRadii[0], 1.f); // Shader clamps radius at a minimum of 1.
+ float minDevRadius = std::max(devRadii[0], 1.f); // Shader clamps radius at a minimum of 1.
// Is the gradient smooth enough for this corner look ok if we use hardware derivatives?
// This threshold was arrived at subjevtively on an NVIDIA chip.
return minDevRadius * minDevRadius * 5 > devRadii[1];
diff --git a/src/gpu/ops/GrFillRectOp.cpp b/src/gpu/ops/GrFillRectOp.cpp
index a65ab8e..aa5d129 100644
--- a/src/gpu/ops/GrFillRectOp.cpp
+++ b/src/gpu/ops/GrFillRectOp.cpp
@@ -152,7 +152,7 @@
// Otherwise compute the color type needed as the max over all quads.
fColorType = ColorType::kNone;
while(iter.next()) {
- fColorType = SkTMax(fColorType, GrQuadPerEdgeAA::MinColorType(iter->fColor));
+ fColorType = std::max(fColorType, GrQuadPerEdgeAA::MinColorType(iter->fColor));
}
}
// Most SkShaders' FPs multiply their calculated color by the paint color or alpha. We want
@@ -316,7 +316,7 @@
// If the processor sets are compatible, the two ops are always compatible; it just needs to
// adjust the state of the op to be the more general quad and aa types of the two ops and
// then concatenate the per-quad data.
- fColorType = SkTMax(fColorType, that->fColorType);
+ fColorType = std::max(fColorType, that->fColorType);
// The helper stores the aa type, but isCompatible(with true arg) allows the two ops' aa
// types to be none and coverage, in which case this op's aa type must be lifted to coverage
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index 75e8710..73e77e8 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -1329,7 +1329,7 @@
for (int i = 0; i < 8; ++i) {
// This clips the normalized offset to the half-plane we computed above. Then we
// compute the vertex position from this.
- SkScalar dist = SkTMin(kOctagonOuter[i].dot(geoClipPlane) + offsetClipDist, 0.0f);
+ SkScalar dist = std::min(kOctagonOuter[i].dot(geoClipPlane) + offsetClipDist, 0.0f);
SkVector offset = kOctagonOuter[i] - geoClipPlane * dist;
vertices.write(center + offset * halfWidth,
color,
@@ -1955,7 +1955,7 @@
verts.writeQuad(GrVertexWriter::TriStripFromRect(ellipse.fDevBounds),
color,
origin_centered_tri_strip(xMaxOffset, yMaxOffset),
- GrVertexWriter::If(fUseScale, SkTMax(xRadius, yRadius)),
+ GrVertexWriter::If(fUseScale, std::max(xRadius, yRadius)),
invRadii);
}
helper.recordDraw(target, gp);
@@ -2197,7 +2197,7 @@
verts.writeQuad(GrVertexWriter::TriStripFromRect(ellipse.fBounds),
color,
origin_centered_tri_strip(1.0f + offsetDx, 1.0f + offsetDy),
- GrVertexWriter::If(fUseScale, SkTMax(xRadius, yRadius)),
+ GrVertexWriter::If(fUseScale, std::max(xRadius, yRadius)),
origin_centered_tri_strip(innerRatioX + offsetDx,
innerRatioY + offsetDy));
}
@@ -2898,7 +2898,7 @@
// shader, so can't be exactly 0
SK_ScalarNearlyZero, yMaxOffset};
- auto maybeScale = GrVertexWriter::If(fUseScale, SkTMax(rrect.fXRadius, rrect.fYRadius));
+ auto maybeScale = GrVertexWriter::If(fUseScale, std::max(rrect.fXRadius, rrect.fYRadius));
for (int i = 0; i < 4; ++i) {
verts.write(bounds.fLeft, yCoords[i],
color,
diff --git a/src/gpu/ops/GrShadowRRectOp.cpp b/src/gpu/ops/GrShadowRRectOp.cpp
index 9a7eb51..496e24c 100644
--- a/src/gpu/ops/GrShadowRRectOp.cpp
+++ b/src/gpu/ops/GrShadowRRectOp.cpp
@@ -206,7 +206,7 @@
if (isCircle) {
umbraInset = 0;
} else {
- umbraInset = SkTMax(outerRadius, blurRadius);
+ umbraInset = std::max(outerRadius, blurRadius);
}
// If stroke is greater than width or height, this is still a fill,
@@ -215,10 +215,10 @@
innerRadius = devRadius - insetWidth;
type = innerRadius > 0 ? kStroke_RRectType : kFill_RRectType;
} else {
- if (insetWidth <= 0.5f*SkTMin(devRect.width(), devRect.height())) {
+ if (insetWidth <= 0.5f*std::min(devRect.width(), devRect.height())) {
// We don't worry about a real inner radius, we just need to know if we
// need to create overstroke vertices.
- innerRadius = SkTMax(insetWidth - umbraInset, 0.0f);
+ innerRadius = std::max(insetWidth - umbraInset, 0.0f);
type = innerRadius > 0 ? kOverstroke_RRectType : kStroke_RRectType;
}
}
@@ -418,7 +418,7 @@
const SkRect& bounds = args.fDevBounds;
SkScalar umbraInset = args.fUmbraInset;
- SkScalar minDim = 0.5f*SkTMin(bounds.width(), bounds.height());
+ SkScalar minDim = 0.5f*std::min(bounds.width(), bounds.height());
if (umbraInset > minDim) {
umbraInset = minDim;
}
diff --git a/src/gpu/ops/GrSmallPathRenderer.cpp b/src/gpu/ops/GrSmallPathRenderer.cpp
index f0d8191..72b34d7 100644
--- a/src/gpu/ops/GrSmallPathRenderer.cpp
+++ b/src/gpu/ops/GrSmallPathRenderer.cpp
@@ -397,7 +397,7 @@
// approximate the scale since we can't get it from the matrix
SkRect xformedBounds;
args.fViewMatrix.mapRect(&xformedBounds, bounds);
- maxScale = SkScalarAbs(SkTMax(xformedBounds.width() / bounds.width(),
+ maxScale = SkScalarAbs(std::max(xformedBounds.width() / bounds.width(),
xformedBounds.height() / bounds.height()));
} else {
maxScale = SkScalarAbs(args.fViewMatrix.getMaxScale());
@@ -432,7 +432,7 @@
}
mipSize = newMipSize;
}
- SkScalar desiredDimension = SkTMin(mipSize, kMaxMIP);
+ SkScalar desiredDimension = std::min(mipSize, kMaxMIP);
// check to see if df path is cached
ShapeDataKey key(args.fShape, SkScalarCeilToInt(desiredDimension));
diff --git a/src/gpu/ops/GrStrokeRectOp.cpp b/src/gpu/ops/GrStrokeRectOp.cpp
index c45185c..7bcee08 100644
--- a/src/gpu/ops/GrStrokeRectOp.cpp
+++ b/src/gpu/ops/GrStrokeRectOp.cpp
@@ -293,7 +293,7 @@
{
SkScalar w = devRect.width() - dx;
SkScalar h = devRect.height() - dy;
- spare = SkTMin(w, h);
+ spare = std::min(w, h);
}
*isDegenerate = spare <= 0;
@@ -702,8 +702,8 @@
// For device-space stroke widths less than one we can't inset more than the original
// device space stroke width if we want to keep the sizing of all the rects correct.
- const SkScalar insetX = SkTMin(SK_ScalarHalf, devHalfStrokeSize.fX);
- const SkScalar insetY = SkTMin(SK_ScalarHalf, devHalfStrokeSize.fY);
+ const SkScalar insetX = std::min(SK_ScalarHalf, devHalfStrokeSize.fX);
+ const SkScalar insetY = std::min(SK_ScalarHalf, devHalfStrokeSize.fY);
// But, correspondingly, we always want to keep the AA picture frame one pixel wide.
const SkScalar outsetX = SK_Scalar1 - insetX;
@@ -721,7 +721,7 @@
maybe_coverage(0.0f));
}
- float innerCoverage = compute_inner_coverage(SkTMax(devHalfStrokeSize.fX,
+ float innerCoverage = compute_inner_coverage(std::max(devHalfStrokeSize.fX,
devHalfStrokeSize.fY));
SkPMColor4f scaledColor = color * innerCoverage;
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 994a7824..6b5a9f8 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -291,7 +291,7 @@
auto iter = fQuads.metadata();
while(iter.next()) {
auto colorType = GrQuadPerEdgeAA::MinColorType(iter->fColor);
- fMetadata.fColorType = SkTMax(fMetadata.fColorType, static_cast<uint16_t>(colorType));
+ fMetadata.fColorType = std::max(fMetadata.fColorType, static_cast<uint16_t>(colorType));
}
return GrProcessorSet::EmptySetAnalysis();
}
@@ -767,11 +767,11 @@
if (op.fMetadata.domain() == Domain::kYes) {
domain = Domain::kYes;
}
- colorType = SkTMax(colorType, op.fMetadata.colorType());
+ colorType = std::max(colorType, op.fMetadata.colorType());
desc->fNumProxies += op.fMetadata.fProxyCount;
for (unsigned p = 0; p < op.fMetadata.fProxyCount; ++p) {
- maxQuadsPerMesh = SkTMax(op.fViewCountPairs[p].fQuadCnt, maxQuadsPerMesh);
+ maxQuadsPerMesh = std::max(op.fViewCountPairs[p].fQuadCnt, maxQuadsPerMesh);
}
desc->fNumTotalQuads += op.totNumQuads();
@@ -972,7 +972,7 @@
}
fMetadata.fDomain |= that->fMetadata.fDomain;
- fMetadata.fColorType = SkTMax(fMetadata.fColorType, that->fMetadata.fColorType);
+ fMetadata.fColorType = std::max(fMetadata.fColorType, that->fMetadata.fColorType);
if (upgradeToCoverageAAOnMerge) {
fMetadata.fAAType = static_cast<uint16_t>(GrAAType::kCoverage);
}
@@ -1180,7 +1180,7 @@
// Second check if we can always just make a single op and avoid the extra iteration
// needed to clump things together.
- if (cnt <= SkTMin(GrResourceProvider::MaxNumNonAAQuads(),
+ if (cnt <= std::min(GrResourceProvider::MaxNumNonAAQuads(),
GrResourceProvider::MaxNumAAQuads())) {
auto op = TextureOp::Make(context, set, cnt, proxyRunCnt, filter, saturate, aaType,
constraint, viewMatrix, std::move(textureColorSpaceXform));
@@ -1195,7 +1195,7 @@
if (aaType == GrAAType::kNone || aaType == GrAAType::kMSAA) {
// Clump these into series of MaxNumNonAAQuads-sized GrTextureOps
while (state.numLeft() > 0) {
- int clumpSize = SkTMin(state.numLeft(), GrResourceProvider::MaxNumNonAAQuads());
+ int clumpSize = std::min(state.numLeft(), GrResourceProvider::MaxNumNonAAQuads());
state.createOp(set, clumpSize, aaType);
}
diff --git a/src/gpu/vk/GrVkCaps.cpp b/src/gpu/vk/GrVkCaps.cpp
index 389dae8..ddb4f2d 100644
--- a/src/gpu/vk/GrVkCaps.cpp
+++ b/src/gpu/vk/GrVkCaps.cpp
@@ -476,7 +476,7 @@
// AMD advertises support for MAX_UINT vertex input attributes, but in reality only supports 32.
if (kAMD_VkVendor == properties.vendorID) {
- fMaxVertexAttributes = SkTMin(fMaxVertexAttributes, 32);
+ fMaxVertexAttributes = std::min(fMaxVertexAttributes, 32);
}
////////////////////////////////////////////////////////////////////////////
@@ -505,7 +505,7 @@
// attribs timeout looping over that many. For now, we'll cap this at 64 max and can raise it if
// we ever find that need.
static const uint32_t kMaxVertexAttributes = 64;
- fMaxVertexAttributes = SkTMin(properties.limits.maxVertexInputAttributes, kMaxVertexAttributes);
+ fMaxVertexAttributes = std::min(properties.limits.maxVertexInputAttributes, kMaxVertexAttributes);
if (properties.limits.standardSampleLocations) {
fSampleLocationsSupport = true;
@@ -528,14 +528,14 @@
// We could actually query and get a max size for each config, however maxImageDimension2D will
// give the minimum max size across all configs. So for simplicity we will use that for now.
- fMaxRenderTargetSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
- fMaxTextureSize = SkTMin(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
+ fMaxRenderTargetSize = std::min(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
+ fMaxTextureSize = std::min(properties.limits.maxImageDimension2D, (uint32_t)INT_MAX);
if (fDriverBugWorkarounds.max_texture_size_limit_4096) {
- fMaxTextureSize = SkTMin(fMaxTextureSize, 4096);
+ fMaxTextureSize = std::min(fMaxTextureSize, 4096);
}
// Our render targets are always created with textures as the color
// attachment, hence this min:
- fMaxRenderTargetSize = SkTMin(fMaxTextureSize, fMaxRenderTargetSize);
+ fMaxRenderTargetSize = std::min(fMaxTextureSize, fMaxRenderTargetSize);
// TODO: check if RT's larger than 4k incur a performance cost on ARM.
fMaxPreferredRenderTargetSize = fMaxRenderTargetSize;
@@ -614,8 +614,8 @@
shaderCaps->fFloatIs32Bits = true;
shaderCaps->fHalfIs32Bits = false;
- shaderCaps->fMaxFragmentSamplers = SkTMin(
- SkTMin(properties.limits.maxPerStageDescriptorSampledImages,
+ shaderCaps->fMaxFragmentSamplers = std::min(
+ std::min(properties.limits.maxPerStageDescriptorSampledImages,
properties.limits.maxPerStageDescriptorSamplers),
(uint32_t)INT_MAX);
}
@@ -1374,7 +1374,7 @@
}
int GrVkCaps::getRenderTargetSampleCount(int requestedCount, VkFormat format) const {
- requestedCount = SkTMax(1, requestedCount);
+ requestedCount = std::max(1, requestedCount);
const FormatInfo& info = this->getFormatInfo(format);
diff --git a/src/gpu/vk/GrVkCommandBuffer.cpp b/src/gpu/vk/GrVkCommandBuffer.cpp
index 8bf43e7..696a5307 100644
--- a/src/gpu/vk/GrVkCommandBuffer.cpp
+++ b/src/gpu/vk/GrVkCommandBuffer.cpp
@@ -125,7 +125,7 @@
uint32_t newEnd = newRange.baseMipLevel + newRange.levelCount - 1;
uint32_t oldStart = oldRange.baseMipLevel;
uint32_t oldEnd = oldRange.baseMipLevel + oldRange.levelCount - 1;
- if (SkTMax(newStart, oldStart) <= SkTMin(newEnd, oldEnd)) {
+ if (std::max(newStart, oldStart) <= std::min(newEnd, oldEnd)) {
this->submitPipelineBarriers(gpu);
break;
}
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index 03a8685..ae15986 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -106,8 +106,8 @@
uint32_t apiVersion = backendContext.fMaxAPIVersion ? backendContext.fMaxAPIVersion
: instanceVersion;
- instanceVersion = SkTMin(instanceVersion, apiVersion);
- physDevVersion = SkTMin(physDevVersion, apiVersion);
+ instanceVersion = std::min(instanceVersion, apiVersion);
+ physDevVersion = std::min(physDevVersion, apiVersion);
sk_sp<const GrVkInterface> interface;
@@ -735,8 +735,8 @@
region.imageExtent = {SkToU32(dimensions.width()),
SkToU32(dimensions.height()), 1};
- dimensions = {SkTMax(1, dimensions.width() /2),
- SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width() /2),
+ std::max(1, dimensions.height()/2)};
}
return combinedBufferSize;
@@ -799,8 +799,8 @@
SkASSERT((bpp & (bpp - 1)) == 0);
const size_t alignmentMask = 0x3 | (bpp - 1);
for (int currentMipLevel = 1; currentMipLevel < mipLevelCount; currentMipLevel++) {
- currentWidth = SkTMax(1, currentWidth/2);
- currentHeight = SkTMax(1, currentHeight/2);
+ currentWidth = std::max(1, currentWidth/2);
+ currentHeight = std::max(1, currentHeight/2);
if (texelsShallowCopy[currentMipLevel].fPixels) {
const size_t trimmedSize = currentWidth * bpp * currentHeight;
@@ -894,8 +894,8 @@
region.imageOffset = {uploadLeft, uploadTop, 0};
region.imageExtent = { (uint32_t)currentWidth, (uint32_t)currentHeight, 1 };
}
- currentWidth = SkTMax(1, currentWidth/2);
- currentHeight = SkTMax(1, currentHeight/2);
+ currentWidth = std::max(1, currentWidth/2);
+ currentHeight = std::max(1, currentHeight/2);
layerHeight = currentHeight;
}
@@ -1469,8 +1469,8 @@
while (mipLevel < levelCount) {
int prevWidth = width;
int prevHeight = height;
- width = SkTMax(1, width / 2);
- height = SkTMax(1, height / 2);
+ width = std::max(1, width / 2);
+ height = std::max(1, height / 2);
imageMemoryBarrier.subresourceRange.baseMipLevel = mipLevel - 1;
this->addImageMemoryBarrier(vkTex->resource(), VK_PIPELINE_STAGE_TRANSFER_BIT,
diff --git a/src/gpu/vk/GrVkRenderPass.cpp b/src/gpu/vk/GrVkRenderPass.cpp
index 818b3b8..6ee7f94 100644
--- a/src/gpu/vk/GrVkRenderPass.cpp
+++ b/src/gpu/vk/GrVkRenderPass.cpp
@@ -126,7 +126,7 @@
stencilRef.attachment = currentAttachment++;
stencilRef.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
if (VK_ATTACHMENT_LOAD_OP_CLEAR == stencilOp.fLoadOp) {
- clearValueCount = SkTMax(clearValueCount, stencilRef.attachment + 1);
+ clearValueCount = std::max(clearValueCount, stencilRef.attachment + 1);
}
} else {
stencilRef.attachment = VK_ATTACHMENT_UNUSED;
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index f054554..9eb9bbf 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -194,7 +194,7 @@
*uniformOffset = *currentOffset + offsetDiff;
SkASSERT(sizeof(float) == 4);
if (arrayCount) {
- uint32_t elementSize = SkTMax<uint32_t>(16, grsltype_to_vk_size(type));
+ uint32_t elementSize = std::max<uint32_t>(16, grsltype_to_vk_size(type));
SkASSERT(0 == (elementSize & 0xF));
*currentOffset = *uniformOffset + elementSize * arrayCount;
} else {
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 82730b7..078ae34 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -537,11 +537,11 @@
const SkPixmap* pixmap = &originalPixmap;
SkAutoPixmapStorage resized;
int maxTextureSize = context->priv().caps()->maxTextureSize();
- int maxDim = SkTMax(originalPixmap.width(), originalPixmap.height());
+ int maxDim = std::max(originalPixmap.width(), originalPixmap.height());
if (limitToMaxTextureSize && maxDim > maxTextureSize) {
float scale = static_cast<float>(maxTextureSize) / maxDim;
- int newWidth = SkTMin(static_cast<int>(originalPixmap.width() * scale), maxTextureSize);
- int newHeight = SkTMin(static_cast<int>(originalPixmap.height() * scale), maxTextureSize);
+ int newWidth = std::min(static_cast<int>(originalPixmap.width() * scale), maxTextureSize);
+ int newHeight = std::min(static_cast<int>(originalPixmap.height() * scale), maxTextureSize);
SkImageInfo info = originalPixmap.info().makeWH(newWidth, newHeight);
if (!resized.tryAlloc(info) || !originalPixmap.scalePixels(resized, kLow_SkFilterQuality)) {
return nullptr;
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 3f23a2e..2f7ced0 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -277,12 +277,12 @@
const SkPixmap* pixmap = &yuvaPixmaps[i];
SkAutoPixmapStorage resized;
int maxTextureSize = context->priv().caps()->maxTextureSize();
- int maxDim = SkTMax(yuvaPixmaps[i].width(), yuvaPixmaps[i].height());
+ int maxDim = std::max(yuvaPixmaps[i].width(), yuvaPixmaps[i].height());
if (limitToMaxTextureSize && maxDim > maxTextureSize) {
float scale = static_cast<float>(maxTextureSize) / maxDim;
- int newWidth = SkTMin(static_cast<int>(yuvaPixmaps[i].width() * scale), maxTextureSize);
+ int newWidth = std::min(static_cast<int>(yuvaPixmaps[i].width() * scale), maxTextureSize);
int newHeight =
- SkTMin(static_cast<int>(yuvaPixmaps[i].height() * scale), maxTextureSize);
+ std::min(static_cast<int>(yuvaPixmaps[i].height() * scale), maxTextureSize);
SkImageInfo info = yuvaPixmaps[i].info().makeWH(newWidth, newHeight);
if (!resized.tryAlloc(info) ||
!yuvaPixmaps[i].scalePixels(resized, kLow_SkFilterQuality)) {
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index f7f985d..46a089a 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -467,7 +467,7 @@
if (!ctx) {
return nullptr;
}
- sampleCount = SkTMax(1, sampleCount);
+ sampleCount = std::max(1, sampleCount);
GrMipMapped mipMapped = shouldCreateWithMips ? GrMipMapped::kYes : GrMipMapped::kNo;
if (!ctx->priv().caps()->mipMapSupport()) {
@@ -507,7 +507,7 @@
if (!context) {
return nullptr;
}
- sampleCnt = SkTMax(1, sampleCnt);
+ sampleCnt = std::max(1, sampleCnt);
GrColorType grColorType = SkColorTypeAndFormatToGrColorType(context->priv().caps(), colorType,
tex.getBackendFormat());
@@ -642,7 +642,7 @@
return nullptr;
}
- sampleCnt = SkTMax(1, sampleCnt);
+ sampleCnt = std::max(1, sampleCnt);
GrColorType grColorType = SkColorTypeAndFormatToGrColorType(context->priv().caps(), colorType,
tex.getBackendFormat());
if (grColorType == GrColorType::kUnknown) {
diff --git a/src/images/SkPngEncoder.cpp b/src/images/SkPngEncoder.cpp
index 5a3c9e6..831d356 100644
--- a/src/images/SkPngEncoder.cpp
+++ b/src/images/SkPngEncoder.cpp
@@ -198,7 +198,7 @@
SkASSERT(filters == (int)options.fFilterFlags);
png_set_filter(fPngPtr, PNG_FILTER_TYPE_BASE, filters);
- int zlibLevel = SkTMin(SkTMax(0, options.fZLibLevel), 9);
+ int zlibLevel = std::min(std::max(0, options.fZLibLevel), 9);
SkASSERT(zlibLevel == options.fZLibLevel);
png_set_compression_level(fPngPtr, zlibLevel);
diff --git a/src/pathops/SkDConicLineIntersection.cpp b/src/pathops/SkDConicLineIntersection.cpp
index 6a9eb4b..6c87f04 100644
--- a/src/pathops/SkDConicLineIntersection.cpp
+++ b/src/pathops/SkDConicLineIntersection.cpp
@@ -60,7 +60,7 @@
#ifdef SK_DEBUG
static bool close_to(double a, double b, const double c[3]) {
- double max = SkTMax(-SkTMin(SkTMin(c[0], c[1]), c[2]), SkTMax(SkTMax(c[0], c[1]), c[2]));
+ double max = std::max(-std::min(std::min(c[0], c[1]), c[2]), std::max(std::max(c[0], c[1]), c[2]));
return approximately_zero_when_compared_to(a - b, max);
}
#endif
diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp
index a701d0f..8efdc5d 100644
--- a/src/pathops/SkOpAngle.cpp
+++ b/src/pathops/SkOpAngle.cpp
@@ -326,8 +326,8 @@
}
bool SkOpAngle::checkCrossesZero() const {
- int start = SkTMin(fSectorStart, fSectorEnd);
- int end = SkTMax(fSectorStart, fSectorEnd);
+ int start = std::min(fSectorStart, fSectorEnd);
+ int end = std::max(fSectorStart, fSectorEnd);
bool crossesZero = end - start > 16;
return crossesZero;
}
@@ -494,7 +494,7 @@
SkDVector v;
v.set(pts[idx2] - pts[idx1]);
double lenSq = v.lengthSquared();
- longest = SkTMax(longest, lenSq);
+ longest = std::max(longest, lenSq);
}
}
return sqrt(longest) / dist;
@@ -533,7 +533,7 @@
if (approximately_equal_orderable(tStart, testT)) {
continue;
}
- smallTs[index] = t = testAscends ? SkTMax(t, testT) : SkTMin(t, testT);
+ smallTs[index] = t = testAscends ? std::max(t, testT) : std::min(t, testT);
limited[index] = approximately_equal_orderable(t, tEnd);
}
}
@@ -580,12 +580,12 @@
const SkDCurve& curve = index ? rh->fPart.fCurve : this->fPart.fCurve;
int ptCount = index ? rPts : lPts;
for (int idx2 = 0; idx2 <= ptCount; ++idx2) {
- minX = SkTMin(minX, curve[idx2].fX);
- minY = SkTMin(minY, curve[idx2].fY);
- maxX = SkTMax(maxX, curve[idx2].fX);
- maxY = SkTMax(maxY, curve[idx2].fY);
+ minX = std::min(minX, curve[idx2].fX);
+ minY = std::min(minY, curve[idx2].fY);
+ maxX = std::max(maxX, curve[idx2].fX);
+ maxY = std::max(maxY, curve[idx2].fY);
}
- double maxWidth = SkTMax(maxX - minX, maxY - minY);
+ double maxWidth = std::max(maxX - minX, maxY - minY);
delta = sk_ieee_double_divide(delta, maxWidth);
// FIXME: move these magic numbers
// This fixes skbug.com/8380
@@ -665,12 +665,12 @@
const SkDCurve& curve = rh->fPart.fCurve;
int oppPts = SkPathOpsVerbToPoints(oppVerb);
for (int idx2 = 0; idx2 <= oppPts; ++idx2) {
- minX = SkTMin(minX, curve[idx2].fX);
- minY = SkTMin(minY, curve[idx2].fY);
- maxX = SkTMax(maxX, curve[idx2].fX);
- maxY = SkTMax(maxY, curve[idx2].fY);
+ minX = std::min(minX, curve[idx2].fX);
+ minY = std::min(minY, curve[idx2].fY);
+ maxX = std::max(maxX, curve[idx2].fX);
+ maxY = std::max(maxY, curve[idx2].fY);
}
- double maxWidth = SkTMax(maxX - minX, maxY - minY);
+ double maxWidth = std::max(maxX - minX, maxY - minY);
endDist = sk_ieee_double_divide(endDist, maxWidth);
if (!(endDist >= 5e-12)) { // empirically found
return false; // ! above catches NaN
@@ -1088,7 +1088,7 @@
return;
}
bool crossesZero = this->checkCrossesZero();
- int start = SkTMin(fSectorStart, fSectorEnd);
+ int start = std::min(fSectorStart, fSectorEnd);
bool curveBendsCCW = (fSectorStart == start) ^ crossesZero;
// bump the start and end of the sector span if they are on exact compass points
if ((fSectorStart & 3) == 3) {
@@ -1098,8 +1098,8 @@
fSectorEnd = (fSectorEnd + (curveBendsCCW ? 31 : 1)) & 0x1f;
}
crossesZero = this->checkCrossesZero();
- start = SkTMin(fSectorStart, fSectorEnd);
- int end = SkTMax(fSectorStart, fSectorEnd);
+ start = std::min(fSectorStart, fSectorEnd);
+ int end = std::max(fSectorStart, fSectorEnd);
if (!crossesZero) {
fSectorMask = (unsigned) -1 >> (31 - end + start) << start;
} else {
diff --git a/src/pathops/SkOpCoincidence.cpp b/src/pathops/SkOpCoincidence.cpp
index 31de4f1..7ab92b3 100644
--- a/src/pathops/SkOpCoincidence.cpp
+++ b/src/pathops/SkOpCoincidence.cpp
@@ -206,8 +206,8 @@
swap(oppPtTStart, oppPtTEnd);
}
}
- double oppMinT = SkTMin(oppPtTStart->fT, oppPtTEnd->fT);
- SkDEBUGCODE(double oppMaxT = SkTMax(oppPtTStart->fT, oppPtTEnd->fT));
+ double oppMinT = std::min(oppPtTStart->fT, oppPtTEnd->fT);
+ SkDEBUGCODE(double oppMaxT = std::max(oppPtTStart->fT, oppPtTEnd->fT));
do {
if (coinSeg != test->coinPtTStart()->segment()) {
continue;
@@ -215,8 +215,8 @@
if (oppSeg != test->oppPtTStart()->segment()) {
continue;
}
- double oTestMinT = SkTMin(test->oppPtTStart()->fT, test->oppPtTEnd()->fT);
- double oTestMaxT = SkTMax(test->oppPtTStart()->fT, test->oppPtTEnd()->fT);
+ double oTestMinT = std::min(test->oppPtTStart()->fT, test->oppPtTEnd()->fT);
+ double oTestMaxT = std::max(test->oppPtTStart()->fT, test->oppPtTEnd()->fT);
// if debug check triggers, caller failed to check if extended already exists
SkASSERT(test->coinPtTStart()->fT > coinPtTStart->fT
|| coinPtTEnd->fT > test->coinPtTEnd()->fT
@@ -977,8 +977,8 @@
swap(oppPtTStart, oppPtTEnd);
}
}
- double oppMinT = SkTMin(oppPtTStart->fT, oppPtTEnd->fT);
- double oppMaxT = SkTMax(oppPtTStart->fT, oppPtTEnd->fT);
+ double oppMinT = std::min(oppPtTStart->fT, oppPtTEnd->fT);
+ double oppMaxT = std::max(oppPtTStart->fT, oppPtTEnd->fT);
do {
if (coinSeg != test->coinPtTStart()->segment()) {
continue;
@@ -992,10 +992,10 @@
if (oppSeg != test->oppPtTStart()->segment()) {
continue;
}
- if (oppMinT < SkTMin(test->oppPtTStart()->fT, test->oppPtTEnd()->fT)) {
+ if (oppMinT < std::min(test->oppPtTStart()->fT, test->oppPtTEnd()->fT)) {
continue;
}
- if (oppMaxT > SkTMax(test->oppPtTStart()->fT, test->oppPtTEnd()->fT)) {
+ if (oppMaxT > std::max(test->oppPtTStart()->fT, test->oppPtTEnd()->fT)) {
continue;
}
return true;
@@ -1426,8 +1426,8 @@
bool SkOpCoincidence::overlap(const SkOpPtT* coin1s, const SkOpPtT* coin1e,
const SkOpPtT* coin2s, const SkOpPtT* coin2e, double* overS, double* overE) const {
SkASSERT(coin1s->segment() == coin2s->segment());
- *overS = SkTMax(SkTMin(coin1s->fT, coin1e->fT), SkTMin(coin2s->fT, coin2e->fT));
- *overE = SkTMin(SkTMax(coin1s->fT, coin1e->fT), SkTMax(coin2s->fT, coin2e->fT));
+ *overS = std::max(std::min(coin1s->fT, coin1e->fT), std::min(coin2s->fT, coin2e->fT));
+ *overE = std::min(std::max(coin1s->fT, coin1e->fT), std::max(coin2s->fT, coin2e->fT));
return *overS < *overE;
}
diff --git a/src/pathops/SkOpCubicHull.cpp b/src/pathops/SkOpCubicHull.cpp
index 61e4963..ad1f4b5 100644
--- a/src/pathops/SkOpCubicHull.cpp
+++ b/src/pathops/SkOpCubicHull.cpp
@@ -102,9 +102,9 @@
double dist1_3 = fPts[1].distanceSquared(fPts[3]);
double dist2_0 = fPts[2].distanceSquared(fPts[0]);
double dist2_3 = fPts[2].distanceSquared(fPts[3]);
- double smallest1distSq = SkTMin(dist1_0, dist1_3);
- double smallest2distSq = SkTMin(dist2_0, dist2_3);
- if (approximately_zero(SkTMin(smallest1distSq, smallest2distSq))) {
+ double smallest1distSq = std::min(dist1_0, dist1_3);
+ double smallest2distSq = std::min(dist2_0, dist2_3);
+ if (approximately_zero(std::min(smallest1distSq, smallest2distSq))) {
order[2] = smallest1distSq < smallest2distSq ? 2 : 1;
return 3;
}
diff --git a/src/pathops/SkOpEdgeBuilder.cpp b/src/pathops/SkOpEdgeBuilder.cpp
index 7e97c03..2bc8cc9 100644
--- a/src/pathops/SkOpEdgeBuilder.cpp
+++ b/src/pathops/SkOpEdgeBuilder.cpp
@@ -312,7 +312,7 @@
split->fPts[0] = splits[prior].fPts[0];
}
int next = index;
- int breakLimit = SkTMin(breaks, (int) SK_ARRAY_COUNT(splits) - 1);
+ int breakLimit = std::min(breaks, (int) SK_ARRAY_COUNT(splits) - 1);
while (next < breakLimit && !splits[next + 1].fCanAdd) {
++next;
}
diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp
index 66fa6ee..0d0db4c 100644
--- a/src/pathops/SkOpSegment.cpp
+++ b/src/pathops/SkOpSegment.cpp
@@ -1507,7 +1507,7 @@
// on the other hand, the below check is relatively inexpensive
double midT = (t1 + t2) / 2;
SkPoint midPt = this->ptAtT(midT);
- double seDistSq = SkTMax(SkPointPriv::DistanceToSqd(pt1, pt2) * 2, FLT_EPSILON * 2);
+ double seDistSq = std::max(SkPointPriv::DistanceToSqd(pt1, pt2) * 2, FLT_EPSILON * 2);
return SkPointPriv::DistanceToSqd(midPt, pt1) > seDistSq ||
SkPointPriv::DistanceToSqd(midPt, pt2) > seDistSq;
}
diff --git a/src/pathops/SkOpSpan.cpp b/src/pathops/SkOpSpan.cpp
index ea57756..dd854f4 100644
--- a/src/pathops/SkOpSpan.cpp
+++ b/src/pathops/SkOpSpan.cpp
@@ -178,8 +178,8 @@
if (walk->segment() != segment) {
continue;
}
- min = SkTMin(min, walk->fT);
- max = SkTMax(max, walk->fT);
+ min = std::min(min, walk->fT);
+ max = std::max(max, walk->fT);
if (between(min, s, max) && between(min, e, max)) {
return Collapsed::kYes;
}
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index bb5261f..ebf195d 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -215,11 +215,11 @@
lineParameters.cubicEndPoints(*this, startIndex, endIndex);
// FIXME: maybe it's possible to avoid this and compare non-normalized
lineParameters.normalize();
- double tiniest = SkTMin(SkTMin(SkTMin(SkTMin(SkTMin(SkTMin(SkTMin(fPts[0].fX, fPts[0].fY),
+ double tiniest = std::min(std::min(std::min(std::min(std::min(std::min(std::min(fPts[0].fX, fPts[0].fY),
fPts[1].fX), fPts[1].fY), fPts[2].fX), fPts[2].fY), fPts[3].fX), fPts[3].fY);
- double largest = SkTMax(SkTMax(SkTMax(SkTMax(SkTMax(SkTMax(SkTMax(fPts[0].fX, fPts[0].fY),
+ double largest = std::max(std::max(std::max(std::max(std::max(std::max(std::max(fPts[0].fX, fPts[0].fY),
fPts[1].fX), fPts[1].fY), fPts[2].fX), fPts[2].fY), fPts[3].fX), fPts[3].fY);
- largest = SkTMax(largest, -tiniest);
+ largest = std::max(largest, -tiniest);
double distance = lineParameters.controlPtDistance(*this, 1);
if (!approximately_zero_when_compared_to(distance, largest)) {
return false;
diff --git a/src/pathops/SkPathOpsCurve.cpp b/src/pathops/SkPathOpsCurve.cpp
index 734d599..cc77513 100644
--- a/src/pathops/SkPathOpsCurve.cpp
+++ b/src/pathops/SkPathOpsCurve.cpp
@@ -15,8 +15,8 @@
double minX = fCubic.fPts[0].fX;
double maxX = minX;
for (int index = 1; index <= count; ++index) {
- minX = SkTMin(minX, fCubic.fPts[index].fX);
- maxX = SkTMax(maxX, fCubic.fPts[index].fX);
+ minX = std::min(minX, fCubic.fPts[index].fX);
+ maxX = std::max(maxX, fCubic.fPts[index].fX);
}
if (!AlmostBetweenUlps(minX, xy.fX, maxX)) {
return -1;
@@ -24,8 +24,8 @@
double minY = fCubic.fPts[0].fY;
double maxY = minY;
for (int index = 1; index <= count; ++index) {
- minY = SkTMin(minY, fCubic.fPts[index].fY);
- maxY = SkTMax(maxY, fCubic.fPts[index].fY);
+ minY = std::min(minY, fCubic.fPts[index].fY);
+ maxY = std::max(maxY, fCubic.fPts[index].fY);
}
if (!AlmostBetweenUlps(minY, xy.fY, maxY)) {
return -1;
@@ -45,7 +45,7 @@
if (minIndex < 0) {
return -1;
}
- double largest = SkTMax(SkTMax(maxX, maxY), -SkTMin(minX, minY));
+ double largest = std::max(std::max(maxX, maxY), -std::min(minX, minY));
if (!AlmostEqualUlps_Pin(largest, largest + minDist)) { // is distance within ULPS tolerance?
return -1;
}
@@ -102,7 +102,7 @@
// central place for this val-is-small-compared-to-curve check
double maxVal = 0;
for (int index = 0; index <= SkPathOpsVerbToPoints(verb); ++index) {
- maxVal = SkTMax(maxVal, SkTMax(SkTAbs(fCurve[index].fX),
+ maxVal = std::max(maxVal, std::max(SkTAbs(fCurve[index].fX),
SkTAbs(fCurve[index].fY)));
}
{
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index b104424..f752f2d 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -1120,15 +1120,15 @@
void SkOpSegment::debugSetCoinT(int index, SkScalar t) const {
if (fDebugBaseMax < 0 || fDebugBaseIndex == index) {
fDebugBaseIndex = index;
- fDebugBaseMin = SkTMin(t, fDebugBaseMin);
- fDebugBaseMax = SkTMax(t, fDebugBaseMax);
+ fDebugBaseMin = std::min(t, fDebugBaseMin);
+ fDebugBaseMax = std::max(t, fDebugBaseMax);
return;
}
SkASSERT(fDebugBaseMin >= t || t >= fDebugBaseMax);
if (fDebugLastMax < 0 || fDebugLastIndex == index) {
fDebugLastIndex = index;
- fDebugLastMin = SkTMin(t, fDebugLastMin);
- fDebugLastMax = SkTMax(t, fDebugLastMax);
+ fDebugLastMin = std::min(t, fDebugLastMin);
+ fDebugLastMax = std::max(t, fDebugLastMax);
return;
}
SkASSERT(fDebugLastMin >= t || t >= fDebugLastMax);
diff --git a/src/pathops/SkPathOpsLine.cpp b/src/pathops/SkPathOpsLine.cpp
index 9003547..211acf2 100644
--- a/src/pathops/SkPathOpsLine.cpp
+++ b/src/pathops/SkPathOpsLine.cpp
@@ -48,9 +48,9 @@
SkDPoint realPt = ptAtT(t);
double dist = realPt.distance(xy); // OPTIMIZATION: can we compare against distSq instead ?
// find the ordinal in the original line with the largest unsigned exponent
- double tiniest = SkTMin(SkTMin(SkTMin(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
- double largest = SkTMax(SkTMax(SkTMax(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(std::min(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
+ double largest = std::max(std::max(std::max(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
+ largest = std::max(largest, -tiniest);
if (!AlmostEqualUlps_Pin(largest, largest + dist)) { // is the dist within ULPS tolerance?
return -1;
}
@@ -72,9 +72,9 @@
SkDPoint realPt = ptAtT(t);
double dist = realPt.distance(xy); // OPTIMIZATION: can we compare against distSq instead ?
// find the ordinal in the original line with the largest unsigned exponent
- double tiniest = SkTMin(SkTMin(SkTMin(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
- double largest = SkTMax(SkTMax(SkTMax(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(std::min(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
+ double largest = std::max(std::max(std::max(fPts[0].fX, fPts[0].fY), fPts[1].fX), fPts[1].fY);
+ largest = std::max(largest, -tiniest);
return RoughlyEqualUlps(largest, largest + dist); // is the dist within ULPS tolerance?
}
@@ -104,9 +104,9 @@
SkDVector distU = {xy.fY - y, xy.fX - realPtX};
double distSq = distU.fX * distU.fX + distU.fY * distU.fY;
double dist = sqrt(distSq); // OPTIMIZATION: can we compare against distSq instead ?
- double tiniest = SkTMin(SkTMin(y, left), right);
- double largest = SkTMax(SkTMax(y, left), right);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(y, left), right);
+ double largest = std::max(std::max(y, left), right);
+ largest = std::max(largest, -tiniest);
if (!AlmostEqualUlps(largest, largest + dist)) { // is the dist within ULPS tolerance?
return -1;
}
@@ -139,9 +139,9 @@
SkDVector distU = {xy.fX - x, xy.fY - realPtY};
double distSq = distU.fX * distU.fX + distU.fY * distU.fY;
double dist = sqrt(distSq); // OPTIMIZATION: can we compare against distSq instead ?
- double tiniest = SkTMin(SkTMin(x, top), bottom);
- double largest = SkTMax(SkTMax(x, top), bottom);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(x, top), bottom);
+ double largest = std::max(std::max(x, top), bottom);
+ largest = std::max(largest, -tiniest);
if (!AlmostEqualUlps(largest, largest + dist)) { // is the dist within ULPS tolerance?
return -1;
}
diff --git a/src/pathops/SkPathOpsPoint.h b/src/pathops/SkPathOpsPoint.h
index bca0530..63de458 100644
--- a/src/pathops/SkPathOpsPoint.h
+++ b/src/pathops/SkPathOpsPoint.h
@@ -160,9 +160,9 @@
return false;
}
double dist = distance(a); // OPTIMIZATION: can we compare against distSq instead ?
- double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY);
- double largest = SkTMax(SkTMax(SkTMax(fX, a.fX), fY), a.fY);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(std::min(fX, a.fX), fY), a.fY);
+ double largest = std::max(std::max(std::max(fX, a.fX), fY), a.fY);
+ largest = std::max(largest, -tiniest);
return AlmostDequalUlps(largest, largest + dist); // is the dist within ULPS tolerance?
}
@@ -180,9 +180,9 @@
return false;
}
double dist = distance(a); // OPTIMIZATION: can we compare against distSq instead ?
- double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY);
- double largest = SkTMax(SkTMax(SkTMax(fX, a.fX), fY), a.fY);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(std::min(fX, a.fX), fY), a.fY);
+ double largest = std::max(std::max(std::max(fX, a.fX), fY), a.fY);
+ largest = std::max(largest, -tiniest);
return AlmostPequalUlps(largest, largest + dist); // is the dist within ULPS tolerance?
}
@@ -203,9 +203,9 @@
dA.set(a);
dB.set(b);
double dist = dA.distance(dB); // OPTIMIZATION: can we compare against distSq instead ?
- float tiniest = SkTMin(SkTMin(SkTMin(a.fX, b.fX), a.fY), b.fY);
- float largest = SkTMax(SkTMax(SkTMax(a.fX, b.fX), a.fY), b.fY);
- largest = SkTMax(largest, -tiniest);
+ float tiniest = std::min(std::min(std::min(a.fX, b.fX), a.fY), b.fY);
+ float largest = std::max(std::max(std::max(a.fX, b.fX), a.fY), b.fY);
+ largest = std::max(largest, -tiniest);
return AlmostDequalUlps((double) largest, largest + dist); // is dist within ULPS tolerance?
}
@@ -241,9 +241,9 @@
return true;
}
double dist = distance(a); // OPTIMIZATION: can we compare against distSq instead ?
- double tiniest = SkTMin(SkTMin(SkTMin(fX, a.fX), fY), a.fY);
- double largest = SkTMax(SkTMax(SkTMax(fX, a.fX), fY), a.fY);
- largest = SkTMax(largest, -tiniest);
+ double tiniest = std::min(std::min(std::min(fX, a.fX), fY), a.fY);
+ double largest = std::max(std::max(std::max(fX, a.fX), fY), a.fY);
+ largest = std::max(largest, -tiniest);
return RoughlyEqualUlps(largest, largest + dist); // is the dist within ULPS tolerance?
}
@@ -255,18 +255,18 @@
dA.set(a);
dB.set(b);
double dist = dA.distance(dB); // OPTIMIZATION: can we compare against distSq instead ?
- float tiniest = SkTMin(SkTMin(SkTMin(a.fX, b.fX), a.fY), b.fY);
- float largest = SkTMax(SkTMax(SkTMax(a.fX, b.fX), a.fY), b.fY);
- largest = SkTMax(largest, -tiniest);
+ float tiniest = std::min(std::min(std::min(a.fX, b.fX), a.fY), b.fY);
+ float largest = std::max(std::max(std::max(a.fX, b.fX), a.fY), b.fY);
+ largest = std::max(largest, -tiniest);
return RoughlyEqualUlps((double) largest, largest + dist); // is dist within ULPS tolerance?
}
// very light weight check, should only be used for inequality check
static bool WayRoughlyEqual(const SkPoint& a, const SkPoint& b) {
- float largestNumber = SkTMax(SkTAbs(a.fX), SkTMax(SkTAbs(a.fY),
- SkTMax(SkTAbs(b.fX), SkTAbs(b.fY))));
+ float largestNumber = std::max(SkTAbs(a.fX), std::max(SkTAbs(a.fY),
+ std::max(SkTAbs(b.fX), SkTAbs(b.fY))));
SkVector diffs = a - b;
- float largestDiff = SkTMax(diffs.fX, diffs.fY);
+ float largestDiff = std::max(diffs.fX, diffs.fY);
return roughly_zero_when_compared_to(largestDiff, largestNumber);
}
diff --git a/src/pathops/SkPathOpsQuad.cpp b/src/pathops/SkPathOpsQuad.cpp
index 45cd78b..bbd4bee 100644
--- a/src/pathops/SkPathOpsQuad.cpp
+++ b/src/pathops/SkPathOpsQuad.cpp
@@ -188,11 +188,11 @@
// FIXME: maybe it's possible to avoid this and compare non-normalized
lineParameters.normalize();
double distance = lineParameters.controlPtDistance(*this);
- double tiniest = SkTMin(SkTMin(SkTMin(SkTMin(SkTMin(fPts[0].fX, fPts[0].fY),
+ double tiniest = std::min(std::min(std::min(std::min(std::min(fPts[0].fX, fPts[0].fY),
fPts[1].fX), fPts[1].fY), fPts[2].fX), fPts[2].fY);
- double largest = SkTMax(SkTMax(SkTMax(SkTMax(SkTMax(fPts[0].fX, fPts[0].fY),
+ double largest = std::max(std::max(std::max(std::max(std::max(fPts[0].fX, fPts[0].fY),
fPts[1].fX), fPts[1].fY), fPts[2].fX), fPts[2].fY);
- largest = SkTMax(largest, -tiniest);
+ largest = std::max(largest, -tiniest);
return approximately_zero_when_compared_to(distance, largest);
}
diff --git a/src/pathops/SkPathOpsRect.h b/src/pathops/SkPathOpsRect.h
index 2f2a9f0..ea9c037 100644
--- a/src/pathops/SkPathOpsRect.h
+++ b/src/pathops/SkPathOpsRect.h
@@ -15,10 +15,10 @@
double fLeft, fTop, fRight, fBottom;
void add(const SkDPoint& pt) {
- fLeft = SkTMin(fLeft, pt.fX);
- fTop = SkTMin(fTop, pt.fY);
- fRight = SkTMax(fRight, pt.fX);
- fBottom = SkTMax(fBottom, pt.fY);
+ fLeft = std::min(fLeft, pt.fX);
+ fTop = std::min(fTop, pt.fY);
+ fRight = std::max(fRight, pt.fX);
+ fBottom = std::max(fBottom, pt.fY);
}
bool contains(const SkDPoint& pt) const {
diff --git a/src/pathops/SkPathOpsTSect.cpp b/src/pathops/SkPathOpsTSect.cpp
index f24d4b5..674c635 100644
--- a/src/pathops/SkPathOpsTSect.cpp
+++ b/src/pathops/SkPathOpsTSect.cpp
@@ -226,7 +226,7 @@
fBounds.setBounds(*fPart);
fCoinStart.init();
fCoinEnd.init();
- fBoundsMax = SkTMax(fBounds.width(), fBounds.height());
+ fBoundsMax = std::max(fBounds.width(), fBounds.height());
fCollapsed = fPart->collapsed();
fHasPerp = false;
fDeleted = false;
@@ -278,12 +278,12 @@
double origY = (*fPart)[start].fY;
double adj = (*fPart)[end].fX - origX;
double opp = (*fPart)[end].fY - origY;
- double maxPart = SkTMax(fabs(adj), fabs(opp));
+ double maxPart = std::max(fabs(adj), fabs(opp));
double sign = 0; // initialization to shut up warning in release build
for (int n = 0; n < q2.pointCount(); ++n) {
double dx = q2[n].fY - origY;
double dy = q2[n].fX - origX;
- double maxVal = SkTMax(maxPart, SkTMax(fabs(dx), fabs(dy)));
+ double maxVal = std::max(maxPart, std::max(fabs(dx), fabs(dy)));
double test = (q2[n].fY - origY) * adj - (q2[n].fX - origX) * opp;
if (precisely_zero_when_compared_to(test, maxVal)) {
return 1;
@@ -446,7 +446,7 @@
#endif
#if DEBUG_T_SECT
SkASSERT(fBounds.width() || fBounds.height() || fCollapsed);
- SkASSERT(fBoundsMax == SkTMax(fBounds.width(), fBounds.height()) || fCollapsed == 0xFF);
+ SkASSERT(fBoundsMax == std::max(fBounds.width(), fBounds.height()) || fCollapsed == 0xFF);
SkASSERT(0 <= fStartT);
SkASSERT(fEndT <= 1);
SkASSERT(fStartT <= fEndT);
@@ -686,8 +686,8 @@
first->fCoinStart.setPerp(fCurve, start1s, fCurve[0], sect2->fCurve);
first->fCoinEnd.setPerp(fCurve, start1e, this->pointLast(), sect2->fCurve);
bool oppMatched = first->fCoinStart.perpT() < first->fCoinEnd.perpT();
- double oppStartT = first->fCoinStart.perpT() == -1 ? 0 : SkTMax(0., first->fCoinStart.perpT());
- double oppEndT = first->fCoinEnd.perpT() == -1 ? 1 : SkTMin(1., first->fCoinEnd.perpT());
+ double oppStartT = first->fCoinStart.perpT() == -1 ? 0 : std::max(0., first->fCoinStart.perpT());
+ double oppEndT = first->fCoinEnd.perpT() == -1 ? 1 : std::min(1., first->fCoinEnd.perpT());
if (!oppMatched) {
using std::swap;
swap(oppStartT, oppEndT);
@@ -1163,8 +1163,8 @@
using std::swap;
swap(tStart, tEnd);
}
- tStart = SkTMax(tStart, span->fStartT);
- tEnd = SkTMin(tEnd, span->fEndT);
+ tStart = std::max(tStart, span->fStartT);
+ tEnd = std::min(tEnd, span->fEndT);
if (tStart > tEnd) {
return 0;
}
@@ -1704,10 +1704,10 @@
}
void update(const SkClosestRecord& mate) {
- fC1StartT = SkTMin(fC1StartT, mate.fC1StartT);
- fC1EndT = SkTMax(fC1EndT, mate.fC1EndT);
- fC2StartT = SkTMin(fC2StartT, mate.fC2StartT);
- fC2EndT = SkTMax(fC2EndT, mate.fC2EndT);
+ fC1StartT = std::min(fC1StartT, mate.fC1StartT);
+ fC1EndT = std::max(fC1EndT, mate.fC1EndT);
+ fC2StartT = std::min(fC2StartT, mate.fC2StartT);
+ fC2EndT = std::max(fC2EndT, mate.fC2EndT);
}
const SkTSpan* fC1Span;
diff --git a/src/pathops/SkPathOpsTightBounds.cpp b/src/pathops/SkPathOpsTightBounds.cpp
index ff1d177..4e2af89 100644
--- a/src/pathops/SkPathOpsTightBounds.cpp
+++ b/src/pathops/SkPathOpsTightBounds.cpp
@@ -17,10 +17,10 @@
verb = iter.next(pts);
switch (verb) {
case SkPath::kMove_Verb:
- moveBounds.fLeft = SkTMin(moveBounds.fLeft, pts[0].fX);
- moveBounds.fTop = SkTMin(moveBounds.fTop, pts[0].fY);
- moveBounds.fRight = SkTMax(moveBounds.fRight, pts[0].fX);
- moveBounds.fBottom = SkTMax(moveBounds.fBottom, pts[0].fY);
+ moveBounds.fLeft = std::min(moveBounds.fLeft, pts[0].fX);
+ moveBounds.fTop = std::min(moveBounds.fTop, pts[0].fY);
+ moveBounds.fRight = std::max(moveBounds.fRight, pts[0].fX);
+ moveBounds.fBottom = std::max(moveBounds.fBottom, pts[0].fY);
break;
case SkPath::kQuad_Verb:
case SkPath::kConic_Verb:
diff --git a/src/pathops/SkPathOpsTypes.cpp b/src/pathops/SkPathOpsTypes.cpp
index 92c3a7a..65fb780 100644
--- a/src/pathops/SkPathOpsTypes.cpp
+++ b/src/pathops/SkPathOpsTypes.cpp
@@ -123,7 +123,7 @@
if (fabs(a) < SK_ScalarMax && fabs(b) < SK_ScalarMax) {
return AlmostDequalUlps(SkDoubleToScalar(a), SkDoubleToScalar(b));
}
- return fabs(a - b) / SkTMax(fabs(a), fabs(b)) < FLT_EPSILON * 16;
+ return fabs(a - b) / std::max(fabs(a), fabs(b)) < FLT_EPSILON * 16;
}
bool AlmostEqualUlps(float a, float b) {
diff --git a/src/pathops/SkReduceOrder.cpp b/src/pathops/SkReduceOrder.cpp
index 72a6168..8ba0fb0 100644
--- a/src/pathops/SkReduceOrder.cpp
+++ b/src/pathops/SkReduceOrder.cpp
@@ -207,8 +207,8 @@
for (index = 0; index < 4; ++index) {
double cx = cubic[index].fX;
double cy = cubic[index].fY;
- double denom = SkTMax(fabs(cx), SkTMax(fabs(cy),
- SkTMax(fabs(cubic[minX].fX), fabs(cubic[minY].fY))));
+ double denom = std::max(fabs(cx), std::max(fabs(cy),
+ std::max(fabs(cubic[minX].fX), fabs(cubic[minY].fY))));
if (denom == 0) {
minXSet |= 1 << index;
minYSet |= 1 << index;
diff --git a/src/pdf/SkDeflate.cpp b/src/pdf/SkDeflate.cpp
index 097f85e..a8bd667 100644
--- a/src/pdf/SkDeflate.cpp
+++ b/src/pdf/SkDeflate.cpp
@@ -14,6 +14,8 @@
#include "zlib.h"
+#include <algorithm>
+
namespace {
// Different zlib implementations use different T.
@@ -103,7 +105,7 @@
const char* buffer = (const char*)void_buffer;
while (len > 0) {
size_t tocopy =
- SkTMin(len, sizeof(fImpl->fInBuffer) - fImpl->fInBufferIndex);
+ std::min(len, sizeof(fImpl->fInBuffer) - fImpl->fInBufferIndex);
memcpy(fImpl->fInBuffer + fImpl->fInBufferIndex, buffer, tocopy);
len -= tocopy;
buffer += tocopy;
diff --git a/src/pdf/SkPDFBitmap.cpp b/src/pdf/SkPDFBitmap.cpp
index beaf088..86bfc80 100644
--- a/src/pdf/SkPDFBitmap.cpp
+++ b/src/pdf/SkPDFBitmap.cpp
@@ -45,10 +45,10 @@
SkASSERT(kBGRA_8888_SkColorType == bm.colorType());
unsigned r = 0, g = 0, b = 0, n = 0;
// Clamp the range to the edge of the bitmap.
- int ymin = SkTMax(0, yOrig - 1);
- int ymax = SkTMin(yOrig + 1, bm.height() - 1);
- int xmin = SkTMax(0, xOrig - 1);
- int xmax = SkTMin(xOrig + 1, bm.width() - 1);
+ int ymin = std::max(0, yOrig - 1);
+ int ymax = std::min(yOrig + 1, bm.height() - 1);
+ int xmin = std::max(0, xOrig - 1);
+ int xmax = std::min(xOrig + 1, bm.width() - 1);
for (int y = ymin; y <= ymax; ++y) {
const SkColor* scanline = bm.addr32(0, y);
for (int x = xmin; x <= xmax; ++x) {
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index e908f50..4fa981b 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -134,7 +134,7 @@
uint16_t g = font.unicharToGlyph(c);
SkRect bounds;
font.getBounds(&g, 1, &bounds, nullptr);
- stemV = SkTMin(stemV, SkToS16(SkScalarRoundToInt(bounds.width())));
+ stemV = std::min(stemV, SkToS16(SkScalarRoundToInt(bounds.width())));
}
metrics->fStemV = stemV;
}
@@ -215,7 +215,7 @@
firstNonZeroGlyph = 1;
} else {
firstNonZeroGlyph = subsetCode;
- lastGlyph = SkToU16(SkTMin<int>((int)lastGlyph, 254 + (int)subsetCode));
+ lastGlyph = SkToU16(std::min<int>((int)lastGlyph, 254 + (int)subsetCode));
}
auto ref = doc->reserveRef();
return doc->fFontMap.set(
@@ -455,7 +455,7 @@
for (int y = 0; y < bm.height(); ++y) {
for (int x8 = 0; x8 < bm.width(); x8 += 8) {
uint8_t v = *mask.getAddr1(x8 + bounds.x(), y + bounds.y());
- int e = SkTMin(x8 + 8, bm.width());
+ int e = std::min(x8 + 8, bm.width());
for (int x = x8; x < e; ++x) {
*bm.getAddr8(x, y) = (v >> (x & 0x7)) & 0x1 ? 0xFF : 0x00;
}
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index da0d497..ef240c7 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1763,7 +1763,7 @@
if (offset > tableLength) {
return 0;
}
- FT_ULong size = SkTMin((FT_ULong)length, tableLength - (FT_ULong)offset);
+ FT_ULong size = std::min((FT_ULong)length, tableLength - (FT_ULong)offset);
if (data) {
error = FT_Load_Sfnt_Table(face, tag, offset, reinterpret_cast<FT_Byte*>(data), &size);
if (error) {
diff --git a/src/ports/SkFontHost_FreeType_common.cpp b/src/ports/SkFontHost_FreeType_common.cpp
index 531ca88..afbfec5 100644
--- a/src/ports/SkFontHost_FreeType_common.cpp
+++ b/src/ports/SkFontHost_FreeType_common.cpp
@@ -68,16 +68,16 @@
uint16_t packTriple(U8CPU r, U8CPU g, U8CPU b) {
#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
- r = SkTMax(r, (U8CPU)0x40);
- g = SkTMax(g, (U8CPU)0x40);
- b = SkTMax(b, (U8CPU)0x40);
+ r = std::max(r, (U8CPU)0x40);
+ g = std::max(g, (U8CPU)0x40);
+ b = std::max(b, (U8CPU)0x40);
#endif
return SkPack888ToRGB16(r, g, b);
}
uint16_t grayToRGB16(U8CPU gray) {
#ifdef SK_SHOW_TEXT_BLIT_COVERAGE
- gray = SkTMax(gray, (U8CPU)0x40);
+ gray = std::max(gray, (U8CPU)0x40);
#endif
return SkPack888ToRGB16(gray, gray, gray);
}
@@ -234,7 +234,7 @@
if ((FT_PIXEL_MODE_MONO == srcFormat && SkMask::kBW_Format == dstFormat) ||
(FT_PIXEL_MODE_GRAY == srcFormat && SkMask::kA8_Format == dstFormat))
{
- size_t commonRowBytes = SkTMin(srcRowBytes, dstRowBytes);
+ size_t commonRowBytes = std::min(srcRowBytes, dstRowBytes);
for (size_t y = height; y --> 0;) {
memcpy(dst, src, commonRowBytes);
src += srcPitch;
@@ -554,7 +554,7 @@
for (int y = 0; y < glyph.fHeight; ++y) {
for (int x = 0; x < glyph.fWidth; ++x) {
uint8_t& a = ((uint8_t*)glyph.fImage)[(glyph.rowBytes() * y) + x];
- a = SkTMax<uint8_t>(a, 0x20);
+ a = std::max<uint8_t>(a, 0x20);
}
}
#endif
diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp
index d1a230f..eec5552 100644
--- a/src/ports/SkFontHost_mac.cpp
+++ b/src/ports/SkFontHost_mac.cpp
@@ -1348,7 +1348,7 @@
U8CPU b = 0xFF - ((rgb >> 0) & 0xFF);
U8CPU lum = sk_apply_lut_if<APPLY_PREBLEND>(SkComputeLuminance(r, g, b), table8);
#if SK_SHOW_TEXT_BLIT_COVERAGE
- lum = SkTMax(lum, (U8CPU)0x30);
+ lum = std::max(lum, (U8CPU)0x30);
#endif
return lum;
}
@@ -1377,9 +1377,9 @@
U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>(0xFF - ((rgb >> 8) & 0xFF), tableG);
U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>(0xFF - ((rgb >> 0) & 0xFF), tableB);
#if SK_SHOW_TEXT_BLIT_COVERAGE
- r = SkTMax(r, (U8CPU)0x30);
- g = SkTMax(g, (U8CPU)0x30);
- b = SkTMax(b, (U8CPU)0x30);
+ r = std::max(r, (U8CPU)0x30);
+ g = std::max(g, (U8CPU)0x30);
+ b = std::max(b, (U8CPU)0x30);
#endif
return SkPack888ToRGB16(r, g, b);
}
@@ -1410,7 +1410,7 @@
U8CPU g = (rgb >> 8) & 0xFF;
U8CPU b = (rgb >> 0) & 0xFF;
#if SK_SHOW_TEXT_BLIT_COVERAGE
- a = SkTMax(a, (U8CPU)0x30);
+ a = std::max(a, (U8CPU)0x30);
#endif
return SkPackARGB32(a, r, g, b);
}
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 66936c1..1fa12c9 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -1914,7 +1914,7 @@
const uint32_t* utf32 = reinterpret_cast<const uint32_t*>(uni);
while (glyphIndex < glyphCount) {
// Try a run of bmp.
- int glyphsLeft = SkTMin(glyphCount - glyphIndex, scratchCount);
+ int glyphsLeft = std::min(glyphCount - glyphIndex, scratchCount);
int runLength = 0;
while (runLength < glyphsLeft && utf32[glyphIndex + runLength] <= 0xFFFF) {
scratch[runLength] = static_cast<WCHAR>(utf32[glyphIndex + runLength]);
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index 9e34e07..7864f06 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -249,7 +249,7 @@
if (offset > table.fSize) {
return 0;
}
- size_t size = SkTMin(length, table.fSize - offset);
+ size_t size = std::min(length, table.fSize - offset);
if (data) {
memcpy(data, table.fData + offset, size);
}
@@ -410,7 +410,7 @@
return;
}
if (0 < glyph && glyphToUnicode[glyph] == 0) {
- maxGlyph = SkTMax(static_cast<int>(glyph), maxGlyph);
+ maxGlyph = std::max(static_cast<int>(glyph), maxGlyph);
glyphToUnicode[glyph] = c; // Always use lowest-index unichar.
--remainingGlyphCount;
}
diff --git a/src/sfnt/SkOTTable_name.cpp b/src/sfnt/SkOTTable_name.cpp
index 185c789..c9d47b8 100644
--- a/src/sfnt/SkOTTable_name.cpp
+++ b/src/sfnt/SkOTTable_name.cpp
@@ -475,7 +475,7 @@
// Find the next record which matches the requested type.
SkOTTableName::Record nameRecord;
const size_t nameRecordsCount = SkEndian_SwapBE16(nameTable.count);
- const size_t nameRecordsMax = SkTMin(nameRecordsCount, nameRecordsSize / sizeof(nameRecord));
+ const size_t nameRecordsMax = std::min(nameRecordsCount, nameRecordsSize / sizeof(nameRecord));
do {
if (fIndex >= nameRecordsMax) {
return false;
diff --git a/src/shaders/SkBitmapProcShader.cpp b/src/shaders/SkBitmapProcShader.cpp
index d157a73..d630c45 100644
--- a/src/shaders/SkBitmapProcShader.cpp
+++ b/src/shaders/SkBitmapProcShader.cpp
@@ -69,7 +69,7 @@
SkASSERT(state.fPixmap.addr());
for (;;) {
- int n = SkTMin(count, max);
+ int n = std::min(count, max);
SkASSERT(n > 0 && n < BUF_MAX*2);
mproc(state, buffer, n, x, y);
sproc(state, buffer, n, dstC);
diff --git a/src/shaders/SkLightingShader.cpp b/src/shaders/SkLightingShader.cpp
index 63a656e..d27202f 100644
--- a/src/shaders/SkLightingShader.cpp
+++ b/src/shaders/SkLightingShader.cpp
@@ -363,7 +363,7 @@
SkColor diffColor = fPaintColor;
do {
- int n = SkTMin(count, BUFFER_MAX);
+ int n = std::min(count, BUFFER_MAX);
fNormalProvider->fillScanLine(x, y, normals, n);
diff --git a/src/shaders/SkPerlinNoiseShader.cpp b/src/shaders/SkPerlinNoiseShader.cpp
index 901fa6a..6d8b56d 100644
--- a/src/shaders/SkPerlinNoiseShader.cpp
+++ b/src/shaders/SkPerlinNoiseShader.cpp
@@ -74,9 +74,9 @@
{}
StitchData(SkScalar w, SkScalar h)
- : fWidth(SkTMin(SkScalarRoundToInt(w), SK_MaxS32 - kPerlinNoise))
+ : fWidth(std::min(SkScalarRoundToInt(w), SK_MaxS32 - kPerlinNoise))
, fWrapX(kPerlinNoise + fWidth)
- , fHeight(SkTMin(SkScalarRoundToInt(h), SK_MaxS32 - kPerlinNoise))
+ , fHeight(std::min(SkScalarRoundToInt(h), SK_MaxS32 - kPerlinNoise))
, fWrapY(kPerlinNoise + fHeight) {}
bool operator==(const StitchData& other) const {
diff --git a/src/shaders/gradients/Sk4fLinearGradient.cpp b/src/shaders/gradients/Sk4fLinearGradient.cpp
index b4266ce..d75bec9 100644
--- a/src/shaders/gradients/Sk4fLinearGradient.cpp
+++ b/src/shaders/gradients/Sk4fLinearGradient.cpp
@@ -58,7 +58,7 @@
SkScalar pinFx<SkTileMode::kRepeat>(SkScalar fx) {
SkScalar f = SkScalarIsFinite(fx) ? SkScalarFraction(fx) : 0;
if (f < 0) {
- f = SkTMin(f + 1, nextafterf(1, 0));
+ f = std::min(f + 1, nextafterf(1, 0));
}
SkASSERT(f >= 0);
SkASSERT(f < 1.0f);
@@ -69,7 +69,7 @@
SkScalar pinFx<SkTileMode::kMirror>(SkScalar fx) {
SkScalar f = SkScalarIsFinite(fx) ? SkScalarMod(fx, 2.0f) : 0;
if (f < 0) {
- f = SkTMin(f + 2, nextafterf(2, 0));
+ f = std::min(f + 2, nextafterf(2, 0));
}
SkASSERT(f >= 0);
SkASSERT(f < 2.0f);
@@ -227,7 +227,7 @@
while (count > 0) {
// What we really want here is SkTPin(advance, 1, count)
// but that's a significant perf hit for >> stops; investigate.
- const int n = SkTMin(SkScalarTruncToInt(proc.currentAdvance() + 1), count);
+ const int n = std::min(SkScalarTruncToInt(proc.currentAdvance() + 1), count);
// The current interval advance can be +inf (e.g. when reaching
// the clamp mode end intervals) - when that happens, we expect to
diff --git a/src/shaders/gradients/SkTwoPointConicalGradient.cpp b/src/shaders/gradients/SkTwoPointConicalGradient.cpp
index efc6e74..e653351 100644
--- a/src/shaders/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/shaders/gradients/SkTwoPointConicalGradient.cpp
@@ -55,13 +55,13 @@
Type gradientType;
if (SkScalarNearlyZero((c0 - c1).length())) {
- if (SkScalarNearlyZero(SkTMax(r0, r1)) || SkScalarNearlyEqual(r0, r1)) {
+ if (SkScalarNearlyZero(std::max(r0, r1)) || SkScalarNearlyEqual(r0, r1)) {
// Degenerate case; avoid dividing by zero. Should have been caught by caller but
// just in case, recheck here.
return nullptr;
}
// Concentric case: we can pretend we're radial (with a tiny twist).
- const SkScalar scale = sk_ieee_float_divide(1, SkTMax(r0, r1));
+ const SkScalar scale = sk_ieee_float_divide(1, std::max(r0, r1));
gradientMatrix = SkMatrix::MakeTrans(-c1.x(), -c1.y());
gradientMatrix.postScale(scale, scale);
@@ -185,7 +185,7 @@
p->append(SkRasterPipeline::xy_to_radius);
// Tiny twist: radial computes a t for [0, r2], but we want a t for [r1, r2].
- auto scale = SkTMax(fRadius1, fRadius2) / dRadius;
+ auto scale = std::max(fRadius1, fRadius2) / dRadius;
auto bias = -fRadius1 / dRadius;
p->append_matrix(alloc, SkMatrix::Concat(SkMatrix::MakeTrans(bias, 0),
@@ -242,7 +242,7 @@
if (fType == Type::kRadial) {
float denom = 1.0f / (fRadius2 - fRadius1),
- scale = SkTMax(fRadius1, fRadius2) * denom,
+ scale = std::max(fRadius1, fRadius2) * denom,
bias = -fRadius1 * denom;
return p->mad(p->norm(x,y), p->uniformF(uniforms->pushF(scale))
, p->uniformF(uniforms->pushF(bias )));
diff --git a/src/utils/SkDashPath.cpp b/src/utils/SkDashPath.cpp
index f94df30..35ab1082 100644
--- a/src/utils/SkDashPath.cpp
+++ b/src/utils/SkDashPath.cpp
@@ -92,7 +92,7 @@
// Large values are scaled by SK_ScalarNearlyZero so significant bits change.
static void adjust_zero_length_line(SkPoint pts[2]) {
SkASSERT(pts[0] == pts[1]);
- pts[1].fX += SkTMax(1.001f, pts[1].fX) * SK_ScalarNearlyZero;
+ pts[1].fX += std::max(1.001f, pts[1].fX) * SK_ScalarNearlyZero;
}
static bool clip_line(SkPoint pts[2], const SkRect& bounds, SkScalar intervalLength,
@@ -245,7 +245,7 @@
// resulting points = 4 * segments
SkScalar ptCount = pathLength * intervalCount / (float)intervalLength;
- ptCount = SkTMin(ptCount, SkDashPath::kMaxDashCount);
+ ptCount = std::min(ptCount, SkDashPath::kMaxDashCount);
int n = SkScalarCeilToInt(ptCount) << 2;
dst->incReserve(n);
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 6c2d310..30a957d 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -103,7 +103,7 @@
// Some data has already been copied to fBuffer. Read up to the
// lesser of the size requested and the remainder of the buffered
// data.
- const size_t bytesToCopy = SkTMin(size, fBufferedSoFar - fOffset);
+ const size_t bytesToCopy = std::min(size, fBufferedSoFar - fOffset);
if (dst != nullptr) {
memcpy(dst, fBuffer + fOffset, bytesToCopy);
}
@@ -122,7 +122,7 @@
SkASSERT(fBuffer);
// Data needs to be buffered. Buffer up to the lesser of the size requested
// and the remainder of the max buffer size.
- const size_t bytesToBuffer = SkTMin(size, fBufferSize - fBufferedSoFar);
+ const size_t bytesToBuffer = std::min(size, fBufferSize - fBufferedSoFar);
char* buffer = fBuffer + fOffset;
const size_t buffered = fStream->read(buffer, bytesToBuffer);
@@ -164,7 +164,7 @@
return 0;
}
- size = SkTMin(size, fBufferSize - start);
+ size = std::min(size, fBufferSize - start);
FrontBufferedStream* nonConstThis = const_cast<FrontBufferedStream*>(this);
const size_t bytesRead = nonConstThis->read(dst, size);
nonConstThis->fOffset = start;
diff --git a/src/utils/SkMultiPictureDocument.cpp b/src/utils/SkMultiPictureDocument.cpp
index 25be716..8a47be1 100644
--- a/src/utils/SkMultiPictureDocument.cpp
+++ b/src/utils/SkMultiPictureDocument.cpp
@@ -42,7 +42,7 @@
static SkSize join(const SkTArray<SkSize>& sizes) {
SkSize joined = {0, 0};
for (SkSize s : sizes) {
- joined = SkSize{SkTMax(joined.width(), s.width()), SkTMax(joined.height(), s.height())};
+ joined = SkSize{std::max(joined.width(), s.width()), std::max(joined.height(), s.height())};
}
return joined;
}
@@ -185,8 +185,8 @@
}
SkSize joined = {0.0f, 0.0f};
for (int i = 0; i < dstArrayCount; ++i) {
- joined = SkSize{SkTMax(joined.width(), dstArray[i].fSize.width()),
- SkTMax(joined.height(), dstArray[i].fSize.height())};
+ joined = SkSize{std::max(joined.width(), dstArray[i].fSize.width()),
+ std::max(joined.height(), dstArray[i].fSize.height())};
}
auto picture = SkPicture::MakeFromStream(stream, procs);
diff --git a/src/utils/SkPolyUtils.cpp b/src/utils/SkPolyUtils.cpp
index 8c7bf1f..88ee766 100644
--- a/src/utils/SkPolyUtils.cpp
+++ b/src/utils/SkPolyUtils.cpp
@@ -1163,7 +1163,7 @@
}
// can't inset more than the half bounds of the polygon
- if (offset > SkTMin(SkTAbs(SK_ScalarHalf*bounds.width()),
+ if (offset > std::min(SkTAbs(SK_ScalarHalf*bounds.width()),
SkTAbs(SK_ScalarHalf*bounds.height()))) {
return false;
}
@@ -1209,7 +1209,7 @@
&rotSin, &rotCos, &numSteps)) {
return false;
}
- numEdges += SkTMax(numSteps, 1);
+ numEdges += std::max(numSteps, 1);
}
}
numEdges++;
@@ -1222,7 +1222,7 @@
&rotSin, &rotCos, &numSteps)) {
return false;
}
- numEdges += SkTMax(numSteps, 1);
+ numEdges += std::max(numSteps, 1);
}
// Make sure we don't overflow the max array count.
@@ -1249,7 +1249,7 @@
&rotSin, &rotCos, &numSteps)) {
return false;
}
- auto currEdge = edgeData.push_back_n(SkTMax(numSteps, 1));
+ auto currEdge = edgeData.push_back_n(std::max(numSteps, 1));
for (int i = 0; i < numSteps - 1; ++i) {
SkVector currNormal = SkVector::Make(prevNormal.fX*rotCos - prevNormal.fY*rotSin,
prevNormal.fY*rotCos + prevNormal.fX*rotSin);
@@ -1442,8 +1442,8 @@
Sk4s xy(p1.fX, p1.fY, p2.fX, p2.fY);
min = Sk4s::Min(min, xy);
max = Sk4s::Max(max, xy);
- bounds->setLTRB(SkTMin(min[0], min[2]), SkTMin(min[1], min[3]),
- SkTMax(max[0], max[2]), SkTMax(max[1], max[3]));
+ bounds->setLTRB(std::min(min[0], min[2]), std::min(min[1], min[3]),
+ std::max(max[0], max[2]), std::max(max[1], max[3]));
}
// test to see if point p is in triangle p0p1p2.
@@ -1490,7 +1490,7 @@
if (!SkScalarIsFinite(hCount)) {
return false;
}
- fHCount = SkTMax(SkTMin(SkScalarRoundToInt(hCount), vertexCount), 1);
+ fHCount = std::max(std::min(SkScalarRoundToInt(hCount), vertexCount), 1);
fVCount = vertexCount/fHCount;
fGridConversion.set(sk_ieee_float_divide(fHCount - 0.001f, width),
sk_ieee_float_divide(fVCount - 0.001f, height));
diff --git a/src/utils/SkShadowTessellator.cpp b/src/utils/SkShadowTessellator.cpp
index 943567f..9fdc51d 100644
--- a/src/utils/SkShadowTessellator.cpp
+++ b/src/utils/SkShadowTessellator.cpp
@@ -913,7 +913,7 @@
// umbraColor is the interior value, penumbraColor the exterior value.
auto outset = SkDrawShadowMetrics::AmbientBlurRadius(baseZ);
auto inset = outset * SkDrawShadowMetrics::AmbientRecipAlpha(baseZ) - outset;
- inset = SkTPin(inset, 0.0f, SkTMin(path.getBounds().width(),
+ inset = SkTPin(inset, 0.0f, std::min(path.getBounds().width(),
path.getBounds().height()));
if (!this->computePathPolygon(path, ctm)) {
diff --git a/src/utils/SkShadowUtils.cpp b/src/utils/SkShadowUtils.cpp
index f40854c..72895cc 100644
--- a/src/utils/SkShadowUtils.cpp
+++ b/src/utils/SkShadowUtils.cpp
@@ -494,8 +494,8 @@
int spotR = SkColorGetR(inSpotColor);
int spotG = SkColorGetG(inSpotColor);
int spotB = SkColorGetB(inSpotColor);
- int max = SkTMax(SkTMax(spotR, spotG), spotB);
- int min = SkTMin(SkTMin(spotR, spotG), spotB);
+ int max = std::max(std::max(spotR, spotG), spotB);
+ int min = std::min(std::min(spotR, spotG), spotB);
SkScalar luminance = 0.5f*(max + min)/255.f;
SkScalar origA = SkColorGetA(inSpotColor)/255.f;
diff --git a/src/utils/win/SkWGL_win.cpp b/src/utils/win/SkWGL_win.cpp
index 559fc4a..7461f66 100644
--- a/src/utils/win/SkWGL_win.cpp
+++ b/src/utils/win/SkWGL_win.cpp
@@ -147,7 +147,7 @@
&kQueryAttr,
&numSamples);
rankedFormats[i].fFormat = formats[i];
- rankedFormats[i].fSampleCnt = SkTMax(1, numSamples);
+ rankedFormats[i].fSampleCnt = std::max(1, numSamples);
rankedFormats[i].fChoosePixelFormatRank = i;
}
SkTQSort(rankedFormats.begin(),
@@ -336,7 +336,7 @@
unsigned int num;
int formats[64];
extensions.choosePixelFormat(dc, msaaIAttrs.begin(), fAttrs, 64, formats, &num);
- num = SkTMin(num, 64U);
+ num = std::min(num, 64U);
formatsToTry[0] = extensions.selectFormat(formats, num, dc, msaaSampleCount);
}
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index 42a3cf6..66a173a 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -168,7 +168,7 @@
"Could not create thumbnail generator.");
SkTScopedComPtr<IOpcPartUri> partUri;
- constexpr size_t size = SkTMax(
+ constexpr size_t size = std::max(
SK_ARRAY_COUNT(L"/Documents/1/Metadata/.png") + sk_digits_in<decltype(pageNum)>(),
SK_ARRAY_COUNT(L"/Metadata/" L_GUID_ID L".png"));
wchar_t buffer[size];
diff --git a/tests/ApplyGammaTest.cpp b/tests/ApplyGammaTest.cpp
index a854549..afc49f3 100644
--- a/tests/ApplyGammaTest.cpp
+++ b/tests/ApplyGammaTest.cpp
@@ -67,8 +67,8 @@
for (int c = 0; c < 3; ++c) {
float srcComponent = ((src & (0xff << (c * 8))) >> (c * 8)) * invScale;
- float lower = SkTMax(0.f, srcComponent - error);
- float upper = SkTMin(255.f, srcComponent + error);
+ float lower = std::max(0.f, srcComponent - error);
+ float upper = std::min(255.f, srcComponent + error);
if (toSRGB) {
lower = linear_to_srgb(lower / 255.f);
upper = linear_to_srgb(upper / 255.f);
diff --git a/tests/CodecPartialTest.cpp b/tests/CodecPartialTest.cpp
index 0ab6bdf..43ea226 100644
--- a/tests/CodecPartialTest.cpp
+++ b/tests/CodecPartialTest.cpp
@@ -131,7 +131,7 @@
// This size is arbitrary, but deliberately different from the buffer size used by SkPngCodec.
constexpr size_t kIncrement = 1000;
- test_partial(r, name, file, SkTMax(file->size() / 2, minBytes), kIncrement);
+ test_partial(r, name, file, std::max(file->size() / 2, minBytes), kIncrement);
}
DEF_TEST(Codec_partial, r) {
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp
index 7f29fd6..7ec94dd 100644
--- a/tests/CodecTest.cpp
+++ b/tests/CodecTest.cpp
@@ -150,7 +150,7 @@
for (int oddEven = 1; oddEven >= 0; oddEven--) {
for (int y = oddEven * stripeHeight; y < height; y += 2 * stripeHeight) {
SkIRect subset = SkIRect::MakeLTRB(0, y, info.width(),
- SkTMin(y + stripeHeight, height));
+ std::min(y + stripeHeight, height));
SkCodec::Options options;
options.fSubset = ⊂
if (SkCodec::kSuccess != codec->startIncrementalDecode(info, bm.getAddr(0, y),
@@ -847,7 +847,7 @@
, fLimit(limit) {}
size_t peek(void* buf, size_t bytes) const override {
- return fStream.peek(buf, SkTMin(bytes, fLimit));
+ return fStream.peek(buf, std::min(bytes, fLimit));
}
size_t read(void* buf, size_t bytes) override {
return fStream.read(buf, bytes);
diff --git a/tests/CompressedBackendAllocationTest.cpp b/tests/CompressedBackendAllocationTest.cpp
index 00d208c..bd4f02b 100644
--- a/tests/CompressedBackendAllocationTest.cpp
+++ b/tests/CompressedBackendAllocationTest.cpp
@@ -185,7 +185,7 @@
GrFillInCompressedData(compression, dimensions,
GrMipMapped::kNo, &data[mipMapOffsets[level]], levelColors[level]);
- dimensions = {SkTMax(1, dimensions.width() /2), SkTMax(1, dimensions.height()/2)};
+ dimensions = {std::max(1, dimensions.width() /2), std::max(1, dimensions.height()/2)};
}
return std::unique_ptr<const char[]>(data);
diff --git a/tests/FakeStreams.h b/tests/FakeStreams.h
index a5577e9..b527adf 100644
--- a/tests/FakeStreams.h
+++ b/tests/FakeStreams.h
@@ -52,7 +52,7 @@
{}
void addNewData(size_t extra) {
- fLimit = SkTMin(fTotalSize, fLimit + extra);
+ fLimit = std::min(fTotalSize, fLimit + extra);
}
size_t read(void* buffer, size_t size) override {
diff --git a/tests/FontMgrAndroidParserTest.cpp b/tests/FontMgrAndroidParserTest.cpp
index 2a41b60..12c2fd3 100644
--- a/tests/FontMgrAndroidParserTest.cpp
+++ b/tests/FontMgrAndroidParserTest.cpp
@@ -144,7 +144,7 @@
double f2 = fix * SK_FixedEpsilon_double;
double error = fabs(f - f2);
REPORTER_ASSERT(reporter, error <= SK_FixedEpsilon_double);
- maxError = SkTMax(maxError, error);
+ maxError = std::max(maxError, error);
} else {
REPORTER_ASSERT(reporter, f < -SK_FixedMax_double || SK_FixedMax_double < f);
}
diff --git a/tests/FrontBufferedStreamTest.cpp b/tests/FrontBufferedStreamTest.cpp
index e3f4352..99fe861 100644
--- a/tests/FrontBufferedStreamTest.cpp
+++ b/tests/FrontBufferedStreamTest.cpp
@@ -239,7 +239,7 @@
REPORTER_ASSERT(reporter, !bufferedStream->isAtEnd());
test_read(reporter, bufferedStream.get(), gAbcs + arbitraryOffset + currentPosition,
amountToRead);
- currentPosition = SkTMin(currentPosition + amountToRead, bufferedLength);
+ currentPosition = std::min(currentPosition + amountToRead, bufferedLength);
REPORTER_ASSERT(reporter, memStream->getPosition() - arbitraryOffset == currentPosition);
}
REPORTER_ASSERT(reporter, bufferedStream->isAtEnd());
diff --git a/tests/GrCCPRTest.cpp b/tests/GrCCPRTest.cpp
index 6af9ba1..3c40731 100644
--- a/tests/GrCCPRTest.cpp
+++ b/tests/GrCCPRTest.cpp
@@ -675,7 +675,7 @@
} else {
REPORTER_ASSERT(reporter, 0 == atlasIDRecorder.lastRenderedAtlasID());
}
- nextFlush = SkTMin(j + (int)rand.nextRangeU(1, 29), kNumPaths - 1);
+ nextFlush = std::min(j + (int)rand.nextRangeU(1, 29), kNumPaths - 1);
}
}
SkASSERT(endPathIdx == pathIdx % kNumPaths);
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index 6f04c50..9253ffc 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -181,7 +181,7 @@
// index.
while (i < kBoxCount) {
static_assert(kIndexPatternRepeatCount >= 3);
- int repetitionCount = SkTMin(3 - baseRepetition, kBoxCount - i);
+ int repetitionCount = std::min(3 - baseRepetition, kBoxCount - i);
GrMesh mesh(GrPrimitiveType::kTriangles);
mesh.setIndexed(helper->fIndexBuffer, repetitionCount * 6, baseRepetition * 6,
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index a2c70c1..b3421fd 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -1208,7 +1208,7 @@
for (int a = 0; a < 256; ++a) {
for (int r = 0; r < 256; ++r) {
// make all valid premul combinations
- int c = SkTMin(a, r);
+ int c = std::min(a, r);
*bm->getAddr32(a, r) = SkPackARGB32(a, c, c, c);
}
}
diff --git a/tests/IncrTopoSortTest.cpp b/tests/IncrTopoSortTest.cpp
index 9f5aa66..9f8d66a 100644
--- a/tests/IncrTopoSortTest.cpp
+++ b/tests/IncrTopoSortTest.cpp
@@ -159,7 +159,7 @@
this->dfs(dependent, (*dependedOn)[i]->indexInSort());
}
- lowerBound = SkTMin(dependent->indexInSort(), lowerBound);
+ lowerBound = std::min(dependent->indexInSort(), lowerBound);
}
this->shift(lowerBound);
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index ed358de..7d7427f 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -642,14 +642,7 @@
int i = sk_float_saturate2int(r.fFloat);
REPORTER_ASSERT(reporter, r.fExpectedInt == i);
- // ensure that these bound even non-finite values (including NaN)
-
- SkScalar mx = SkTMax<SkScalar>(r.fFloat, 50);
- REPORTER_ASSERT(reporter, mx >= 50);
-
- SkScalar mn = SkTMin<SkScalar>(r.fFloat, 50);
- REPORTER_ASSERT(reporter, mn <= 50);
-
+ // Ensure that SkTPin bounds even non-finite values (including NaN)
SkScalar p = SkTPin<SkScalar>(r.fFloat, 0, 100);
REPORTER_ASSERT(reporter, p >= 0 && p <= 100);
}
diff --git a/tests/PDFDeflateWStreamTest.cpp b/tests/PDFDeflateWStreamTest.cpp
index 20ee249..29a6b85 100644
--- a/tests/PDFDeflateWStreamTest.cpp
+++ b/tests/PDFDeflateWStreamTest.cpp
@@ -120,7 +120,7 @@
uint32_t j = 0;
while (j < size) {
uint32_t writeSize =
- SkTMin(size - j, random.nextRangeU(1, 400));
+ std::min(size - j, random.nextRangeU(1, 400));
if (!deflateWStream.write(&buffer[j], writeSize)) {
ERRORF(r, "something went wrong.");
return;
@@ -151,7 +151,7 @@
continue;
}
- uint32_t minLength = SkTMin(size,
+ uint32_t minLength = std::min(size,
(uint32_t)(decompressed->getLength()));
for (uint32_t i = 0; i < minLength; ++i) {
uint8_t c;
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp
index 7b9131d..a3400a3 100644
--- a/tests/PDFGlyphsToUnicodeTest.cpp
+++ b/tests/PDFGlyphsToUnicodeTest.cpp
@@ -82,7 +82,7 @@
subset.set(v);
}
SkPDFAppendCmapSections(&glyphToUnicode[0], &subset, &buffer, true, 0,
- SkTMin<SkGlyphID>(0xFFFF, lastGlyphID));
+ std::min<SkGlyphID>(0xFFFF, lastGlyphID));
char expectedResult[] =
"4 beginbfchar\n\
@@ -105,7 +105,7 @@
buffer.reset();
SkPDFAppendCmapSections(&glyphToUnicode[0], &subset, &buffer, true, 8,
- SkTMin<SkGlyphID>(0x00FF, lastGlyphID));
+ std::min<SkGlyphID>(0x00FF, lastGlyphID));
char expectedResultChop1[] =
"2 beginbfchar\n\
@@ -124,7 +124,7 @@
buffer.reset();
SkPDFAppendCmapSections(&glyphToUnicode[0], &subset, &buffer, true, 0x00D,
- SkTMin<SkGlyphID>(0x00FE, lastGlyphID));
+ std::min<SkGlyphID>(0x00FE, lastGlyphID));
char expectedResultChop2[] =
"2 beginbfchar\n\
@@ -138,7 +138,7 @@
buffer.reset();
SkPDFAppendCmapSections(&glyphToUnicode[0], nullptr, &buffer, false, 0xFC,
- SkTMin<SkGlyphID>(0x110, lastGlyphID));
+ std::min<SkGlyphID>(0x110, lastGlyphID));
char expectedResultSingleBytes[] =
"2 beginbfchar\n\
@@ -178,7 +178,7 @@
subset2.set(v);
}
SkPDFAppendCmapSections(&glyphToUnicode[0], &subset2, &buffer2, true, 0,
- SkTMin<SkGlyphID>(0xFFFF, lastGlyphID));
+ std::min<SkGlyphID>(0xFFFF, lastGlyphID));
char expectedResult2[] =
"4 beginbfchar\n\
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index bbf5e7a..e2cc2e0 100644
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -122,7 +122,7 @@
static double distEndRatio(double dist, const SkDQuad& quad) {
SkDVector v[] = {quad[2] - quad[0], quad[1] - quad[0], quad[2] - quad[1]};
- double longest = SkTMax(v[0].length(), SkTMax(v[1].length(), v[2].length()));
+ double longest = std::max(v[0].length(), std::max(v[1].length(), v[2].length()));
return longest / dist;
}
@@ -245,7 +245,7 @@
bool refCCW = angleDirection(a1, a2);
result->t1 = t1;
result->t2 = t2;
- result->tMin = SkTMin(t1, t2);
+ result->tMin = std::min(t1, t2);
result->a1 = a1;
result->a2 = a2;
result->ccw = refCCW;
@@ -268,7 +268,7 @@
};
double max = 0;
for (unsigned index = 0; index < SK_ARRAY_COUNT(corner); ++index) {
- max = SkTMax(max, corner[index].length());
+ max = std::max(max, corner[index].length());
}
return max;
}
@@ -276,16 +276,16 @@
static double maxQuad(const SkDQuad& quad) {
double max = 0;
for (int index = 0; index < 2; ++index) {
- max = SkTMax(max, fabs(quad[index].fX));
- max = SkTMax(max, fabs(quad[index].fY));
+ max = std::max(max, fabs(quad[index].fX));
+ max = std::max(max, fabs(quad[index].fY));
}
return max;
}
static bool bruteMinT(skiatest::Reporter* reporter, const SkDQuad& quad1, const SkDQuad& quad2,
TRange* lowerRange, TRange* upperRange) {
- double maxRadius = SkTMin(maxDist(quad1), maxDist(quad2));
- double maxQuads = SkTMax(maxQuad(quad1), maxQuad(quad2));
+ double maxRadius = std::min(maxDist(quad1), maxDist(quad2));
+ double maxQuads = std::max(maxQuad(quad1), maxQuad(quad2));
double r = maxRadius / 2;
double rStep = r / 2;
SkDPoint best1 = {SK_ScalarInfinity, SK_ScalarInfinity};
@@ -378,7 +378,7 @@
*lowerRange = tRange;
}
}
- lastHighR = SkTMin(r, lastHighR);
+ lastHighR = std::min(r, lastHighR);
}
r += success ? -rStep : rStep;
rStep /= 2;
@@ -487,11 +487,11 @@
for (unsigned index = 0; index < SK_ARRAY_COUNT(quads); ++index) {
const SkDQuad& q = *quads[index];
midSpokes[index] = q.ptAtT(0.5) - origin;
- minX = SkTMin(SkTMin(SkTMin(minX, origin.fX), q[1].fX), q[2].fX);
- minY = SkTMin(SkTMin(SkTMin(minY, origin.fY), q[1].fY), q[2].fY);
- maxX = SkTMax(SkTMax(SkTMax(maxX, origin.fX), q[1].fX), q[2].fX);
- maxY = SkTMax(SkTMax(SkTMax(maxY, origin.fY), q[1].fY), q[2].fY);
- maxWidth = SkTMax(maxWidth, SkTMax(maxX - minX, maxY - minY));
+ minX = std::min(std::min(std::min(minX, origin.fX), q[1].fX), q[2].fX);
+ minY = std::min(std::min(std::min(minY, origin.fY), q[1].fY), q[2].fY);
+ maxX = std::max(std::max(std::max(maxX, origin.fX), q[1].fX), q[2].fX);
+ maxY = std::max(std::max(std::max(maxY, origin.fY), q[1].fY), q[2].fY);
+ maxWidth = std::max(maxWidth, std::max(maxX - minX, maxY - minY));
intersect[index].intersectRay(q, rays[index]);
const SkIntersections& i = intersect[index];
REPORTER_ASSERT(reporter, i.used() >= 1);
@@ -636,7 +636,7 @@
TRange lowerRange, upperRange;
bool result = bruteMinT(reporter, q1, q2, &lowerRange, &upperRange);
REPORTER_ASSERT(reporter, result);
- double min = SkTMin(upperRange.t1, upperRange.t2);
+ double min = std::min(upperRange.t1, upperRange.t2);
if (smaller > min) {
small[0] = q1;
small[1] = q2;
@@ -833,7 +833,7 @@
REPORTER_ASSERT(reporter, s0xt0 != 0);
bool ccw = s0xt0 < 0;
bool agrees = bruteForceCheck(reporter, quad1, quad2, ccw);
- maxR = SkTMin(maxR, mDistance(reporter, agrees, quad1, quad2));
+ maxR = std::min(maxR, mDistance(reporter, agrees, quad1, quad2));
if (agrees) {
continue;
}
@@ -849,7 +849,7 @@
q2[1].fX = quad2[0].fX * (1 - hiPass) + quad2[1].fX * hiPass;
q2[1].fY = quad2[0].fY * (1 - hiPass) + quad2[1].fY * hiPass;
agrees = bruteForceCheck(reporter, q1, q2, ccw);
- maxR = SkTMin(maxR, mDistance(reporter, agrees, q1, q2));
+ maxR = std::min(maxR, mDistance(reporter, agrees, q1, q2));
if (agrees) {
break;
}
@@ -866,7 +866,7 @@
q2[1].fX = quad2[0].fX * (1 - midTest) + quad2[1].fX * midTest;
q2[1].fY = quad2[0].fY * (1 - midTest) + quad2[1].fY * midTest;
agrees = bruteForceCheck(reporter, q1, q2, ccw);
- maxR = SkTMin(maxR, mDistance(reporter, agrees, q1, q2));
+ maxR = std::min(maxR, mDistance(reporter, agrees, q1, q2));
if (!agrees) {
midPointAgrees(reporter, quad1, quad2, !ccw);
}
diff --git a/tests/PathOpsCubicLineIntersectionIdeas.cpp b/tests/PathOpsCubicLineIntersectionIdeas.cpp
index 449cdb3..8977992 100644
--- a/tests/PathOpsCubicLineIntersectionIdeas.cpp
+++ b/tests/PathOpsCubicLineIntersectionIdeas.cpp
@@ -80,7 +80,7 @@
// use larger x/y difference to choose step
if (calcDist > lessDist) {
t -= step;
- t = SkTMax(0., t);
+ t = std::max(0., t);
} else {
SkDPoint morePt = cubic.ptAtT(t + lastStep);
double moreX = morePt.fX - pt.fX;
@@ -90,7 +90,7 @@
continue;
}
t += step;
- t = SkTMin(1., t);
+ t = std::min(1., t);
}
} while (true);
return t;
@@ -177,13 +177,13 @@
#if 0
double R2MinusQ3;
if (r2check(A, B, C, D, &R2MinusQ3)) {
- smallestR2 = SkTMin(smallestR2, R2MinusQ3);
- largestR2 = SkTMax(largestR2, R2MinusQ3);
+ smallestR2 = std::min(smallestR2, R2MinusQ3);
+ largestR2 = std::max(largestR2, R2MinusQ3);
}
#endif
- double largest = SkTMax(fabs(allRoots[0]), fabs(allRoots[1]));
+ double largest = std::max(fabs(allRoots[0]), fabs(allRoots[1]));
if (realRoots == 3) {
- largest = SkTMax(largest, fabs(allRoots[2]));
+ largest = std::max(largest, fabs(allRoots[2]));
}
int largeBits;
if (largest <= 1) {
@@ -192,9 +192,9 @@
realRoots, allRoots[0], allRoots[1], allRoots[2], valid, validRoots[0],
validRoots[1], validRoots[2]);
#endif
- double smallest = SkTMin(allRoots[0], allRoots[1]);
+ double smallest = std::min(allRoots[0], allRoots[1]);
if (realRoots == 3) {
- smallest = SkTMin(smallest, allRoots[2]);
+ smallest = std::min(smallest, allRoots[2]);
}
SkASSERT_RELEASE(smallest < 0);
SkASSERT_RELEASE(smallest >= -1);
@@ -226,7 +226,7 @@
step *= 1.5;
SkASSERT_RELEASE(step < 1);
} while (true);
- worstStep[largeBits] = SkTMax(worstStep[largeBits], diff);
+ worstStep[largeBits] = std::max(worstStep[largeBits], diff);
#if 0
{
cubic.dump();
diff --git a/tests/PathOpsDebug.cpp b/tests/PathOpsDebug.cpp
index 94664c1..511edb8 100644
--- a/tests/PathOpsDebug.cpp
+++ b/tests/PathOpsDebug.cpp
@@ -1191,7 +1191,7 @@
if (between(test->fStartT, t, test->fEndT)) {
return test;
}
- double testDist = SkTMin(fabs(test->fStartT - t), fabs(test->fEndT - t));
+ double testDist = std::min(fabs(test->fStartT - t), fabs(test->fEndT - t));
if (bestDist > testDist) {
bestDist = testDist;
closest = test;
diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp
index e094978..8f7969b 100644
--- a/tests/PathOpsLineIntersectionTest.cpp
+++ b/tests/PathOpsLineIntersectionTest.cpp
@@ -118,29 +118,29 @@
return;
}
if (line1[0].fY == line1[1].fY) {
- double left = SkTMin(line1[0].fX, line1[1].fX);
- double right = SkTMax(line1[0].fX, line1[1].fX);
+ double left = std::min(line1[0].fX, line1[1].fX);
+ double right = std::max(line1[0].fX, line1[1].fX);
SkIntersections ts;
ts.horizontal(line2, left, right, line1[0].fY, line1[0].fX != left);
check_results(reporter, line2, line1, ts, nearAllowed);
}
if (line2[0].fY == line2[1].fY) {
- double left = SkTMin(line2[0].fX, line2[1].fX);
- double right = SkTMax(line2[0].fX, line2[1].fX);
+ double left = std::min(line2[0].fX, line2[1].fX);
+ double right = std::max(line2[0].fX, line2[1].fX);
SkIntersections ts;
ts.horizontal(line1, left, right, line2[0].fY, line2[0].fX != left);
check_results(reporter, line1, line2, ts, nearAllowed);
}
if (line1[0].fX == line1[1].fX) {
- double top = SkTMin(line1[0].fY, line1[1].fY);
- double bottom = SkTMax(line1[0].fY, line1[1].fY);
+ double top = std::min(line1[0].fY, line1[1].fY);
+ double bottom = std::max(line1[0].fY, line1[1].fY);
SkIntersections ts;
ts.vertical(line2, top, bottom, line1[0].fX, line1[0].fY != top);
check_results(reporter, line2, line1, ts, nearAllowed);
}
if (line2[0].fX == line2[1].fX) {
- double top = SkTMin(line2[0].fY, line2[1].fY);
- double bottom = SkTMax(line2[0].fY, line2[1].fY);
+ double top = std::min(line2[0].fY, line2[1].fY);
+ double bottom = std::max(line2[0].fY, line2[1].fY);
SkIntersections ts;
ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top);
check_results(reporter, line1, line2, ts, nearAllowed);
@@ -161,8 +161,8 @@
return;
}
if (line1[0].fY == line1[1].fY) {
- double left = SkTMin(line1[0].fX, line1[1].fX);
- double right = SkTMax(line1[0].fX, line1[1].fX);
+ double left = std::min(line1[0].fX, line1[1].fX);
+ double right = std::max(line1[0].fX, line1[1].fX);
SkIntersections ts;
ts.horizontal(line2, left, right, line1[0].fY, line1[0].fX != left);
REPORTER_ASSERT(reporter, pts == 2);
@@ -170,8 +170,8 @@
check_results(reporter, line2, line1, ts, false);
}
if (line2[0].fY == line2[1].fY) {
- double left = SkTMin(line2[0].fX, line2[1].fX);
- double right = SkTMax(line2[0].fX, line2[1].fX);
+ double left = std::min(line2[0].fX, line2[1].fX);
+ double right = std::max(line2[0].fX, line2[1].fX);
SkIntersections ts;
ts.horizontal(line1, left, right, line2[0].fY, line2[0].fX != left);
REPORTER_ASSERT(reporter, pts == 2);
@@ -179,8 +179,8 @@
check_results(reporter, line1, line2, ts, false);
}
if (line1[0].fX == line1[1].fX) {
- double top = SkTMin(line1[0].fY, line1[1].fY);
- double bottom = SkTMax(line1[0].fY, line1[1].fY);
+ double top = std::min(line1[0].fY, line1[1].fY);
+ double bottom = std::max(line1[0].fY, line1[1].fY);
SkIntersections ts;
ts.vertical(line2, top, bottom, line1[0].fX, line1[0].fY != top);
REPORTER_ASSERT(reporter, pts == 2);
@@ -188,8 +188,8 @@
check_results(reporter, line2, line1, ts, false);
}
if (line2[0].fX == line2[1].fX) {
- double top = SkTMin(line2[0].fY, line2[1].fY);
- double bottom = SkTMax(line2[0].fY, line2[1].fY);
+ double top = std::min(line2[0].fY, line2[1].fY);
+ double bottom = std::max(line2[0].fY, line2[1].fY);
SkIntersections ts;
ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top);
REPORTER_ASSERT(reporter, pts == 2);
diff --git a/tests/PathOpsTightBoundsTest.cpp b/tests/PathOpsTightBoundsTest.cpp
index 2af11be..eef7fd1 100644
--- a/tests/PathOpsTightBoundsTest.cpp
+++ b/tests/PathOpsTightBoundsTest.cpp
@@ -91,14 +91,14 @@
continue;
}
lineWritten = true;
- bitsWritten.fLeft = SkTMin(bitsWritten.fLeft, x);
- bitsWritten.fRight = SkTMax(bitsWritten.fRight, x);
+ bitsWritten.fLeft = std::min(bitsWritten.fLeft, x);
+ bitsWritten.fRight = std::max(bitsWritten.fRight, x);
}
if (!lineWritten) {
continue;
}
- bitsWritten.fTop = SkTMin(bitsWritten.fTop, y);
- bitsWritten.fBottom = SkTMax(bitsWritten.fBottom, y);
+ bitsWritten.fTop = std::min(bitsWritten.fTop, y);
+ bitsWritten.fBottom = std::max(bitsWritten.fBottom, y);
}
if (!bitsWritten.isEmpty()) {
SkIRect tightOut;
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 86cb016..529eb1e 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -638,7 +638,7 @@
"doesn't match actual output. Error: %f, Tolerance: %f, "
"input: (%f, %f, %f, %f), actual: (%f, %f, %f, %f), "
"expected(%f, %f, %f, %f)", fp->name(),
- SkTMax(rDiff, SkTMax(gDiff, SkTMax(bDiff, aDiff))), kTol,
+ std::max(rDiff, std::max(gDiff, std::max(bDiff, aDiff))), kTol,
input4f.fR, input4f.fG, input4f.fB, input4f.fA,
output4f.fR, output4f.fG, output4f.fB, output4f.fA,
expected4f.fR, expected4f.fG, expected4f.fB, expected4f.fA);
diff --git a/tests/ProgramsTest.cpp b/tests/ProgramsTest.cpp
index ae61788..b979f31 100644
--- a/tests/ProgramsTest.cpp
+++ b/tests/ProgramsTest.cpp
@@ -154,7 +154,7 @@
int sampleCnt = random->nextBool() ? caps->getRenderTargetSampleCount(2, format) : 1;
// Above could be 0 if msaa isn't supported.
- sampleCnt = SkTMax(1, sampleCnt);
+ sampleCnt = std::max(1, sampleCnt);
return GrRenderTargetContext::Make(
context, GrColorType::kRGBA_8888, nullptr, SkBackingFit::kExact,
diff --git a/tests/SRGBReadWritePixelsTest.cpp b/tests/SRGBReadWritePixelsTest.cpp
index b54026b..14a90f1 100644
--- a/tests/SRGBReadWritePixelsTest.cpp
+++ b/tests/SRGBReadWritePixelsTest.cpp
@@ -47,8 +47,8 @@
for (int c = 0; c < 3; ++c) {
uint8_t inputComponent = (uint8_t) ((input & (0xff << (c*8))) >> (c*8));
- float lower = SkTMax(0.f, (float) inputComponent - error);
- float upper = SkTMin(255.f, (float) inputComponent + error);
+ float lower = std::max(0.f, (float) inputComponent - error);
+ float upper = std::min(255.f, (float) inputComponent + error);
lower = CONVERT(lower / 255.f);
upper = CONVERT(upper / 255.f);
SkASSERT(lower >= 0.f && lower <= 255.f);
@@ -72,16 +72,16 @@
for (int c = 0; c < 3; ++c) {
uint8_t inputComponent = (uint8_t) ((input & (0xff << (c*8))) >> (c*8));
- float lower = SkTMax(0.f, (float) inputComponent - error);
- float upper = SkTMin(255.f, (float) inputComponent + error);
+ float lower = std::max(0.f, (float) inputComponent - error);
+ float upper = std::min(255.f, (float) inputComponent + error);
lower = FORWARD(lower / 255.f);
upper = FORWARD(upper / 255.f);
SkASSERT(lower >= 0.f && lower <= 255.f);
SkASSERT(upper >= 0.f && upper <= 255.f);
uint8_t upperComponent = SkScalarCeilToInt(upper * 255.f);
uint8_t lowerComponent = SkScalarFloorToInt(lower * 255.f);
- lower = SkTMax(0.f, (float) lowerComponent - error);
- upper = SkTMin(255.f, (float) upperComponent + error);
+ lower = std::max(0.f, (float) lowerComponent - error);
+ upper = std::min(255.f, (float) upperComponent + error);
lower = BACKWARD(lowerComponent / 255.f);
upper = BACKWARD(upperComponent / 255.f);
SkASSERT(lower >= 0.f && lower <= 255.f);
diff --git a/tests/SkNxTest.cpp b/tests/SkNxTest.cpp
index b6b0085..0f189df 100644
--- a/tests/SkNxTest.cpp
+++ b/tests/SkNxTest.cpp
@@ -133,7 +133,7 @@
for (int a = 0; a < (1<<8); a++) {
for (int b = 0; b < (1<<8); b++) {
Sk16b aw(a), bw(b);
- REPORTER_ASSERT(r, Sk16b::Min(aw, bw)[0] == SkTMin(a, b));
+ REPORTER_ASSERT(r, Sk16b::Min(aw, bw)[0] == std::min(a, b));
REPORTER_ASSERT(r, !(aw < bw)[0] == !(a < b));
}}
@@ -143,12 +143,12 @@
for (int i = 0; i < (1<<16); i++) {
uint16_t a = rand.nextU() >> 16,
b = rand.nextU() >> 16;
- REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == SkTMin(a, b));
+ REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == std::min(a, b));
}
#else
for (int a = 0; a < (1<<16); a++) {
for (int b = 0; b < (1<<16); b++) {
- REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == SkTMin(a, b));
+ REPORTER_ASSERT(r, Sk16h::Min(Sk16h(a), Sk16h(b))[0] == std::min(a, b));
}}
#endif
}
@@ -230,8 +230,8 @@
auto min = Sk4i::Min(a, b);
auto max = Sk4i::Max(a, b);
for(int i = 0; i < 4; ++i) {
- REPORTER_ASSERT(r, min[i] == SkTMin(a[i], b[i]));
- REPORTER_ASSERT(r, max[i] == SkTMax(a[i], b[i]));
+ REPORTER_ASSERT(r, min[i] == std::min(a[i], b[i]));
+ REPORTER_ASSERT(r, max[i] == std::max(a[i], b[i]));
}
}
diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp
index bc00f45..8a2390d 100644
--- a/tests/StreamTest.cpp
+++ b/tests/StreamTest.cpp
@@ -343,7 +343,7 @@
const uint8_t* expect = expected->bytes();
for (size_t i = 0; i < asset->getLength(); ++i) {
uint32_t maxSize =
- SkToU32(SkTMin(sizeof(buffer), asset->getLength() - i));
+ SkToU32(std::min(sizeof(buffer), asset->getLength() - i));
size_t size = rand.nextRangeU(1, maxSize);
SkASSERT(size >= 1);
SkASSERT(size <= sizeof(buffer));
@@ -401,7 +401,7 @@
DumbStream(const uint8_t* data, size_t n)
: fData(data), fCount(n), fIdx(0) {}
size_t read(void* buffer, size_t size) override {
- size_t copyCount = SkTMin(fCount - fIdx, size);
+ size_t copyCount = std::min(fCount - fIdx, size);
if (copyCount) {
memcpy(buffer, &fData[fIdx], copyCount);
fIdx += copyCount;
diff --git a/tests/StrokerTest.cpp b/tests/StrokerTest.cpp
index c851523..9f902bb 100644
--- a/tests/StrokerTest.cpp
+++ b/tests/StrokerTest.cpp
@@ -207,8 +207,8 @@
SkDebugf("fill:\n");
fill.dumpHex();
}
- bestTan = SkTMax(bestTan, gMaxRecursion[0]);
- bestCubic = SkTMax(bestCubic, gMaxRecursion[1]);
+ bestTan = std::max(bestTan, gMaxRecursion[0]);
+ bestCubic = std::max(bestCubic, gMaxRecursion[1]);
}
#endif
if (FLAGS_timeout && timer.elapsedMs() > MS_TEST_DURATION) {
@@ -317,8 +317,8 @@
SkDebugf("fill:\n");
fill.dumpHex();
}
- bestTan = SkTMax(bestTan, gMaxRecursion[0]);
- bestCubic = SkTMax(bestCubic, gMaxRecursion[1]);
+ bestTan = std::max(bestTan, gMaxRecursion[0]);
+ bestCubic = std::max(bestCubic, gMaxRecursion[1]);
}
#endif
if (FLAGS_timeout && timer.elapsedMs() > MS_TEST_DURATION) {
@@ -402,8 +402,8 @@
SkDebugf("fill:\n");
fill.dumpHex();
}
- best[0] = SkTMax(best[0], gMaxRecursion[0]);
- best[1] = SkTMax(best[1], gMaxRecursion[1]);
+ best[0] = std::max(best[0], gMaxRecursion[0]);
+ best[1] = std::max(best[1], gMaxRecursion[1]);
}
#endif
if (FLAGS_timeout && timer.elapsedMs() > MS_TEST_DURATION) {
diff --git a/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index acb8dc2..77cc108 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -328,7 +328,7 @@
memcpy(run.glyphs, glyphs.get(), sizeof(uint16_t) * glyphCount);
memcpy(run.utf8text, text2, strlen(text2));
for (int i = 0; i < glyphCount; ++i) {
- run.clusters[i] = SkTMin(SkToU32(i), SkToU32(strlen(text2)));
+ run.clusters[i] = std::min(SkToU32(i), SkToU32(strlen(text2)));
}
sk_sp<SkTextBlob> blob(textBlobBuilder.make());
REPORTER_ASSERT(reporter, blob);
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 520bbc7..e23b7ec 100644
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -318,7 +318,7 @@
size_t bufferSize = fullBufferRowBytes * kTextureHeight;
// Arbitrary starting offset for the partial read.
size_t partialReadOffset = GrAlignTo(11, offsetAlignment);
- bufferSize = SkTMax(bufferSize, partialReadOffset + partialBufferRowBytes * kPartialHeight);
+ bufferSize = std::max(bufferSize, partialReadOffset + partialBufferRowBytes * kPartialHeight);
sk_sp<GrGpuBuffer> buffer(resourceProvider->createBuffer(
bufferSize, GrGpuBufferType::kXferGpuToCpu, kDynamic_GrAccessPattern));
diff --git a/tests/VkPriorityExtensionTest.cpp b/tests/VkPriorityExtensionTest.cpp
index 71e2cd4..1f4f13c 100644
--- a/tests/VkPriorityExtensionTest.cpp
+++ b/tests/VkPriorityExtensionTest.cpp
@@ -85,7 +85,7 @@
apiVersion = VK_MAKE_VERSION(1, 1, 0);
}
- instanceVersion = SkTMin(instanceVersion, apiVersion);
+ instanceVersion = std::min(instanceVersion, apiVersion);
VkPhysicalDevice physDev;
VkDevice device;
diff --git a/tools/gpu/vk/VkTestUtils.cpp b/tools/gpu/vk/VkTestUtils.cpp
index 8671f71..3530808 100644
--- a/tools/gpu/vk/VkTestUtils.cpp
+++ b/tools/gpu/vk/VkTestUtils.cpp
@@ -447,7 +447,7 @@
apiVersion = VK_MAKE_VERSION(1, 1, 0);
}
- instanceVersion = SkTMin(instanceVersion, apiVersion);
+ instanceVersion = std::min(instanceVersion, apiVersion);
VkPhysicalDevice physDev;
VkDevice device;
@@ -563,7 +563,7 @@
VkPhysicalDeviceProperties physDeviceProperties;
grVkGetPhysicalDeviceProperties(physDev, &physDeviceProperties);
- int physDeviceVersion = SkTMin(physDeviceProperties.apiVersion, apiVersion);
+ int physDeviceVersion = std::min(physDeviceProperties.apiVersion, apiVersion);
if (isProtected && physDeviceVersion < VK_MAKE_VERSION(1, 1, 0)) {
SkDebugf("protected requires vk physical device version 1.1\n");
diff --git a/tools/sk_app/VulkanWindowContext.cpp b/tools/sk_app/VulkanWindowContext.cpp
index c2b26b4..4abbd9d 100644
--- a/tools/sk_app/VulkanWindowContext.cpp
+++ b/tools/sk_app/VulkanWindowContext.cpp
@@ -238,7 +238,7 @@
}
}
fDisplayParams = params;
- fSampleCount = SkTMax(1, params.fMSAASampleCount);
+ fSampleCount = std::max(1, params.fMSAASampleCount);
fStencilBits = 8;
if (VK_FORMAT_UNDEFINED == surfaceFormat) {
diff --git a/tools/sk_app/android/GLWindowContext_android.cpp b/tools/sk_app/android/GLWindowContext_android.cpp
index 624b8af..f23c741 100644
--- a/tools/sk_app/android/GLWindowContext_android.cpp
+++ b/tools/sk_app/android/GLWindowContext_android.cpp
@@ -115,7 +115,7 @@
eglGetConfigAttrib(fDisplay, surfaceConfig, EGL_STENCIL_SIZE, &fStencilBits);
eglGetConfigAttrib(fDisplay, surfaceConfig, EGL_SAMPLES, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
+ fSampleCount = std::max(fSampleCount, 1);
eglSwapInterval(fDisplay, fDisplayParams.fDisableVsync ? 0 : 1);
diff --git a/tools/sk_app/mac/GLWindowContext_mac.mm b/tools/sk_app/mac/GLWindowContext_mac.mm
index 803eb23..88768e9 100644
--- a/tools/sk_app/mac/GLWindowContext_mac.mm
+++ b/tools/sk_app/mac/GLWindowContext_mac.mm
@@ -126,7 +126,7 @@
GLint sampleCount;
[fPixelFormat getValues:&sampleCount forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
fSampleCount = sampleCount;
- fSampleCount = SkTMax(fSampleCount, 1);
+ fSampleCount = std::max(fSampleCount, 1);
const NSRect viewportRect = [fMainView frame];
fWidth = viewportRect.size.width;
diff --git a/tools/sk_app/mac/RasterWindowContext_mac.mm b/tools/sk_app/mac/RasterWindowContext_mac.mm
index 5b8d345..e300b2e 100644
--- a/tools/sk_app/mac/RasterWindowContext_mac.mm
+++ b/tools/sk_app/mac/RasterWindowContext_mac.mm
@@ -135,7 +135,7 @@
GLint sampleCount;
[fPixelFormat getValues:&sampleCount forAttribute:NSOpenGLPFASamples forVirtualScreen:0];
fSampleCount = sampleCount;
- fSampleCount = SkTMax(fSampleCount, 1);
+ fSampleCount = std::max(fSampleCount, 1);
const NSRect viewportRect = [fMainView frame];
fWidth = viewportRect.size.width;
diff --git a/tools/sk_app/unix/GLWindowContext_unix.cpp b/tools/sk_app/unix/GLWindowContext_unix.cpp
index 4de886d..4eddba3 100644
--- a/tools/sk_app/unix/GLWindowContext_unix.cpp
+++ b/tools/sk_app/unix/GLWindowContext_unix.cpp
@@ -145,7 +145,7 @@
glXGetConfig(fDisplay, fVisualInfo, GLX_STENCIL_SIZE, &fStencilBits);
glXGetConfig(fDisplay, fVisualInfo, GLX_SAMPLES_ARB, &fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
+ fSampleCount = std::max(fSampleCount, 1);
XWindow root;
int x, y;
diff --git a/tools/sk_app/win/GLWindowContext_win.cpp b/tools/sk_app/win/GLWindowContext_win.cpp
index 32c47b4..18d4e34 100644
--- a/tools/sk_app/win/GLWindowContext_win.cpp
+++ b/tools/sk_app/win/GLWindowContext_win.cpp
@@ -113,7 +113,7 @@
1,
&kSampleCountAttr,
&fSampleCount);
- fSampleCount = SkTMax(fSampleCount, 1);
+ fSampleCount = std::max(fSampleCount, 1);
} else {
fSampleCount = 1;
}
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 389b175..960405d 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -106,8 +106,8 @@
bounds = fPicture->cullRect().roundOut();
if (fGPUEnabled) {
int maxRTSize = this->getContext()->maxRenderTargetSize();
- bounds = SkIRect::MakeWH(SkTMin(bounds.width(), maxRTSize),
- SkTMin(bounds.height(), maxRTSize));
+ bounds = SkIRect::MakeWH(std::min(bounds.width(), maxRTSize),
+ std::min(bounds.height(), maxRTSize));
}
} else {
bounds = SkIRect::MakeWH(kDefaultWidth, kDefaultHeight);
@@ -115,8 +115,8 @@
// We clip to kMaxWidth / kMaxHeight for performance reasons.
// TODO make this configurable
- bounds = SkIRect::MakeWH(SkTMin(bounds.width(), kMaxWidth),
- SkTMin(bounds.height(), kMaxHeight));
+ bounds = SkIRect::MakeWH(std::min(bounds.width(), kMaxWidth),
+ std::min(bounds.height(), kMaxHeight));
return bounds;
}
diff --git a/tools/skpbench/skpbench.cpp b/tools/skpbench/skpbench.cpp
index 6d1f841..11b2991 100644
--- a/tools/skpbench/skpbench.cpp
+++ b/tools/skpbench/skpbench.cpp
@@ -469,8 +469,8 @@
}
srcname = SkOSPath::Basename(srcfile.c_str());
}
- int width = SkTMin(SkScalarCeilToInt(skp->cullRect().width()), 2048),
- height = SkTMin(SkScalarCeilToInt(skp->cullRect().height()), 2048);
+ int width = std::min(SkScalarCeilToInt(skp->cullRect().width()), 2048),
+ height = std::min(SkScalarCeilToInt(skp->cullRect().height()), 2048);
if (FLAGS_verbosity >= 3 &&
(width != skp->cullRect().width() || height != skp->cullRect().height())) {
fprintf(stderr, "%s is too large (%ix%i), cropping to %ix%i.\n",
@@ -502,7 +502,7 @@
exitf(ExitErr::kUnavailable, "failed to create context for config %s",
config->getTag().c_str());
}
- if (ctx->maxRenderTargetSize() < SkTMax(width, height)) {
+ if (ctx->maxRenderTargetSize() < std::max(width, height)) {
exitf(ExitErr::kUnavailable, "render target size %ix%i not supported by platform (max: %i)",
width, height, ctx->maxRenderTargetSize());
}
diff --git a/tools/trace/SkDebugfTracer.cpp b/tools/trace/SkDebugfTracer.cpp
index bd2feea..8db587b 100644
--- a/tools/trace/SkDebugfTracer.cpp
+++ b/tools/trace/SkDebugfTracer.cpp
@@ -51,7 +51,7 @@
if (newLineAt > 0) {
truncAt = newLineAt;
}
- truncAt = SkTMin(truncAt, kMaxLen);
+ truncAt = std::min(truncAt, kMaxLen);
if (truncAt < string.size()) {
string.resize(truncAt);
string.append("...");
diff --git a/tools/viewer/ImGuiLayer.h b/tools/viewer/ImGuiLayer.h
index 827eec0..4d53cc7 100644
--- a/tools/viewer/ImGuiLayer.h
+++ b/tools/viewer/ImGuiLayer.h
@@ -33,7 +33,7 @@
aspect = h / w;
}
- float availWidth = SkTMax(ImGui::GetContentRegionAvailWidth(), 1.0f);
+ float availWidth = std::max(ImGui::GetContentRegionAvailWidth(), 1.0f);
fPos = ImGui::GetCursorScreenPos();
fSize = ImVec2(availWidth, availWidth * aspect);
diff --git a/tools/viewer/StatsLayer.cpp b/tools/viewer/StatsLayer.cpp
index a047b31..8df8f9e 100644
--- a/tools/viewer/StatsLayer.cpp
+++ b/tools/viewer/StatsLayer.cpp
@@ -130,7 +130,7 @@
double inc = 0;
for (int timer = 0; timer < fTimers.count(); ++timer) {
int height = (int)(fTimers[timer].fTimes[i] * kPixelPerMS + 0.5);
- int endY = SkTMax(startY - height, kDisplayPadding + kTextHeight);
+ int endY = std::max(startY - height, kDisplayPadding + kTextHeight);
paint.setColor(fTimers[timer].fColor);
canvas->drawLine(SkIntToScalar(x), SkIntToScalar(startY),
SkIntToScalar(x), SkIntToScalar(endY), paint);
@@ -140,8 +140,8 @@
}
int height = (int)(fTotalTimes[i] * kPixelPerMS + 0.5);
- height = SkTMax(0, height - (SkScalarTruncToInt(rect.fBottom) - startY));
- int endY = SkTMax(startY - height, kDisplayPadding + kTextHeight);
+ height = std::max(0, height - (SkScalarTruncToInt(rect.fBottom) - startY));
+ int endY = std::max(startY - height, kDisplayPadding + kTextHeight);
paint.setColor(SK_ColorWHITE);
canvas->drawLine(SkIntToScalar(x), SkIntToScalar(startY),
SkIntToScalar(x), SkIntToScalar(endY), paint);
@@ -161,15 +161,15 @@
SkFont font(nullptr, 16);
paint.setColor(SK_ColorWHITE);
- double time = totalTime / SkTMax(1, totalCount);
- double measure = fCumulativeMeasurementTime / SkTMax(1, fCumulativeMeasurementCount);
+ double time = totalTime / std::max(1, totalCount);
+ double measure = fCumulativeMeasurementTime / std::max(1, fCumulativeMeasurementCount);
canvas->drawString(SkStringPrintf("%4.3f ms -> %4.3f ms", time, measure),
rect.fLeft + 3, rect.fTop + 14, font, paint);
for (int timer = 0; timer < fTimers.count(); ++timer) {
paint.setColor(fTimers[timer].fLabelColor);
canvas->drawString(SkStringPrintf("%s: %4.3f ms", fTimers[timer].fLabel.c_str(),
- sumTimes[timer] / SkTMax(1, count)),
+ sumTimes[timer] / std::max(1, count)),
rect.fLeft + 3, rect.fTop + 28 + (14 * timer), font, paint);
}
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index 1792244..8ff1bee 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -2239,11 +2239,11 @@
if (ImGui::Begin("Zoom", &fShowZoomWindow)) {
static int zoomFactor = 8;
if (ImGui::Button("<<")) {
- zoomFactor = SkTMax(zoomFactor / 2, 4);
+ zoomFactor = std::max(zoomFactor / 2, 4);
}
ImGui::SameLine(); ImGui::Text("%2d", zoomFactor); ImGui::SameLine();
if (ImGui::Button(">>")) {
- zoomFactor = SkTMin(zoomFactor * 2, 32);
+ zoomFactor = std::min(zoomFactor * 2, 32);
}
if (!fZoomWindowFixed) {