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/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 994a782..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..35ab108 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];