Prepare to reenable unreachable-code warnings.

Adding double-parens around an `if ((false))` squelches the warning.
In other cases, you can squelch the warning by assigning the
always-constant(-on-this-machine) check into a constexpr bool.

Change-Id: I5a344fb45779c5bd2865edb3cffaf839ba9a5d85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504597
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2022-02-04 16:09:04 -05:00 committed by SkCQ
parent a803794df7
commit 4250effcc5
46 changed files with 167 additions and 158 deletions

View File

@ -101,8 +101,8 @@ static void dump_array(const uint16_t array[], int count) {
class FontCacheEfficiency : public Benchmark {
public:
FontCacheEfficiency() {
if (false) dump_array(nullptr, 0);
if (false) rotr(0, 0);
if ((false)) dump_array(nullptr, 0);
if ((false)) rotr(0, 0);
}
protected:

View File

@ -295,7 +295,7 @@ protected:
for (int j = 0; j < loops; ++j) {
for (int i = 0; i < N - 4; ++i) {
const SkRect* r = reinterpret_cast<const SkRect*>(&data[i]);
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
isFinite(*r);
}
counter += r->isFinite();

View File

@ -70,9 +70,9 @@ DEF_SIMPLE_GM(sk3d_simple, real_canvas, 300, 300) {
do_draw(canvas, 0x880000FF);
auto pic = recorder.finishRecordingAsPicture();
if (true) {
real_canvas->drawPicture(pic);
} else {
real_canvas->drawPicture(pic);
if ((false)) {
auto data = pic->serialize();
auto pic2 = SkPicture::MakeFromData(data.get());
real_canvas->drawPicture(pic2);

View File

@ -129,7 +129,7 @@ static sk_sp<SkShader> make_bg_shader() {
DEF_SIMPLE_GM(aarectmodes, canvas, 640, 480) {
SkPaint bgPaint;
bgPaint.setShader(make_bg_shader());
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
test4(canvas);
}
const SkRect bounds = SkRect::MakeWH(W, H);

View File

@ -125,7 +125,7 @@ static void make_images() {
// EXIF tag for that image's jpg file.
static void draw(SkCanvas* canvas, const char* suffix) {
// Avoid unused function warning.
if (0) {
if ((false)) {
make_images();
}
canvas->save();

View File

@ -197,10 +197,6 @@ sk_sp<SkRuntimeEffect> make_noise_effect(unsigned loops, const char* filter, con
auto result = SkRuntimeEffect::MakeForShader(
SkStringPrintf(gNoiseEffectSkSL, filter, fractal, loops), {});
if (0 && !result.effect) {
printf("!!! %s\n", result.errorText.c_str());
}
return std::move(result.effect);
}

View File

@ -138,19 +138,20 @@ protected:
canvas->drawLine(x0, Y+2, X1, Y+2, underp);
}
if (info->utf8Starts && false) {
SkString str;
for (int i = 0; i < info->count; ++i) {
str.appendUnichar(gSpeach[info->utf8Starts[i]]);
if ((false)) {
if (info->utf8Starts) {
SkString str;
for (int i = 0; i < info->count; ++i) {
str.appendUnichar(gSpeach[info->utf8Starts[i]]);
}
SkDebugf("'%s'\n", str.c_str());
}
SkDebugf("'%s'\n", str.c_str());
}
if (false) { // show position points
for (int i = 0; i < info->count; ++i) {
auto pos = info->positions[i];
canvas->drawPoint(pos.fX + info->origin.fX, pos.fY + info->origin.fY, p2);
}
// show position points
for (int i = 0; i < info->count; ++i) {
auto pos = info->positions[i];
canvas->drawPoint(pos.fX + info->origin.fX, pos.fY + info->origin.fY, p2);
}
}
});
}

View File

@ -31,7 +31,7 @@ static void check_inval(skiatest::Reporter* reporter, const sk_sp<sksg::Node>& r
sksg::InvalidationController ic;
const auto bbox = root->revalidate(&ic, SkMatrix::I());
if (0) {
if ((false)) {
SkDebugf("** bbox: [%f %f %f %f], ibbox: [%f %f %f %f]\n",
bbox.fLeft, bbox.fTop, bbox.fRight, bbox.fBottom,
ic.bounds().left(), ic.bounds().top(), ic.bounds().right(), ic.bounds().bottom());
@ -46,7 +46,7 @@ static void check_inval(skiatest::Reporter* reporter, const sk_sp<sksg::Node>& r
for (size_t i = 0; i < std::min(expected_damage->size(), damage_count); ++i) {
const auto r1 = (*expected_damage)[i],
r2 = ic.begin()[i];
if (0) {
if ((false)) {
SkDebugf("*** expected inval: [%f %f %f %f], actual: [%f %f %f %f]\n",
r1.left(), r1.top(), r1.right(), r1.bottom(),
r2.left(), r2.top(), r2.right(), r2.bottom());

View File

@ -35,7 +35,7 @@ class CircleView : public Sample {
paint.setStrokeWidth(SkIntToScalar(width));
}
canvas->drawCircle(0, 0, 9.0f, paint);
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
test_circlebounds(canvas);
}
}

View File

@ -144,12 +144,14 @@ protected:
bool split;
path = cusp(pts, pp, split, 8000, .125);
auto debugOutCubic = [](const SkPoint* pts) {
return false; // comment out to capture stream of cusp'd cubics in stdout
SkDebugf("{{");
for (int i = 0; i < 4; ++i) {
SkDebugf("{0x%08x,0x%08x},", SkFloat2Bits(pts[i].fX), SkFloat2Bits(pts[i].fY));
if ((false)) { // enable to capture stream of cusp'd cubics in stdout
SkDebugf("{{");
for (int i = 0; i < 4; ++i) {
SkDebugf("{0x%08x,0x%08x},", SkFloat2Bits(pts[i].fX), SkFloat2Bits(pts[i].fY));
}
SkDebugf("}},\n");
}
SkDebugf("}},\n");
return false;
};
if (split) {
debugOutCubic(&pp[0]);

View File

@ -149,7 +149,7 @@ protected:
canvas->restore();
canvas->translate(0, SkIntToScalar(370));
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
test_alphagradients(canvas);
}
}

View File

@ -50,7 +50,7 @@ static void test_fade(SkCanvas* canvas) {
// now draw the "content"
if (true) {
if ((true)) {
r.setWH(100, 100);
canvas->saveLayerAlpha(&r, 0x80);
@ -103,7 +103,7 @@ protected:
void onDrawContent(SkCanvas* canvas) override {
this->drawBG(canvas);
if (true) {
if ((true)) {
SkRect r;
r.setWH(220, 120);
SkPaint p;
@ -116,7 +116,7 @@ protected:
return;
}
if (false) {
if ((false)) {
SkRect r;
r.setWH(220, 120);
SkPaint p;
@ -135,7 +135,7 @@ protected:
canvas->drawOval(r, p);
}
if (false) {
if ((false)) {
SkPaint p;
p.setAlpha(0x88);
p.setAntiAlias(true);

View File

@ -38,7 +38,7 @@ protected:
canvas->translate(SkIntToScalar(x), SkIntToScalar(y));
// Uncomment to test rotated rect draw combining.
if (false) {
if ((false)) {
SkMatrix rotate;
rotate.setRotate(fRandom.nextUScalar1() * 360,
SkIntToScalar(x) + SkScalarHalf(rect.fRight),

View File

@ -731,7 +731,7 @@ protected:
Dot(canvas, p, 7, SK_ColorBLACK);
}
if (false) {
if ((false)) {
SkScalar ts[2];
int n = SkFindCubicInflections(fPts, ts);
for (int i = 0; i < n; ++i) {

View File

@ -138,7 +138,8 @@ protected:
}
void onDrawContent(SkCanvas* canvas) override {
test_huge_stroke(canvas); return;
test_huge_stroke(canvas);
#if 0
canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
SkPaint paint;
@ -196,6 +197,7 @@ protected:
canvas->translate(0, fPath.getBounds().height() * 5 / 4);
fPath.setFillType(SkPathFillType::kEvenOdd);
drawSet(canvas, &paint);
#endif
}
private:

View File

@ -142,29 +142,27 @@ std::unique_ptr<SkCodec> SkCodec::MakeFromStream(
#ifdef SK_CODEC_DECODES_PNG
if (SkPngCodec::IsPng(buffer, bytesRead)) {
return SkPngCodec::MakeFromStream(std::move(stream), outResult, chunkReader);
} else
}
#endif
{
for (DecoderProc proc : *decoders()) {
if (proc.IsFormat(buffer, bytesRead)) {
return proc.MakeFromStream(std::move(stream), outResult);
}
for (DecoderProc proc : *decoders()) {
if (proc.IsFormat(buffer, bytesRead)) {
return proc.MakeFromStream(std::move(stream), outResult);
}
}
#ifdef SK_HAS_HEIF_LIBRARY
SkEncodedImageFormat format;
if (SkHeifCodec::IsSupported(buffer, bytesRead, &format)) {
return SkHeifCodec::MakeFromStream(std::move(stream), selectionPolicy,
format, outResult);
}
SkEncodedImageFormat format;
if (SkHeifCodec::IsSupported(buffer, bytesRead, &format)) {
return SkHeifCodec::MakeFromStream(std::move(stream), selectionPolicy,
format, outResult);
}
#endif
#ifdef SK_CODEC_DECODES_RAW
// Try to treat the input as RAW if all the other checks failed.
return SkRawCodec::MakeFromStream(std::move(stream), outResult);
#endif
}
// Try to treat the input as RAW if all the other checks failed.
return SkRawCodec::MakeFromStream(std::move(stream), outResult);
#else
if (bytesRead < bytesToRead) {
*outResult = kIncompleteInput;
} else {
@ -172,6 +170,7 @@ std::unique_ptr<SkCodec> SkCodec::MakeFromStream(
}
return nullptr;
#endif
}
std::unique_ptr<SkCodec> SkCodec::MakeFromData(sk_sp<SkData> data, SkPngChunkReader* reader) {

View File

@ -552,7 +552,7 @@ void SkBitmapDevice::drawAtlas(const SkRSXform xform[],
sk_sp<SkBlender> blender,
const SkPaint& paint) {
// set this to true for performance comparisons with the old drawVertices way
if (false) {
if ((false)) {
this->INHERITED::drawAtlas(xform, tex, colors, count, std::move(blender), paint);
return;
}

View File

@ -37,7 +37,7 @@ void SkDrawable::draw(SkCanvas* canvas, const SkMatrix* matrix) {
}
this->onDraw(canvas);
if (false) {
if ((false)) {
draw_bbox(canvas, this->getBounds());
}
}
@ -76,7 +76,7 @@ SkPicture* SkDrawable::onNewPictureSnapshot() {
const SkRect bounds = this->getBounds();
SkCanvas* canvas = recorder.beginRecording(bounds);
this->draw(canvas);
if (false) {
if ((false)) {
draw_bbox(canvas, bounds);
}
return recorder.finishRecordingAsPicture().release();

View File

@ -1410,7 +1410,7 @@ int SkConic::computeQuadPOW2(SkScalar tol) const {
error *= 0.25f;
}
// float version -- using ceil gives the same results as the above.
if (false) {
if ((false)) {
SkScalar err = SkScalarSqrt(x * x + y * y);
if (err <= tol) {
return 0;

View File

@ -1402,8 +1402,8 @@ SkPath& SkPath::addPath(const SkPath& srcPath, const SkMatrix& matrix, AddPathMo
SkMatrixPriv::MapPtsProc mapPtsProc = SkMatrixPriv::GetMapPtsProc(matrix);
bool firstVerb = true;
for (auto [verb, pts, w] : SkPathPriv::Iterate(*src)) {
SkPoint mappedPts[3];
switch (verb) {
SkPoint mappedPts[3];
case SkPathVerb::kMove:
mapPtsProc(matrix, mappedPts, &pts[0], 1);
if (firstVerb && mode == kExtend_AddPathMode && !isEmpty()) {

View File

@ -621,7 +621,7 @@ skvm::Program* SkVMBlitter::buildProgram(Coverage coverage) {
"%zu, prev was %zu", fUniforms.buf.size(), prev);
skvm::Program program = builder.done(DebugName(key).c_str());
if (false) {
if ((false)) {
static std::atomic<int> missed{0},
total{0};
if (!program.hasJIT()) {

View File

@ -136,7 +136,8 @@ bool GrDrawOpAtlas::Plot::addSubImage(
dataPtr += fBytesPerPixel * fWidth * rect.fTop;
dataPtr += fBytesPerPixel * rect.fLeft;
// copy into the data buffer, swizzling as we go if this is ARGB data
if (4 == fBytesPerPixel && kN32_SkColorType == kBGRA_8888_SkColorType) {
constexpr bool kBGRAIsNative = kN32_SkColorType == kBGRA_8888_SkColorType;
if (4 == fBytesPerPixel && kBGRAIsNative) {
for (int i = 0; i < height; ++i) {
SkOpts::RGBA_to_BGRA((uint32_t*)dataPtr, (const uint32_t*)imagePtr, width);
dataPtr += fBytesPerPixel * fWidth;

View File

@ -197,10 +197,10 @@ int StrokeFixedCountTessellator::writePatches(PatchWriter& patchWriter,
}
StrokeIterator strokeIter(pathStroke->fPath, &pathStroke->fStroke, &shaderMatrix);
while (strokeIter.next()) {
using Verb = StrokeIterator::Verb;
const SkPoint* p = strokeIter.pts();
int numChops;
switch (strokeIter.verb()) {
using Verb = StrokeIterator::Verb;
int numChops;
case Verb::kContourFinished:
instanceWriter.finishContour();
break;

View File

@ -56,7 +56,8 @@ static uint32_t SkGetCoreTextVersion() {
static uint32_t SkGetCoreTextVersion() {
// Check for CoreText availability before calling CTGetCoreTextVersion().
if (&CTGetCoreTextVersion) {
static const bool kCoreTextIsAvailable = (&CTGetCoreTextVersion != nullptr);
if (kCoreTextIsAvailable) {
return CTGetCoreTextVersion();
}

View File

@ -106,7 +106,7 @@ const Sk4fGradientInterval*
SkLinearGradient::LinearGradient4fContext::findInterval(SkScalar fx) const {
SkASSERT(in_range(fx, fIntervals->front().fT0, fIntervals->back().fT1));
if (1) {
if ((true)) {
// Linear search, using the last scanline interval as a starting point.
SkASSERT(fCachedInterval >= fIntervals->begin());
SkASSERT(fCachedInterval < fIntervals->end());

View File

@ -86,7 +86,7 @@ static void write_image(const SkImage* img, const char path[]) {
}
static void compare(skiatest::Reporter* reporter, SkImage* img0, SkImage* img1) {
if (false) {
if ((false)) {
static int counter;
SkDebugf("---- counter %d\n", counter);

View File

@ -50,7 +50,7 @@ DEF_TEST(ColorInterp, reporter) {
SkPMColor src = SkPreMultiplyColor(colorSrc);
SkPMColor dst = SkPreMultiplyColor(colorDst);
if (false) {
if ((false)) {
REPORTER_ASSERT(reporter, SkFourByteInterp(src, dst, a0) == dst);
REPORTER_ASSERT(reporter, SkFourByteInterp(src, dst, a255) == src);
}

View File

@ -527,7 +527,7 @@ DEF_TEST(CustomMeshSpec, reporter) {
test_too_many_attrs(reporter);
test_too_many_varyings(reporter);
// skbug.com/12712
if (0) {
if ((false)) {
test_duplicate_attribute_names(reporter);
test_duplicate_varying_names(reporter);
}

View File

@ -411,7 +411,7 @@ DEF_TEST(DrawPath, reporter) {
test_crbug_140803();
test_inversepathwithclip();
// why?
if (false) test_crbug131181();
if ((false)) test_crbug131181();
test_infinite_dash(reporter);
test_crbug_165432(reporter);
test_crbug_472147_simple(reporter);

View File

@ -125,7 +125,7 @@ static void test_symbolfont(skiatest::Reporter* reporter) {
}
static void test_tables(skiatest::Reporter* reporter, const sk_sp<SkTypeface>& face) {
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
SkFontID fontID = face->uniqueID();
REPORTER_ASSERT(reporter, fontID);
}

View File

@ -33,7 +33,7 @@ static void testChopCubic(skiatest::Reporter* reporter) {
SkScalar tValues[3];
// make sure we don't assert internally
int count = SkChopCubicAtMaxCurvature(src, dst, tValues);
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
REPORTER_ASSERT(reporter, count);
}
// Make sure src and dst can be the same pointer.

View File

@ -76,7 +76,7 @@ DEF_TEST(ImageGenerator, reporter) {
ig.getYUVAPlanes(yuvaPixmaps);
// Suppressed due to https://code.google.com/p/skia/issues/detail?id=4339
if (false) {
if ((false)) {
test_imagegenerator_factory(reporter);
}
}

View File

@ -133,7 +133,7 @@ static int (*blend_functions[])(int, int, int) = {
static void test_blend31() {
int failed = 0;
int death = 0;
if (false) { // avoid bit rot, suppress warning
if ((false)) { // avoid bit rot, suppress warning
failed = (*blend_functions[0])(0,0,0);
}
for (int src = 0; src <= 255; src++) {
@ -507,10 +507,10 @@ DEF_TEST(Math, reporter) {
REPORTER_ASSERT(reporter, result == (int32_t)check);
}
if (false) test_floor(reporter);
if ((false)) test_floor(reporter);
// disable for now
if (false) test_blend31(); // avoid bit rot, suppress warning
if ((false)) test_blend31(); // avoid bit rot, suppress warning
test_clz(reporter);
test_ctz(reporter);

View File

@ -124,11 +124,9 @@ static bool one_d_pe(const int* array, const unsigned int count,
uint32_t estimatedCount =
quadraticPointCount_EE(path);
if (false) { // avoid bit rot, suppress warning
computedCount =
quadraticPointCount_EC(path, SkIntToScalar(1));
estimatedCount =
quadraticPointCount_CE(path);
if ((false)) { // avoid bit rot, suppress warning
computedCount = quadraticPointCount_EC(path, SkIntToScalar(1));
estimatedCount = quadraticPointCount_CE(path);
}
// Allow estimated to be high by a factor of two, but no less than
// the computed value.

View File

@ -626,17 +626,19 @@ const char ovalsAsQuads[] = "M 146.4187316894531 136.5"
#include "include/utils/SkParsePath.h"
DEF_TEST(PathOpsOvalsAsQuads, reporter) {
return; // don't execute this for now
SkPath path;
SkParsePath::FromSVGString(ovalsAsQuads, &path);
Simplify(path, &path);
if ((false)) { // don't execute this for now
SkPath path;
SkParsePath::FromSVGString(ovalsAsQuads, &path);
Simplify(path, &path);
}
}
DEF_TEST(PathOps64OvalsAsQuads, reporter) {
return; // don't execute this for now
SkPath path, result;
SkOpBuilder builder;
SkParsePath::FromSVGString(ovalsAsQuads, &path);
OvalSet set = {{0, 0, 0, 0}, 2, 3, 9, 100, 100};
testOvalSet(set, path, &builder, nullptr, &result);
if ((false)) { // don't execute this for now
SkPath path, result;
SkOpBuilder builder;
SkParsePath::FromSVGString(ovalsAsQuads, &path);
OvalSet set = {{0, 0, 0, 0}, 2, 3, 9, 100, 100};
testOvalSet(set, path, &builder, nullptr, &result);
}
}

View File

@ -730,6 +730,6 @@ DEF_TEST(PathOpsCubicIntersection, reporter) {
cubicIntersectionSelfTest(reporter);
cubicIntersectionCoinTest(reporter);
standardTestCases(reporter);
if (false) CubicIntersection_IntersectionFinder();
if (false) CubicIntersection_RandTest(reporter);
if ((false)) CubicIntersection_IntersectionFinder();
if ((false)) CubicIntersection_RandTest(reporter);
}

View File

@ -271,17 +271,19 @@ static double testOneFailure(const CubicLineFailures& failure) {
}
DEF_TEST(PathOpsCubicLineFailures, reporter) {
return; // disable for now
for (int index = 0; index < cubicLineFailuresCount; ++index) {
const CubicLineFailures& failure = cubicLineFailures[index];
double newT = testOneFailure(failure);
SkASSERT_RELEASE(newT >= 0);
if ((false)) { // disable for now
for (int index = 0; index < cubicLineFailuresCount; ++index) {
const CubicLineFailures& failure = cubicLineFailures[index];
double newT = testOneFailure(failure);
SkASSERT_RELEASE(newT >= 0);
}
}
}
DEF_TEST(PathOpsCubicLineOneFailure, reporter) {
return; // disable for now
const CubicLineFailures& failure = cubicLineFailures[1];
double newT = testOneFailure(failure);
SkASSERT_RELEASE(newT >= 0);
if ((false)) { // disable for now
const CubicLineFailures& failure = cubicLineFailures[1];
double newT = testOneFailure(failure);
SkASSERT_RELEASE(newT >= 0);
}
}

View File

@ -524,7 +524,7 @@ DEF_TEST(PathOpsQuadIntersection, reporter) {
oneOffTests(reporter);
coincidentTest(reporter);
standardTestCases(reporter);
if (false) QuadraticIntersection_IntersectionFinder();
if ((false)) QuadraticIntersection_IntersectionFinder();
}
DEF_TEST(PathOpsQuadBinaryProfile, reporter) {

View File

@ -5486,7 +5486,7 @@ DEF_TEST(Path_shrinkToFit, reporter) {
REPORTER_ASSERT(reporter, after == after2);
#endif
}
if (false) {
if ((false)) {
SkDebugf("max_free %zu\n", max_free);
}
}

View File

@ -478,36 +478,38 @@ static bool legal_modulation(const GrColor inGr[3], const GrColor outGr[3]) {
fuzzy_color_equals(outf[2], expectedForAlphaModulation[2]);
// This can be enabled to print the values that caused this check to fail.
if (0 && !isLegalColorModulation && !isLegalAlphaModulation) {
SkDebugf("Color modulation test\n\timplied mod color: (%.03f, %.03f, %.03f, %.03f)\n",
fpPreColorModulation[0],
fpPreColorModulation[1],
fpPreColorModulation[2],
fpPreColorModulation[3]);
for (int i = 0; i < 3; ++i) {
SkDebugf("\t(%.03f, %.03f, %.03f, %.03f) -> "
"(%.03f, %.03f, %.03f, %.03f) | "
"(%.03f, %.03f, %.03f, %.03f), ok: %d\n",
inf[i].fR, inf[i].fG, inf[i].fB, inf[i].fA,
outf[i].fR, outf[i].fG, outf[i].fB, outf[i].fA,
expectedForColorModulation[i].fR, expectedForColorModulation[i].fG,
expectedForColorModulation[i].fB, expectedForColorModulation[i].fA,
fuzzy_color_equals(outf[i], expectedForColorModulation[i]));
}
SkDebugf("Alpha modulation test\n\timplied mod color: (%.03f, %.03f, %.03f, %.03f)\n",
fpPreAlphaModulation[0],
fpPreAlphaModulation[1],
fpPreAlphaModulation[2],
fpPreAlphaModulation[3]);
for (int i = 0; i < 3; ++i) {
SkDebugf("\t(%.03f, %.03f, %.03f, %.03f) -> "
"(%.03f, %.03f, %.03f, %.03f) | "
"(%.03f, %.03f, %.03f, %.03f), ok: %d\n",
inf[i].fR, inf[i].fG, inf[i].fB, inf[i].fA,
outf[i].fR, outf[i].fG, outf[i].fB, outf[i].fA,
expectedForAlphaModulation[i].fR, expectedForAlphaModulation[i].fG,
expectedForAlphaModulation[i].fB, expectedForAlphaModulation[i].fA,
fuzzy_color_equals(outf[i], expectedForAlphaModulation[i]));
if ((false)) {
if (!isLegalColorModulation && !isLegalAlphaModulation) {
SkDebugf("Color modulation test\n\timplied mod color: (%.03f, %.03f, %.03f, %.03f)\n",
fpPreColorModulation[0],
fpPreColorModulation[1],
fpPreColorModulation[2],
fpPreColorModulation[3]);
for (int i = 0; i < 3; ++i) {
SkDebugf("\t(%.03f, %.03f, %.03f, %.03f) -> "
"(%.03f, %.03f, %.03f, %.03f) | "
"(%.03f, %.03f, %.03f, %.03f), ok: %d\n",
inf[i].fR, inf[i].fG, inf[i].fB, inf[i].fA,
outf[i].fR, outf[i].fG, outf[i].fB, outf[i].fA,
expectedForColorModulation[i].fR, expectedForColorModulation[i].fG,
expectedForColorModulation[i].fB, expectedForColorModulation[i].fA,
fuzzy_color_equals(outf[i], expectedForColorModulation[i]));
}
SkDebugf("Alpha modulation test\n\timplied mod color: (%.03f, %.03f, %.03f, %.03f)\n",
fpPreAlphaModulation[0],
fpPreAlphaModulation[1],
fpPreAlphaModulation[2],
fpPreAlphaModulation[3]);
for (int i = 0; i < 3; ++i) {
SkDebugf("\t(%.03f, %.03f, %.03f, %.03f) -> "
"(%.03f, %.03f, %.03f, %.03f) | "
"(%.03f, %.03f, %.03f, %.03f), ok: %d\n",
inf[i].fR, inf[i].fG, inf[i].fB, inf[i].fA,
outf[i].fR, outf[i].fG, outf[i].fB, outf[i].fA,
expectedForAlphaModulation[i].fR, expectedForAlphaModulation[i].fG,
expectedForAlphaModulation[i].fB, expectedForAlphaModulation[i].fA,
fuzzy_color_equals(outf[i], expectedForAlphaModulation[i]));
}
}
}
return isLegalColorModulation || isLegalAlphaModulation;

View File

@ -484,7 +484,7 @@ DEF_TEST(RRect_fragile, reporter) {
SkRRect rr;
// please don't assert
if (false) { // disable until we fix this
if ((false)) { // disable until we fix this
SkDebugf("%g 0x%08X\n", rect.fLeft, SkFloat2Bits(rect.fLeft));
rr.setRectRadii(rect, radii);
}

View File

@ -2285,7 +2285,7 @@ DEF_TEST(SkVM_approx_math, r) {
return approx_tan(x - 3*P);
});
}
if (0) { SkDebugf("tan error %g\n", err); }
if ((false)) { SkDebugf("tan error %g\n", err); }
}
// asin, acos, atan
@ -2300,7 +2300,7 @@ DEF_TEST(SkVM_approx_math, r) {
return approx_acos(x);
});
}
if (0) { SkDebugf("asin error %g\n", err); }
if ((false)) { SkDebugf("asin error %g\n", err); }
err = 0;
for (float x = -10; x <= 10; x += 1.0f/16) {
@ -2308,7 +2308,7 @@ DEF_TEST(SkVM_approx_math, r) {
return approx_atan(x);
});
}
if (0) { SkDebugf("atan error %g\n", err); }
if ((false)) { SkDebugf("atan error %g\n", err); }
for (float y = -3; y <= 3; y += 1) {
for (float x = -3; x <= 3; x += 1) {
@ -2317,7 +2317,7 @@ DEF_TEST(SkVM_approx_math, r) {
});
}
}
if (0) { SkDebugf("atan2 error %g\n", err); }
if ((false)) { SkDebugf("atan2 error %g\n", err); }
}
}

View File

@ -296,15 +296,17 @@ DEF_TEST(String_huge, r) {
// See where we crash, and manually check that its at the right point.
//
// To test, change the false to true
while (false) {
// On a 64bit build, this should crash when size == 1 << 32, since we can't store
// that length in the string's header (which has a u32 slot for the length).
//
// On a 32bit build, this should crash the first time around, since we can't allocate
// anywhere near this amount.
//
SkString str(size);
size += 1;
if ((false)) {
for (;;) {
// On a 64bit build, this should crash when size == 1 << 32, since we can't store
// that length in the string's header (which has a u32 slot for the length).
//
// On a 32bit build, this should crash the first time around, since we can't allocate
// anywhere near this amount.
//
SkString str(size);
size += 1;
}
}
}

View File

@ -1156,13 +1156,15 @@ DEF_TEST(surface_image_unity, reporter) {
auto surf = SkSurface::MakeRaster(info, rowBytes, nullptr);
if (surf) {
auto img = surf->makeImageSnapshot();
if (!img && false) { // change to true to document the differences
SkDebugf("image failed: [%08X %08X] %14s %s\n",
info.width(),
info.height(),
ToolUtils::colortype_name(info.colorType()),
ToolUtils::alphatype_name(info.alphaType()));
return;
if ((false)) { // change to true to document the differences
if (!img) {
SkDebugf("image failed: [%08X %08X] %14s %s\n",
info.width(),
info.height(),
ToolUtils::colortype_name(info.colorType()),
ToolUtils::alphatype_name(info.alphaType()));
return;
}
}
REPORTER_ASSERT(reporter, img != nullptr);

View File

@ -139,7 +139,8 @@ static bool setup_backend_objects(GrDirectContext* dContext,
}
SkAutoPixmapStorage rgbaPixmap;
if (kN32_SkColorType != kRGBA_8888_SkColorType) {
constexpr bool kRGBAIsNative = kN32_SkColorType == kRGBA_8888_SkColorType;
if ((!kRGBAIsNative)) {
if (!rgbaPixmap.tryAlloc(bm.info().makeColorType(kRGBA_8888_SkColorType))) {
fputs("Unable to alloc rgbaPixmap.\n", stderr);
return false;

View File

@ -228,8 +228,6 @@ void* SkiaAndroidApp::pthread_main(void* arg) {
}
}
SkDebugf("pthread_main ends");
return nullptr;
}