Remove SK_MaxSizeT, SK_M{in|ax}U{16|32}, #defines.
sed 's/SK_MaxSizeT/SIZE_MAX/g' sed 's/SK_MaxU32/UINT32_MAX/g' sed 's/SK_MaxU16/UINT16_MAX/g' SK_MinU32 and SK_MinU16 were unused Change-Id: I6b6c824df47b05bde7e73b13a58e851a5f63fe0e Reviewed-on: https://skia-review.googlesource.com/134607 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
b6b5b7a808
commit
e1bc7de7c0
@ -553,7 +553,7 @@ public:
|
||||
and rowBytes. rowBytes is assumed to be at least as large as minRowBytes().
|
||||
|
||||
Returns zero if height is zero.
|
||||
Returns SK_MaxSizeT if answer exceeds the range of size_t.
|
||||
Returns SIZE_MAX if answer exceeds the range of size_t.
|
||||
|
||||
@param rowBytes size of pixel row or larger
|
||||
@return memory required by pixel buffer
|
||||
@ -564,7 +564,7 @@ public:
|
||||
SkColorType. Uses minRowBytes() to compute bytes for pixel row.
|
||||
|
||||
Returns zero if height is zero.
|
||||
Returns SK_MaxSizeT if answer exceeds the range of size_t.
|
||||
Returns SIZE_MAX if answer exceeds the range of size_t.
|
||||
|
||||
@return least memory required by pixel buffer
|
||||
*/
|
||||
@ -572,14 +572,14 @@ public:
|
||||
return this->computeByteSize(this->minRowBytes());
|
||||
}
|
||||
|
||||
/** Returns true if byteSize equals SK_MaxSizeT. computeByteSize() and
|
||||
computeMinByteSize() return SK_MaxSizeT if size_t can not hold buffer size.
|
||||
/** Returns true if byteSize equals SIZE_MAX. computeByteSize() and
|
||||
computeMinByteSize() return SIZE_MAX if size_t can not hold buffer size.
|
||||
|
||||
@param byteSize result of computeByteSize() or computeMinByteSize()
|
||||
@return true if computeByteSize() or computeMinByteSize() result exceeds size_t
|
||||
*/
|
||||
static bool ByteSizeOverflowed(size_t byteSize) {
|
||||
return SK_MaxSizeT == byteSize;
|
||||
return SIZE_MAX == byteSize;
|
||||
}
|
||||
|
||||
/** Returns true if rowBytes is smaller than width times pixel size.
|
||||
|
@ -115,17 +115,12 @@ template <typename D, typename S> constexpr D SkTo(S s) {
|
||||
*/
|
||||
#define SkToBool(cond) ((cond) != 0)
|
||||
|
||||
#define SK_MaxS16 32767
|
||||
#define SK_MinS16 -32767
|
||||
#define SK_MaxU16 0xFFFF
|
||||
#define SK_MinU16 0
|
||||
#define SK_MaxS32 0x7FFFFFFF
|
||||
#define SK_MaxS16 INT16_MAX
|
||||
#define SK_MinS16 -SK_MaxS16
|
||||
#define SK_MaxS32 INT32_MAX
|
||||
#define SK_MinS32 -SK_MaxS32
|
||||
#define SK_MaxU32 0xFFFFFFFF
|
||||
#define SK_MinU32 0
|
||||
#define SK_NaN32 ((int) (1U << 31))
|
||||
#define SK_MaxSizeT SIZE_MAX
|
||||
static constexpr int64_t SK_MaxS64 = 0x7FFFFFFFFFFFFFFF;
|
||||
#define SK_NaN32 INT32_MIN
|
||||
static constexpr int64_t SK_MaxS64 = INT64_MAX;
|
||||
static constexpr int64_t SK_MinS64 = -SK_MaxS64;
|
||||
|
||||
static inline constexpr int32_t SkLeftShift(int32_t value, int32_t shift) {
|
||||
|
@ -67,7 +67,7 @@ size_t SkImageInfo::computeByteSize(size_t rowBytes) const {
|
||||
SkSafeMath safe;
|
||||
size_t bytes = safe.add(safe.mul(safe.addInt(fHeight, -1), rowBytes),
|
||||
safe.mul(fWidth, this->bytesPerPixel()));
|
||||
return safe ? bytes : SK_MaxSizeT;
|
||||
return safe ? bytes : SIZE_MAX;
|
||||
}
|
||||
|
||||
SkImageInfo SkImageInfo::MakeS32(int width, int height, SkAlphaType at) {
|
||||
|
@ -89,11 +89,11 @@ float SkScalarSinCos(float radians, float* cosValue) {
|
||||
size_t SkSafeMath::Add(size_t x, size_t y) {
|
||||
SkSafeMath tmp;
|
||||
size_t sum = tmp.add(x, y);
|
||||
return tmp.ok() ? sum : SK_MaxSizeT;
|
||||
return tmp.ok() ? sum : SIZE_MAX;
|
||||
}
|
||||
|
||||
size_t SkSafeMath::Mul(size_t x, size_t y) {
|
||||
SkSafeMath tmp;
|
||||
size_t prod = tmp.mul(x, y);
|
||||
return tmp.ok() ? prod : SK_MaxSizeT;
|
||||
return tmp.ok() ? prod : SIZE_MAX;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void SkResourceCache::purgeAsNeeded(bool forcePurge) {
|
||||
|
||||
if (fDiscardableFactory) {
|
||||
countLimit = SK_DISCARDABLEMEMORY_SCALEDIMAGECACHE_COUNT_LIMIT;
|
||||
byteLimit = SK_MaxU32; // no limit based on bytes
|
||||
byteLimit = UINT32_MAX; // no limit based on bytes
|
||||
} else {
|
||||
countLimit = SK_MaxS32; // no limit based on count
|
||||
byteLimit = fTotalByteLimit;
|
||||
|
@ -178,18 +178,18 @@ const SkString::Rec SkString::gEmptyRec(0, 0);
|
||||
|
||||
static uint32_t trim_size_t_to_u32(size_t value) {
|
||||
if (sizeof(size_t) > sizeof(uint32_t)) {
|
||||
if (value > SK_MaxU32) {
|
||||
value = SK_MaxU32;
|
||||
if (value > UINT32_MAX) {
|
||||
value = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
return (uint32_t)value;
|
||||
}
|
||||
|
||||
static size_t check_add32(size_t base, size_t extra) {
|
||||
SkASSERT(base <= SK_MaxU32);
|
||||
SkASSERT(base <= UINT32_MAX);
|
||||
if (sizeof(size_t) > sizeof(uint32_t)) {
|
||||
if (base + extra > SK_MaxU32) {
|
||||
extra = SK_MaxU32 - base;
|
||||
if (base + extra > UINT32_MAX) {
|
||||
extra = UINT32_MAX - base;
|
||||
}
|
||||
}
|
||||
return extra;
|
||||
|
@ -63,7 +63,7 @@ SkString SkStringFromUTF16(const uint16_t* src, size_t count) {
|
||||
const uint16_t* last = ptr;
|
||||
SkUnichar u = SkUTF16_NextUnichar(&ptr);
|
||||
size_t s = SkUTF8_FromUnichar(u);
|
||||
if (n > SK_MaxU32 - s) {
|
||||
if (n > UINT32_MAX - s) {
|
||||
end = last; // truncate input string
|
||||
break;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ struct SkVertices::Sizes {
|
||||
numFanTris = vertexCount - 2;
|
||||
// By forcing this to become indexed we are adding a constraint to the maximum
|
||||
// number of vertices.
|
||||
if (vertexCount > (SK_MaxU16 + 1)) {
|
||||
if (vertexCount > (UINT16_MAX + 1)) {
|
||||
sk_bzero(this, sizeof(*this));
|
||||
return;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static bool gen_meta_key(const GrResourceIOProcessor& proc,
|
||||
uint32_t classID = proc.classID();
|
||||
|
||||
// Currently we allow 16 bits for the class id and the overall processor key size.
|
||||
static const uint32_t kMetaKeyInvalidMask = ~((uint32_t)SK_MaxU16);
|
||||
static const uint32_t kMetaKeyInvalidMask = ~((uint32_t)UINT16_MAX);
|
||||
if ((processorKeySize | classID) & kMetaKeyInvalidMask) {
|
||||
return false;
|
||||
}
|
||||
@ -119,7 +119,7 @@ static bool gen_meta_key(const GrXferProcessor& xp,
|
||||
uint32_t classID = xp.classID();
|
||||
|
||||
// Currently we allow 16 bits for the class id and the overall processor key size.
|
||||
static const uint32_t kMetaKeyInvalidMask = ~((uint32_t)SK_MaxU16);
|
||||
static const uint32_t kMetaKeyInvalidMask = ~((uint32_t)UINT16_MAX);
|
||||
if ((processorKeySize | classID) & kMetaKeyInvalidMask) {
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() {
|
||||
static int32_t gType = INHERITED::kInvalidDomain + 1;
|
||||
|
||||
int32_t type = sk_atomic_inc(&gType);
|
||||
if (type > SK_MaxU16) {
|
||||
if (type > UINT16_MAX) {
|
||||
SK_ABORT("Too many Resource Types");
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ GrUniqueKey::Domain GrUniqueKey::GenerateDomain() {
|
||||
static int32_t gDomain = INHERITED::kInvalidDomain + 1;
|
||||
|
||||
int32_t domain = sk_atomic_inc(&gDomain);
|
||||
if (domain > SK_MaxU16) {
|
||||
if (domain > UINT16_MAX) {
|
||||
SK_ABORT("Too many GrUniqueKey Domains");
|
||||
}
|
||||
|
||||
|
@ -618,7 +618,7 @@ private:
|
||||
|
||||
class GLPDLCDXferProcessor : public GrGLSLXferProcessor {
|
||||
public:
|
||||
GLPDLCDXferProcessor(const GrProcessor&) : fLastAlpha(SK_MaxU32) {}
|
||||
GLPDLCDXferProcessor(const GrProcessor&) : fLastAlpha(UINT32_MAX) {}
|
||||
|
||||
~GLPDLCDXferProcessor() override {}
|
||||
|
||||
|
@ -395,7 +395,7 @@ private:
|
||||
}
|
||||
|
||||
void onGetGLSLProcessorKey(const GrShaderCaps& caps, GrProcessorKeyBuilder* b) const override {
|
||||
GR_STATIC_ASSERT(((int)SkBlendMode::kLastMode & SK_MaxU16) == (int)SkBlendMode::kLastMode);
|
||||
GR_STATIC_ASSERT(((int)SkBlendMode::kLastMode & UINT16_MAX) == (int)SkBlendMode::kLastMode);
|
||||
b->add32((int)fMode | (fChild << 16));
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ bool GrDrawVerticesOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fVertexCount + that->fVertexCount > SK_MaxU16) {
|
||||
if (fVertexCount + that->fVertexCount > UINT16_MAX) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -366,7 +366,7 @@ static void randomize_params(size_t count, size_t maxVertex, SkScalar min, SkSca
|
||||
colors->push_back(GrRandomColor(random));
|
||||
}
|
||||
if (hasIndices) {
|
||||
SkASSERT(maxVertex <= SK_MaxU16);
|
||||
SkASSERT(maxVertex <= UINT16_MAX);
|
||||
indices->push_back(random->nextULessThan((uint16_t)maxVertex));
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ const SkAdvancedTypefaceMetrics* SkPDFFont::GetMetrics(SkTypeface* typeface,
|
||||
return ptr->get(); // canon retains ownership.
|
||||
}
|
||||
int count = typeface->countGlyphs();
|
||||
if (count <= 0 || count > 1 + SK_MaxU16) {
|
||||
if (count <= 0 || count > 1 + UINT16_MAX) {
|
||||
// Cache nullptr to skip this check. Use SkSafeUnref().
|
||||
canon->fTypefaceMetrics.set(id, nullptr);
|
||||
return nullptr;
|
||||
|
@ -169,7 +169,7 @@ static unsigned calculateGlyphCount(HDC hdc, const LOGFONT& lf) {
|
||||
|
||||
// Binary search for glyph count.
|
||||
static const MAT2 mat2 = {{0, 1}, {0, 0}, {0, 0}, {0, 1}};
|
||||
int32_t max = SK_MaxU16 + 1;
|
||||
int32_t max = UINT16_MAX + 1;
|
||||
int32_t min = 0;
|
||||
GLYPHMETRICS gm;
|
||||
while (min < max) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "SkPDFMakeToUnicodeCmap.h"
|
||||
#include "SkStream.h"
|
||||
|
||||
static const int kMaximumGlyphCount = SK_MaxU16 + 1;
|
||||
static const int kMaximumGlyphCount = UINT16_MAX + 1;
|
||||
|
||||
static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset,
|
||||
const char* buffer, size_t len) {
|
||||
|
@ -1094,7 +1094,7 @@ static void test_timestamp_wrap(skiatest::Reporter* reporter) {
|
||||
GrGpu* gpu = context->contextPriv().getGpu();
|
||||
|
||||
// Pick a random number of resources to add before the timestamp will wrap.
|
||||
cache->changeTimestamp(SK_MaxU32 - random.nextULessThan(kCount + 1));
|
||||
cache->changeTimestamp(UINT32_MAX - random.nextULessThan(kCount + 1));
|
||||
|
||||
static const int kNumToPurge = kCount - kBudgetCnt;
|
||||
|
||||
|
@ -300,7 +300,7 @@ DEF_TEST(String_Threaded, r) {
|
||||
// let us create a string with a requested length longer than we can manage.
|
||||
DEF_TEST(String_huge, r) {
|
||||
// start testing slightly below max 32
|
||||
size_t size = SK_MaxU32 - 16;
|
||||
size_t size = UINT32_MAX - 16;
|
||||
// See where we crash, and manually check that its at the right point.
|
||||
//
|
||||
// To test, change the false to true
|
||||
|
@ -91,13 +91,13 @@ DEF_TEST(Vertices, reporter) {
|
||||
{
|
||||
// This has the maximum number of vertices to be rewritten as indexed triangles without
|
||||
// overflowing a 16bit index.
|
||||
SkVertices::Builder builder(SkVertices::kTriangleFan_VertexMode, SK_MaxU16 + 1, 0,
|
||||
SkVertices::Builder builder(SkVertices::kTriangleFan_VertexMode, UINT16_MAX + 1, 0,
|
||||
SkVertices::kHasColors_BuilderFlag);
|
||||
REPORTER_ASSERT(reporter, builder.isValid());
|
||||
}
|
||||
{
|
||||
// This has too many to be rewritten.
|
||||
SkVertices::Builder builder(SkVertices::kTriangleFan_VertexMode, SK_MaxU16 + 2, 0,
|
||||
SkVertices::Builder builder(SkVertices::kTriangleFan_VertexMode, UINT16_MAX + 2, 0,
|
||||
SkVertices::kHasColors_BuilderFlag);
|
||||
REPORTER_ASSERT(reporter, !builder.isValid());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user