Remove "sanity"/"insane" to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference Bug: 162536543 Change-Id: Ia9c81c2251ac7bf4eef6d37799741612989fc9c0 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307228 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
This commit is contained in:
parent
577536aa1a
commit
982fff264d
@ -39,7 +39,7 @@ Or:
|
||||
|
||||
$ cd infra/bots; make train
|
||||
|
||||
There is also a test mode which performs sanity-checks and verifies that
|
||||
There is also a test mode which performs consistency checks and verifies that
|
||||
tasks.json is unchanged:
|
||||
|
||||
$ go run infra/bots/gen_tasks.go --test
|
||||
|
@ -63,7 +63,7 @@ def skpbench_steps(api):
|
||||
'-v5']
|
||||
if 'DDL' in api.vars.builder_name:
|
||||
skpbench_args += ['--ddl']
|
||||
# disable the mask generation threads for sanity's sake in DDL mode
|
||||
# disable the mask generation threads for simplicity's sake in DDL mode
|
||||
skpbench_args += ['--gpuThreads', '0']
|
||||
if '9x9' in api.vars.builder_name:
|
||||
skpbench_args += [
|
||||
|
@ -77,7 +77,7 @@ std::unique_ptr<SkCodec> SkWebpCodec::MakeFromStream(std::unique_ptr<SkStream> s
|
||||
const int width = WebPDemuxGetI(demux, WEBP_FF_CANVAS_WIDTH);
|
||||
const int height = WebPDemuxGetI(demux, WEBP_FF_CANVAS_HEIGHT);
|
||||
|
||||
// Sanity check for image size that's about to be decoded.
|
||||
// Validate the image size that's about to be decoded.
|
||||
{
|
||||
const int64_t size = sk_64_mul(width, height);
|
||||
// now check that if we are 4-bytes per pixel, we also don't overflow
|
||||
|
@ -751,7 +751,7 @@ void SkCanvas::restore() {
|
||||
}
|
||||
|
||||
void SkCanvas::restoreToCount(int count) {
|
||||
// sanity check
|
||||
// safety check
|
||||
if (count < 1) {
|
||||
count = 1;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ enum TFKind { Bad_TF, sRGBish_TF, PQish_TF, HLGish_TF, HLGinvish_TF };
|
||||
|
||||
static inline TFKind classify_transfer_fn(const skcms_TransferFunction& tf) {
|
||||
if (tf.g < 0 && (int)tf.g == tf.g) {
|
||||
// TODO: sanity checks for PQ/HLG like we do for sRGBish.
|
||||
// TODO: safety checks for PQ/HLG like we do for sRGBish.
|
||||
switch ((int)tf.g) {
|
||||
case -PQish_TF: return PQish_TF;
|
||||
case -HLGish_TF: return HLGish_TF;
|
||||
@ -50,7 +50,7 @@ static inline TFKind classify_transfer_fn(const skcms_TransferFunction& tf) {
|
||||
return Bad_TF;
|
||||
}
|
||||
|
||||
// Basic sanity checks for sRGBish transfer functions.
|
||||
// Basic safety checks for sRGBish transfer functions.
|
||||
if (sk_float_isfinite(tf.a + tf.b + tf.c + tf.d + tf.e + tf.f + tf.g)
|
||||
// a,c,d,g should be non-negative to make any sense.
|
||||
&& tf.a >= 0
|
||||
|
@ -180,8 +180,8 @@ size_t SkFontStream::GetTableData(SkStream* stream, int ttcIndex,
|
||||
if (SkEndian_SwapBE32(header.fDir[i].fTag) == tag) {
|
||||
size_t realOffset = SkEndian_SwapBE32(header.fDir[i].fOffset);
|
||||
size_t realLength = SkEndian_SwapBE32(header.fDir[i].fLength);
|
||||
// now sanity check the caller's offset/length
|
||||
if (offset >= realLength) {
|
||||
// invalid
|
||||
return 0;
|
||||
}
|
||||
// if the caller is trusting the length from the file, then a
|
||||
|
@ -526,7 +526,6 @@ skif::LayerSpace<SkIRect> SkImageFilter_Base::onGetOutputLayerBounds(
|
||||
|
||||
template<skif::Usage kU>
|
||||
skif::FilterResult<kU> SkImageFilter_Base::filterInput(int index, const skif::Context& ctx) const {
|
||||
// Sanity checks for the index-specific input usages
|
||||
SkASSERT(kU != skif::Usage::kInput0 || index == 0);
|
||||
SkASSERT(kU != skif::Usage::kInput1 || index == 1);
|
||||
|
||||
|
@ -1202,7 +1202,7 @@ static bool validate_run(const int32_t* runs,
|
||||
return false;
|
||||
}
|
||||
SkASSERT(runCount >= 7); // 7==SkRegion::kRectRegionRuns
|
||||
// quick sanity check:
|
||||
// quick safety check:
|
||||
if (runs[runCount - 1] != SkRegion_kRunTypeSentinel ||
|
||||
runs[runCount - 2] != SkRegion_kRunTypeSentinel) {
|
||||
return false;
|
||||
|
@ -439,7 +439,7 @@ static int compute_quad_level(const SkPoint pts[3]) {
|
||||
than a pixel.
|
||||
*/
|
||||
int level = (33 - SkCLZ(d)) >> 1;
|
||||
// sanity check on level (from the previous version)
|
||||
// safety check on level (from the previous version)
|
||||
if (level > kMaxQuadSubdivideLevel) {
|
||||
level = kMaxQuadSubdivideLevel;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ bool SkStrikeSpec::ShouldDrawAsPath(
|
||||
SkMatrix textMatrix = SkFontPriv::MakeTextMatrix(font);
|
||||
textMatrix.postConcat(viewMatrix);
|
||||
|
||||
// we have a self-imposed maximum, just for memory-usage sanity
|
||||
// we have a self-imposed maximum, just to limit memory-usage
|
||||
SkScalar limit = std::min(SkGraphics::GetFontCachePointSizeLimit(), 1024);
|
||||
SkScalar maxSizeSquared = limit * limit;
|
||||
|
||||
|
@ -116,7 +116,6 @@ void SkBlurImageFilterImpl::flatten(SkWriteBuffer& buffer) const {
|
||||
buffer.writeScalar(fSigma.fWidth);
|
||||
buffer.writeScalar(fSigma.fHeight);
|
||||
|
||||
// Fuzzer sanity checks
|
||||
static_assert((int) SkTileMode::kLastTileMode == 3 && SkBlurImageFilter::kLast_TileMode == 2,
|
||||
"SkBlurImageFilterImpl::flatten");
|
||||
SkASSERT(fTileMode <= SkTileMode::kLastTileMode);
|
||||
|
@ -109,7 +109,7 @@ void GrBlockAllocator::releaseBlock(Block* block) {
|
||||
|
||||
// The released block becomes the new scratch block (if it's bigger), or delete it
|
||||
if (this->scratchBlockSize() < block->fSize) {
|
||||
SkASSERT(block != fHead.fPrev); // sanity check, shouldn't already be the scratch block
|
||||
SkASSERT(block != fHead.fPrev); // shouldn't already be the scratch block
|
||||
if (fHead.fPrev) {
|
||||
delete fHead.fPrev;
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ void GrFragmentProcessor::registerChild(std::unique_ptr<GrFragmentProcessor> chi
|
||||
child->fParent = this;
|
||||
fChildProcessors.push_back(std::move(child));
|
||||
|
||||
// Sanity check: our sample strategy comes from a parent we shouldn't have yet.
|
||||
// Validate: our sample strategy comes from a parent we shouldn't have yet.
|
||||
SkASSERT(!this->isSampledWithExplicitCoords() && !this->hasPerspectiveTransform() &&
|
||||
!fUsage.isSampled() && !fParent);
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ bool GrDawnOpsRenderPass::onBindPipeline(const GrProgramInfo& programInfo,
|
||||
|
||||
void GrDawnOpsRenderPass::onSetScissorRect(const SkIRect& scissor) {
|
||||
// Higher-level GrRenderTargetContext and clips should have already ensured draw bounds are
|
||||
// restricted to the render target. This is a sanity check.
|
||||
// restricted to the render target.
|
||||
SkASSERT(SkIRect::MakeSize(fRenderTarget->dimensions()).contains(scissor));
|
||||
auto nativeScissorRect =
|
||||
GrNativeRect::MakeRelativeTo(fOrigin, fRenderTarget->height(), scissor);
|
||||
|
@ -238,7 +238,7 @@ void GrShape::simplifyPoint(const SkPoint& point, unsigned flags) {
|
||||
}
|
||||
|
||||
bool GrShape::simplify(unsigned flags) {
|
||||
// Sanity check that winding parameters are valid for the current type.
|
||||
// Verify that winding parameters are valid for the current type.
|
||||
SkASSERT((fType == Type::kRect || fType == Type::kRRect) ||
|
||||
(this->dir() == kDefaultDir && this->startIndex() == kDefaultStart));
|
||||
|
||||
|
@ -70,7 +70,7 @@ GrStyledShape GrStyledShape::MakeFilled(const GrStyledShape& original, FillInver
|
||||
result.fSimplified = true;
|
||||
}
|
||||
|
||||
// Sanity check that lines/points were converted to empty by the style change
|
||||
// Verify that lines/points were converted to empty by the style change
|
||||
SkASSERT((!original.fShape.isLine() && !original.fShape.isPoint()) || result.fShape.isEmpty());
|
||||
|
||||
// We don't copy the inherited key since it can contain path effect information that we just
|
||||
@ -426,7 +426,7 @@ bool GrStyledShape::asRRect(SkRRect* rrect, SkPathDirection* dir, unsigned* star
|
||||
return false;
|
||||
}
|
||||
|
||||
// Sanity check here, if we don't have a path effect on the style, we should have passed
|
||||
// Validity check here, if we don't have a path effect on the style, we should have passed
|
||||
// appropriate flags to GrShape::simplify() to have reset these parameters.
|
||||
SkASSERT(fStyle.hasPathEffect() || (fShape.dir() == GrShape::kDefaultDir &&
|
||||
fShape.startIndex() == GrShape::kDefaultStart));
|
||||
|
@ -84,7 +84,7 @@ FakeClasses(Cubic, Cubic);
|
||||
#define DEBUG_ALIGNMENT 0
|
||||
#define DEBUG_ANGLE 0
|
||||
#define DEBUG_ASSEMBLE 0
|
||||
#define DEBUG_COINCIDENCE 0 // sanity checking
|
||||
#define DEBUG_COINCIDENCE 0
|
||||
#define DEBUG_COINCIDENCE_DUMP 0 // accumulate and dump which algorithms fired
|
||||
#define DEBUG_COINCIDENCE_ORDER 0 // for well behaved curves, check if pairs match up in t-order
|
||||
#define DEBUG_COINCIDENCE_VERBOSE 0 // usually whether the next function generates coincidence
|
||||
|
@ -204,7 +204,7 @@ static bool do_jpeg(sk_sp<SkData> data, SkPDFDocument* doc, SkISize size,
|
||||
}
|
||||
bool yuv = jpegColorType == SkEncodedInfo::kYUV_Color;
|
||||
bool goodColorType = yuv || jpegColorType == SkEncodedInfo::kGray_Color;
|
||||
if (jpegSize != size // Sanity check.
|
||||
if (jpegSize != size // Safety check.
|
||||
|| !goodColorType
|
||||
|| kTopLeft_SkEncodedOrigin != exifOrientation) {
|
||||
return false;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "src/pdf/SkPDFResourceDict.h"
|
||||
#include "src/pdf/SkPDFTypes.h"
|
||||
|
||||
// Sanity check that the values of enum ResourceType correspond to the
|
||||
// expected values as defined in the arrays below.
|
||||
// Verify that the values of enum ResourceType correspond to the expected values
|
||||
// as defined in the arrays below.
|
||||
// If these are failing, you may need to update the kResourceTypePrefixes
|
||||
// and kResourceTypeNames arrays below.
|
||||
static_assert(0 == (int)SkPDFResourceType::kExtGState, "resource_type_mismatch");
|
||||
|
@ -398,7 +398,7 @@ int CPPCodeGenerator::getChildFPIndex(const Variable& var) const {
|
||||
void CPPCodeGenerator::writeFunctionCall(const FunctionCall& c) {
|
||||
if (c.fFunction.fBuiltin && c.fFunction.fName == "sample" &&
|
||||
c.fArguments[0]->fType.kind() != Type::Kind::kSampler_Kind) {
|
||||
// Sanity checks that are detected by function definition in sksl_fp.inc
|
||||
// Validity checks that are detected by function definition in sksl_fp.inc
|
||||
SkASSERT(c.fArguments.size() >= 1 && c.fArguments.size() <= 3);
|
||||
SkASSERT("fragmentProcessor" == c.fArguments[0]->fType.name() ||
|
||||
"fragmentProcessor?" == c.fArguments[0]->fType.name());
|
||||
|
@ -147,9 +147,6 @@ static void test_bigwidth(skiatest::Reporter* reporter) {
|
||||
REPORTER_ASSERT(reporter, !bm.setInfo(info.makeColorType(kN32_SkColorType)));
|
||||
}
|
||||
|
||||
/**
|
||||
* This test contains basic sanity checks concerning bitmaps.
|
||||
*/
|
||||
DEF_TEST(Bitmap, reporter) {
|
||||
// Zero-sized bitmaps are allowed
|
||||
for (int width = 0; width < 2; ++width) {
|
||||
|
@ -122,7 +122,6 @@ static void test_assign_and_comparison(skiatest::Reporter* reporter) {
|
||||
s.clipRect(r, SkMatrix::I(), kUnion_SkClipOp, doAA);
|
||||
REPORTER_ASSERT(reporter, s != copy);
|
||||
|
||||
// Sanity check
|
||||
s.restore();
|
||||
REPORTER_ASSERT(reporter, 2 == s.getSaveCount());
|
||||
|
||||
|
@ -478,7 +478,7 @@ DEF_TEST(GrBlockAllocatorScratchBlockReserve, r) {
|
||||
avail = oldTail->avail();
|
||||
size_t scratchAvail = 2 * avail;
|
||||
pool->reserve(scratchAvail);
|
||||
REPORTER_ASSERT(r, (size_t) pool->testingOnly_scratchBlockSize() >= scratchAvail); // sanity
|
||||
REPORTER_ASSERT(r, (size_t) pool->testingOnly_scratchBlockSize() >= scratchAvail);
|
||||
|
||||
// This allocation request is higher than oldTail's available, and the scratch size so we
|
||||
// should add a new block and scratch size should stay the same.
|
||||
|
@ -71,7 +71,7 @@ static std::vector<GrQuad> generate_quads(float seed, int cnt, const GrQuad::Typ
|
||||
break;
|
||||
}
|
||||
|
||||
SkASSERT(quad.quadType() == types[i]); // sanity check
|
||||
SkASSERT(quad.quadType() == types[i]);
|
||||
quads.push_back(quad);
|
||||
}
|
||||
return quads;
|
||||
@ -149,7 +149,6 @@ TEST(Concat) {
|
||||
buffer2.append(quadsB[i], {2 * i, 0.5f * i}, i % 2 == 0 ? nullptr : &quadsA[i]);
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
ASSERT(kQuadCount == buffer1.count());
|
||||
ASSERT(kQuadCount == buffer2.count());
|
||||
|
||||
|
@ -179,7 +179,6 @@ static void run_concat_test(skiatest::Reporter* reporter, int aCount, int bCount
|
||||
listB.emplace_back(aCount + i);
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
REPORTER_ASSERT(reporter, listA.count() == aCount && listB.count() == bCount);
|
||||
REPORTER_ASSERT(reporter, C::gInstCnt == aCount + bCount);
|
||||
|
||||
@ -217,7 +216,6 @@ static void run_concat_trivial_test(skiatest::Reporter* reporter, int aCount, in
|
||||
listB.push_back({aCount + i});
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
REPORTER_ASSERT(reporter, listA.count() == aCount && listB.count() == bCount);
|
||||
// Concatenate B into A and verify.
|
||||
listA.concat(std::move(listB));
|
||||
|
@ -1306,7 +1306,7 @@ static void test_huge_blur(SkCanvas* canvas, skiatest::Reporter* reporter) {
|
||||
bitmap.allocN32Pixels(100, 100);
|
||||
bitmap.eraseARGB(0, 0, 0, 0);
|
||||
|
||||
// Check that a blur with an insane radius does not crash or assert.
|
||||
// Check that a blur with a very large radius does not crash or assert.
|
||||
SkPaint paint;
|
||||
paint.setImageFilter(SkImageFilters::Blur(SkIntToScalar(1<<30), SkIntToScalar(1<<30), nullptr));
|
||||
canvas->drawBitmap(bitmap, 0, 0, &paint);
|
||||
@ -1319,7 +1319,7 @@ DEF_TEST(HugeBlurImageFilter, reporter) {
|
||||
test_huge_blur(&canvas, reporter);
|
||||
}
|
||||
|
||||
DEF_TEST(ImageFilterMatrixConvolutionSanityTest, reporter) {
|
||||
DEF_TEST(ImageFilterMatrixConvolutionTest, reporter) {
|
||||
SkScalar kernel[1] = { 0 };
|
||||
SkScalar gain = SK_Scalar1, bias = 0;
|
||||
SkIPoint kernelOffset = SkIPoint::Make(1, 1);
|
||||
|
@ -19,9 +19,6 @@ static void set_to_one_proc(void*, void* context) {
|
||||
*(static_cast<int*>(context)) = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* This test contains basic sanity checks concerning SkMallocPixelRef.
|
||||
*/
|
||||
DEF_TEST(MallocPixelRef, reporter) {
|
||||
REPORTER_ASSERT(reporter, true);
|
||||
SkImageInfo info = SkImageInfo::MakeN32Premul(10, 13);
|
||||
|
@ -189,7 +189,7 @@ DEF_TEST(OctoBounds, reporter) {
|
||||
test_octagon(reporter, &rand, 0, -10, 100, 0);
|
||||
// We can't test Infs or NaNs because they trigger internal asserts when setting GrOctoBounds.
|
||||
|
||||
// Sanity check on our random clip testing.. Just make we hit both types of clip.
|
||||
// Verify that our random clip testing hit both types of clip.
|
||||
REPORTER_ASSERT(reporter, numClipsOut > 0);
|
||||
REPORTER_ASSERT(reporter, numIntersectClips > 0);
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include "include/private/SkTo.h"
|
||||
#include "tests/Test.h"
|
||||
|
||||
// Sanity checks for the GetDateTime function.
|
||||
DEF_TEST(Time_GetDateTime, r) {
|
||||
SkTime::DateTime dateTime;
|
||||
SkTime::GetDateTime(&dateTime);
|
||||
|
Loading…
Reference in New Issue
Block a user