diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index 27a145e06..690497a55 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -80,7 +80,7 @@ static void init_src(const SkBitmap& bitmap, const SkColorTable* ct) { } } -SkColorTable* init_ctable() { +static SkColorTable* init_ctable() { static const SkColor colors[] = { SK_ColorBLACK, SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorWHITE }; @@ -102,7 +102,7 @@ struct Pair { // Utility function to read the value of a given pixel in bm. All // values converted to uint32_t for simplification of comparisons. -uint32_t getPixel(int x, int y, const SkBitmap& bm) { +static uint32_t getPixel(int x, int y, const SkBitmap& bm) { uint32_t val = 0; uint16_t val16; uint8_t val8, shift; @@ -137,7 +137,7 @@ uint32_t getPixel(int x, int y, const SkBitmap& bm) { // Utility function to set value of any pixel in bm. // bm.getConfig() specifies what format 'val' must be // converted to, but at present uint32_t can handle all formats. -void setPixel(int x, int y, uint32_t val, SkBitmap& bm) { +static void setPixel(int x, int y, uint32_t val, SkBitmap& bm) { uint16_t val16; uint8_t val8, shift; SkAutoLockPixels lock(bm); @@ -174,7 +174,7 @@ void setPixel(int x, int y, uint32_t val, SkBitmap& bm) { // Utility to return string containing name of each format, to // simplify diagnostic output. -const char* getSkConfigName(const SkBitmap& bm) { +static const char* getSkConfigName(const SkBitmap& bm) { switch (bm.getConfig()) { case SkBitmap::kNo_Config: return "SkBitmap::kNo_Config"; case SkBitmap::kA1_Config: return "SkBitmap::kA1_Config"; @@ -211,7 +211,7 @@ struct Coordinates { // A function to verify that two bitmaps contain the same pixel values // at all coordinates indicated by coords. Simplifies verification of // copied bitmaps. -void reportCopyVerification(const SkBitmap& bm1, const SkBitmap& bm2, +static void reportCopyVerification(const SkBitmap& bm1, const SkBitmap& bm2, Coordinates& coords, const char* msg, skiatest::Reporter* reporter){ @@ -232,7 +232,7 @@ void reportCopyVerification(const SkBitmap& bm1, const SkBitmap& bm2, } // Writes unique pixel values at locations specified by coords. -void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) { +static void writeCoordPixels(SkBitmap& bm, const Coordinates& coords) { for (int i = 0; i < coords.length; ++i) setPixel(coords[i]->fX, coords[i]->fY, i, bm); } diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 899c34e16..f35d05b29 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -722,6 +722,7 @@ static void TestDeferredCanvasStateConsistency( */ } +// unused static void TestProxyCanvasStateConsistency( skiatest::Reporter* reporter, CanvasTestStep* testStep, @@ -744,6 +745,7 @@ static void TestProxyCanvasStateConsistency( testStep); } +// unused static void TestNWayCanvasStateConsistency( skiatest::Reporter* reporter, CanvasTestStep* testStep, @@ -799,18 +801,26 @@ static void TestOverrideStateConsistency(skiatest::Reporter* reporter, SkPicture::kFlattenMutableNonTexturePixelRefs_RecordingFlag); TestDeferredCanvasStateConsistency(reporter, testStep, referenceCanvas); - // The following test code is commented out because SkProxyCanvas is + // The following test code is disabled because SkProxyCanvas is // missing a lot of virtual overrides on get* methods, which are used // to verify canvas state. // Issue: http://code.google.com/p/skia/issues/detail?id=500 - - //TestProxyCanvasStateConsistency(reporter, testStep, referenceCanvas); - // The following test code is commented out because SkNWayCanvas does not + if (false) { // avoid bit rot, suppress warning + TestProxyCanvasStateConsistency(reporter, testStep, referenceCanvas); + } + + // The following test code is disabled because SkNWayCanvas does not // report correct clipping and device bounds information // Issue: http://code.google.com/p/skia/issues/detail?id=501 + + if (false) { // avoid bit rot, suppress warning + TestNWayCanvasStateConsistency(reporter, testStep, referenceCanvas); + } - //TestNWayCanvasStateConsistency(reporter, testStep, referenceCanvas); + if (false) { // avoid bit rot, suppress warning + test_clipVisitor(reporter, &referenceCanvas); + } } static void TestCanvas(skiatest::Reporter* reporter) { diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp index a0888d85e..ae3337e74 100644 --- a/tests/ClipCacheTest.cpp +++ b/tests/ClipCacheTest.cpp @@ -13,6 +13,7 @@ static const int X_SIZE = 12; static const int Y_SIZE = 12; //////////////////////////////////////////////////////////////////////////////// +// note: this is unused static GrTexture* createTexture(GrContext* context) { unsigned char textureData[X_SIZE][Y_SIZE][4]; @@ -59,6 +60,9 @@ static void check_state(skiatest::Reporter* reporter, // push, pop, set, canReuse & getters static void test_cache(skiatest::Reporter* reporter, GrContext* context) { + if (false) { // avoid bit rot, suppress warning + createTexture(context); + } GrClipMaskCache cache; cache.setContext(context); diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp index d739d3195..724ff56cd 100644 --- a/tests/ClipperTest.cpp +++ b/tests/ClipperTest.cpp @@ -22,8 +22,8 @@ static void test_hairclipping(skiatest::Reporter* reporter) { SkCanvas canvas(bm); canvas.clipRect(SkRect::MakeWH(SkIntToScalar(4), SkIntToScalar(2))); - canvas.drawLine(SkFloatToScalar(1.5), SkFloatToScalar(1.5), - SkFloatToScalar(3.5), SkFloatToScalar(3.5), paint); + canvas.drawLine(SkFloatToScalar(1.5f), SkFloatToScalar(1.5f), + SkFloatToScalar(3.5f), SkFloatToScalar(3.5f), paint); /** * We had a bug where we misinterpreted the bottom of the clip, and @@ -144,7 +144,7 @@ static void test_intersectline(skiatest::Reporter* reporter) { } -void TestClipper(skiatest::Reporter* reporter) { +static void TestClipper(skiatest::Reporter* reporter) { test_intersectline(reporter); test_edgeclipper(reporter); test_hairclipping(reporter); diff --git a/tests/DataRefTest.cpp b/tests/DataRefTest.cpp index 6a42485d3..56c5d1172 100644 --- a/tests/DataRefTest.cpp +++ b/tests/DataRefTest.cpp @@ -26,7 +26,7 @@ static void assert_data(skiatest::Reporter* reporter, SkData* ref, REPORTER_ASSERT(reporter, !memcmp(ref->data(), data, len)); } -void TestDataRef(skiatest::Reporter* reporter) { +static void TestDataRef(skiatest::Reporter* reporter) { const char* str = "We the people, in order to form a more perfect union."; const int N = 10; diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp index b126076fc..4cff190af 100644 --- a/tests/EmptyPathTest.cpp +++ b/tests/EmptyPathTest.cpp @@ -39,7 +39,7 @@ static void drawAndTest(skiatest::Reporter* reporter, const SkPath& path, size_t count = DIMENSION * DIMENSION; const SkPMColor* ptr = bm.getAddr32(0, 0); - SkPMColor andValue = ~0; + SkPMColor andValue = ~0U; SkPMColor orValue = 0; for (size_t i = 0; i < count; ++i) { SkPMColor c = ptr[i]; diff --git a/tests/FillPathTest.cpp b/tests/FillPathTest.cpp index b14f5bca1..22ceb1987 100644 --- a/tests/FillPathTest.cpp +++ b/tests/FillPathTest.cpp @@ -38,9 +38,9 @@ static void TestFillPathInverse(skiatest::Reporter* reporter) { int width = 200; int expected_lines = 5; clip.set(0, height - expected_lines, width, height); - path.moveTo(0.0, 0.0); + path.moveTo(0.0f, 0.0f); path.quadTo(SkIntToScalar(width/2), SkIntToScalar(height), - SkIntToScalar(width), 0.0); + SkIntToScalar(width), 0.0f); path.close(); path.setFillType(SkPath::kInverseWinding_FillType); SkScan::FillPath(path, clip, &blitter); diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp index 234d177e6..e35e73f58 100644 --- a/tests/FontHostTest.cpp +++ b/tests/FontHostTest.cpp @@ -26,6 +26,9 @@ static const struct TagSize { static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) { SkFontID fontID = face->uniqueID(); + if (false) { // avoid bit rot, suppress warning + REPORTER_ASSERT(reporter, fontID); + } int count = face->countTables(); diff --git a/tests/GeometryTest.cpp b/tests/GeometryTest.cpp index 9a0f78f4a..12cc81632 100644 --- a/tests/GeometryTest.cpp +++ b/tests/GeometryTest.cpp @@ -28,6 +28,9 @@ 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 + REPORTER_ASSERT(reporter, count); + } } diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index a7ecfa1c7..3deb79a69 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -73,9 +73,20 @@ static int blend31_old(int src, int dst, int a31) { return dst + ((src - dst) * a31 >> 5); } +// suppress unused code warning +static int (*blend_functions[])(int, int, int) = { + blend31, + blend31_slow, + blend31_round, + blend31_old +}; + static void test_blend31() { int failed = 0; int death = 0; + if (false) { // avoid bit rot, suppress warning + failed = (*blend_functions[0])(0,0,0); + } for (int src = 0; src <= 255; src++) { for (int dst = 0; dst <= 255; dst++) { for (int a = 0; a <= 31; a++) { @@ -599,7 +610,7 @@ static void TestMath(skiatest::Reporter* reporter) { #endif // disable for now -// test_blend31(); + if (false) test_blend31(); // avoid bit rot, suppress warning } #include "TestClassDef.h" diff --git a/tests/Matrix44Test.cpp b/tests/Matrix44Test.cpp index 9846e7df0..9e589e6aa 100644 --- a/tests/Matrix44Test.cpp +++ b/tests/Matrix44Test.cpp @@ -76,7 +76,7 @@ static void test_common_angles(skiatest::Reporter* reporter) { } } -void TestMatrix44(skiatest::Reporter* reporter) { +static void TestMatrix44(skiatest::Reporter* reporter) { #ifdef SK_SCALAR_IS_FLOAT SkMatrix44 mat, inverse, iden1, iden2, rot; @@ -139,9 +139,9 @@ void TestMatrix44(skiatest::Reporter* reporter) { 0, 0, 0, 1); } -#if 0 // working on making this pass - test_common_angles(reporter); -#endif + if (false) { // avoid bit rot, suppress warning (working on making this pass) + test_common_angles(reporter); + } #endif } diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 6cf900612..979f6ce76 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -100,7 +100,7 @@ static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) { REPORTER_ASSERT(reporter, memcmp(buffer, buffer2, size1) == 0); } -void test_matrix_max_stretch(skiatest::Reporter* reporter) { +static void test_matrix_max_stretch(skiatest::Reporter* reporter) { SkMatrix identity; identity.reset(); REPORTER_ASSERT(reporter, SK_Scalar1 == identity.getMaxStretch()); @@ -218,7 +218,7 @@ static bool isSimilarityTransformation(const SkMatrix& matrix, SkScalarSquare(tol)); } -void test_matrix_is_similarity_transform(skiatest::Reporter* reporter) { +static void test_matrix_is_similarity_transform(skiatest::Reporter* reporter) { SkMatrix mat; // identity @@ -347,7 +347,7 @@ void test_matrix_is_similarity_transform(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, isSimilarityTransformation(mat)); } -void TestMatrix(skiatest::Reporter* reporter) { +static void TestMatrix(skiatest::Reporter* reporter) { SkMatrix mat, inverse, iden1, iden2; mat.reset(); diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp index 000ebea69..2423d561d 100644 --- a/tests/PDFPrimitivesTest.cpp +++ b/tests/PDFPrimitivesTest.cpp @@ -240,7 +240,7 @@ static void TestPDFPrimitives(skiatest::Reporter* reporter) { SimpleCheckObjectOutput(reporter, realHalf.get(), "0.5"); #if defined(SK_SCALAR_IS_FLOAT) - SkRefPtr bigScalar = new SkPDFScalar(110999.75); + SkRefPtr bigScalar = new SkPDFScalar(110999.75f); bigScalar->unref(); // SkRefPtr and new both took a reference. #if !defined(SK_ALLOW_LARGE_PDF_SCALARS) SimpleCheckObjectOutput(reporter, bigScalar.get(), "111000"); diff --git a/tests/ParsePathTest.cpp b/tests/ParsePathTest.cpp index 831cd8ebe..116dbd0fd 100644 --- a/tests/ParsePathTest.cpp +++ b/tests/ParsePathTest.cpp @@ -27,18 +27,18 @@ static void test_to_from(skiatest::Reporter* reporter, const SkPath& path) { #endif } +static struct { + const char* fStr; + const SkRect fBounds; +} gRec[] = { + { "", { 0, 0, 0, 0 } }, + { "M0,0L10,10", { 0, 0, SkIntToScalar(10), SkIntToScalar(10) } }, + { "M-5.5,-0.5 Q 0 0 6,6.50", + { SkFloatToScalar(-5.5f), SkFloatToScalar(-0.5f), + SkFloatToScalar(6), SkFloatToScalar(6.5f) } } +}; + static void TestParsePath(skiatest::Reporter* reporter) { - static const struct { - const char* fStr; - SkRect fBounds; - } gRec[] = { - { "", { 0, 0, 0, 0 } }, - { "M0,0L10,10", { 0, 0, SkIntToScalar(10), SkIntToScalar(10) } }, - { "M-5.5,-0.5 Q 0 0 6,6.50", - { SkFloatToScalar(-5.5f), SkFloatToScalar(-0.5f), - SkFloatToScalar(6), SkFloatToScalar(6.5f) } } - }; - for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) { SkPath path; bool success = SkParsePath::FromSVGString(gRec[i].fStr, &path); @@ -51,13 +51,13 @@ static void TestParsePath(skiatest::Reporter* reporter) { } SkRect r; - r.set(0, 0, SkFloatToScalar(10), SkFloatToScalar(10.5)); + r.set(0, 0, SkFloatToScalar(10), SkFloatToScalar(10.5f)); SkPath p; p.addRect(r); test_to_from(reporter, p); p.addOval(r); test_to_from(reporter, p); - p.addRoundRect(r, SkFloatToScalar(4), SkFloatToScalar(4.5)); + p.addRoundRect(r, SkFloatToScalar(4), SkFloatToScalar(4.5f)); test_to_from(reporter, p); } diff --git a/tests/PathCoverageTest.cpp b/tests/PathCoverageTest.cpp index 4f2f1bee6..9734f75e1 100644 --- a/tests/PathCoverageTest.cpp +++ b/tests/PathCoverageTest.cpp @@ -66,22 +66,22 @@ static inline uint32_t compute_pointCount(SkScalar d, SkScalar tol) { } } -uint32_t quadraticPointCount_EE(const SkPoint points[], SkScalar tol) { +static uint32_t quadraticPointCount_EE(const SkPoint points[], SkScalar tol) { int distance = estimate_distance(points); return estimate_pointCount(distance); } -uint32_t quadraticPointCount_EC(const SkPoint points[], SkScalar tol) { +static uint32_t quadraticPointCount_EC(const SkPoint points[], SkScalar tol) { int distance = estimate_distance(points); return compute_pointCount(SkIntToScalar(distance), tol); } -uint32_t quadraticPointCount_CE(const SkPoint points[], SkScalar tol) { +static uint32_t quadraticPointCount_CE(const SkPoint points[], SkScalar tol) { SkScalar distance = compute_distance(points); return estimate_pointCount(SkScalarRound(distance)); } -uint32_t quadraticPointCount_CC(const SkPoint points[], SkScalar tol) { +static uint32_t quadraticPointCount_CC(const SkPoint points[], SkScalar tol) { SkScalar distance = compute_distance(points); return compute_pointCount(distance, tol); } @@ -123,6 +123,13 @@ static bool one_d_pe(const int* array, const unsigned int count, quadraticPointCount_CC(path, SkIntToScalar(1)); uint32_t estimatedCount = quadraticPointCount_EE(path, SkIntToScalar(1)); + + if (false) { // avoid bit rot, suppress warning + computedCount = + quadraticPointCount_EC(path, SkIntToScalar(1)); + estimatedCount = + quadraticPointCount_CE(path, SkIntToScalar(1)); + } // Allow estimated to be high by a factor of two, but no less than // the computed value. bool isAccurate = (estimatedCount >= computedCount) && diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 73bdef080..9d9903fb1 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -1375,7 +1375,7 @@ static void test_oval(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, path.isOval(NULL)); } -void TestPath(skiatest::Reporter* reporter) { +static void TestPath(skiatest::Reporter* reporter) { { SkSize size; size.fWidth = 3.4f; diff --git a/tests/PointTest.cpp b/tests/PointTest.cpp index db9c80344..efae223e0 100644 --- a/tests/PointTest.cpp +++ b/tests/PointTest.cpp @@ -34,7 +34,7 @@ static void test_Normalize(skiatest::Reporter* reporter, REPORTER_ASSERT(reporter, SkScalarNearlyEqual(newLength, SK_Scalar1)); } -void PointTest(skiatest::Reporter* reporter) { +static void PointTest(skiatest::Reporter* reporter) { test_length(reporter, SkIntToScalar(3), SkIntToScalar(4), SkIntToScalar(5)); test_length(reporter, SkFloatToScalar(0.6f), SkFloatToScalar(0.8f), SK_Scalar1); diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp index 4b3f671bc..536d0c5ae 100644 --- a/tests/ReadWriteAlphaTest.cpp +++ b/tests/ReadWriteAlphaTest.cpp @@ -12,7 +12,7 @@ static const int X_SIZE = 12; static const int Y_SIZE = 12; -void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContext* context) { +static void ReadWriteAlphaTest(skiatest::Reporter* reporter, GrContext* context) { #if SK_SCALAR_IS_FIXED // GPU device known not to work in the fixed pt build. diff --git a/tests/SortTest.cpp b/tests/SortTest.cpp index 166cff280..4a5631dae 100644 --- a/tests/SortTest.cpp +++ b/tests/SortTest.cpp @@ -10,7 +10,7 @@ #include "SkTSort.h" extern "C" { - int compare_int(const void* a, const void* b) { + static int compare_int(const void* a, const void* b) { return *(const int*)a - *(const int*)b; } } @@ -44,6 +44,9 @@ static void TestSort(skiatest::Reporter* reporter) { SkTHeapSort(array, count); check_sort(reporter, "Heap", array, count); } + if (false) { // avoid bit rot, suppress warning + compare_int(array, array); + } } // need tests for SkStrSearch diff --git a/tests/StringTest.cpp b/tests/StringTest.cpp index ebf700627..08bd2809c 100644 --- a/tests/StringTest.cpp +++ b/tests/StringTest.cpp @@ -28,7 +28,7 @@ va_end(args); \ } while (0) -void printfAnalog(char* buffer, int size, const char format[], ...) { +static void printfAnalog(char* buffer, int size, const char format[], ...) { ARGS_TO_BUFFER(format, buffer, size); } diff --git a/tests/XfermodeTest.cpp b/tests/XfermodeTest.cpp index 966da5190..a851b29df 100644 --- a/tests/XfermodeTest.cpp +++ b/tests/XfermodeTest.cpp @@ -9,7 +9,7 @@ #include "SkColor.h" #include "SkXfermode.h" -SkPMColor bogusXfermodeProc(SkPMColor src, SkPMColor dst) { +static SkPMColor bogusXfermodeProc(SkPMColor src, SkPMColor dst) { return 42; }