diff options
author | 2009-01-15 14:38:33 +0000 | |
---|---|---|
committer | 2009-01-15 14:38:33 +0000 | |
commit | fc25abdabff76f913fb9d4f373418c10a1eca92b (patch) | |
tree | 9547b99990237c1b1ac1e68a72eadfaa8f4d0723 /src | |
parent | b50a60c463ae4e2475de8a421b0056b03335b28e (diff) |
fix warnings
git-svn-id: http://skia.googlecode.com/svn/trunk@68 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/Sk64.cpp | 2 | ||||
-rw-r--r-- | src/core/SkFP.h | 2 | ||||
-rw-r--r-- | src/core/SkGeometry.cpp | 4 | ||||
-rw-r--r-- | src/core/SkGraphics.cpp | 2 | ||||
-rw-r--r-- | src/core/SkMMapStream.cpp | 7 | ||||
-rw-r--r-- | src/core/SkMath.cpp | 10 | ||||
-rw-r--r-- | src/core/SkPaint.cpp | 20 | ||||
-rw-r--r-- | src/core/SkScalerContext.cpp | 11 | ||||
-rw-r--r-- | src/core/SkScan_Path.cpp | 2 | ||||
-rw-r--r-- | src/core/SkUtils.cpp | 2 | ||||
-rw-r--r-- | src/core/SkWriter32.cpp | 9 | ||||
-rw-r--r-- | src/core/SkXfermode.cpp | 4 | ||||
-rw-r--r-- | src/effects/SkGradientShader.cpp | 2 |
13 files changed, 25 insertions, 52 deletions
diff --git a/src/core/Sk64.cpp b/src/core/Sk64.cpp index 6013bd7411..2715d2326c 100644 --- a/src/core/Sk64.cpp +++ b/src/core/Sk64.cpp @@ -387,7 +387,7 @@ static void bool_table_test(const Sk64& a, const BoolTable& table) SkASSERT(!a.isZero() == !table.zero); SkASSERT(!a.isPos() == !table.pos); SkASSERT(!a.isNeg() == !table.neg); - SkASSERT(a.sign() == table.sign); + SkASSERT(a.getSign() == table.sign); } #ifdef SkLONGLONG diff --git a/src/core/SkFP.h b/src/core/SkFP.h index 6c0c52634e..5e25d22372 100644 --- a/src/core/SkFP.h +++ b/src/core/SkFP.h @@ -41,7 +41,7 @@ #define SkFPDivInt(a, n) ((a) / (n)) #define SkFPInvert(x) SkScalarInvert(x) #define SkFPSqrt(x) SkScalarSqrt(x) - #define SkFPCubeRoot(x) pow(x, 1.0f/3) + #define SkFPCubeRoot(x) static_cast<float>(pow(x, 0.33333333333)) #define SkFPLT(a, b) ((a) < (b)) #define SkFPLE(a, b) ((a) <= (b)) diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp index 4f22e92b88..7e2d424890 100644 --- a/src/core/SkGeometry.cpp +++ b/src/core/SkGeometry.cpp @@ -255,12 +255,12 @@ int SkFindQuadExtrema(SkScalar a, SkScalar b, SkScalar c, SkScalar tValue[1]) #endif } -static void flatten_double_quad_extrema(SkScalar coords[14]) +static inline void flatten_double_quad_extrema(SkScalar coords[14]) { coords[2] = coords[6] = coords[4]; } -static void force_quad_monotonic_in_y(SkPoint pts[3]) +static inline void force_quad_monotonic_in_y(SkPoint pts[3]) { // zap pts[1].fY to the nearest value SkScalar ab = SkScalarAbs(pts[0].fY - pts[1].fY); diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 64fbab90a1..2ad44cd602 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -228,6 +228,7 @@ int time_math() { return sum; } +#if 0 static float time_intToFloat() { const int repeat = 1000000; int i, n; @@ -266,6 +267,7 @@ static float time_intToFloat() { return sum; } +#endif void SkGraphics::Init(bool runUnitTests) { diff --git a/src/core/SkMMapStream.cpp b/src/core/SkMMapStream.cpp index 017bcaf597..78cb3f35ae 100644 --- a/src/core/SkMMapStream.cpp +++ b/src/core/SkMMapStream.cpp @@ -16,8 +16,8 @@ SkMMAPStream::SkMMAPStream(const char filename[]) return; } - off_t size = lseek(fildes, 0, SEEK_END); // find the file size - if (size == -1) + off_t offset = lseek(fildes, 0, SEEK_END); // find the file size + if (offset == -1) { SkDEBUGF(("---- failed to lseek(%s) for mmap stream error=%d\n", filename, errno)); close(fildes); @@ -25,6 +25,9 @@ SkMMAPStream::SkMMAPStream(const char filename[]) } (void)lseek(fildes, 0, SEEK_SET); // restore file offset to beginning + // to avoid a 64bit->32bit warning, I explicitly create a size_t size + size_t size = static_cast<size_t>(offset); + void* addr = mmap(NULL, size, PROT_READ, MAP_SHARED, fildes, 0); if (MAP_FAILED == addr) { diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp index c627d9b336..2655586e1a 100644 --- a/src/core/SkMath.cpp +++ b/src/core/SkMath.cpp @@ -140,7 +140,7 @@ SkFixed SkFixedMul_portable(SkFixed a, SkFixed b) { tmp.shiftRight(16); return tmp.fLo; #elif defined(SkLONGLONG) - return (SkLONGLONG)a * b >> 16; + return static_cast<SkFixed>((SkLONGLONG)a * b >> 16); #else int sa = SkExtractSign(a); int sb = SkExtractSign(b); @@ -165,7 +165,7 @@ SkFract SkFractMul_portable(SkFract a, SkFract b) { tmp.setMul(a, b); return tmp.getFract(); #elif defined(SkLONGLONG) - return (SkLONGLONG)a * b >> 30; + return static_cast<SkFract>((SkLONGLONG)a * b >> 30); #else int sa = SkExtractSign(a); int sb = SkExtractSign(b); @@ -550,7 +550,7 @@ SkFixed SkFixedLog(SkFixed x) { return SkCordicLog(x); } #include "SkRandom.h" -#ifdef SkLONGLONG +#if defined(SkLONGLONG) && defined(SK_SUPPORT_UNITTEST) static int symmetric_fixmul(int a, int b) { int sa = SkExtractSign(a); int sb = SkExtractSign(b); @@ -586,7 +586,7 @@ static void check_length(const SkPoint& p, SkScalar targetLen) { } #endif -#ifdef SK_CAN_USE_FLOAT +#if defined(SK_CAN_USE_FLOAT) && defined(SK_SUPPORT_UNITTEST) static float nextFloat(SkRandom& rand) { SkFloatIntUnion data; @@ -696,6 +696,7 @@ static void unittest_fastfloat() { #endif +#ifdef SK_SUPPORT_UNITTEST static void test_muldiv255() { for (int a = 0; a <= 255; a++) { for (int b = 0; b <= 255; b++) { @@ -716,6 +717,7 @@ static void test_muldiv255() { } } } +#endif void SkMath::UnitTest() { #ifdef SK_SUPPORT_UNITTEST diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index bb6b31eefc..691da41980 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -367,26 +367,6 @@ int SkPaint::textToGlyphs(const void* textData, size_t byteLength, /////////////////////////////////////////////////////////////////////////////// -static uint32_t sk_glyphID_next(const char** text) -{ - const uint16_t* glyph = (const uint16_t*)text; - int32_t value = *glyph; - glyph += 1; - *text = (const char*)glyph; - return value; -} - -static uint32_t sk_glyphID_prev(const char** text) -{ - const uint16_t* glyph = (const uint16_t*)text; - glyph -= 1; - int32_t value = *glyph; - *text = (const char*)glyph; - return value; -} - -////////////////////////////////////////////////////////////////////////////// - static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache, const char** text) { SkASSERT(cache != NULL); diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 854c4de8a3..f63e729389 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -182,17 +182,6 @@ SkScalerContext* SkScalerContext::getGlyphContext(const SkGlyph& glyph) const { return ctx; } -static int plus_minus_pin(int value, int max) { - SkASSERT(max >= 0); - - if (value > max) { - value = max; - } else if (value < -max) { - value = -max; - } - return value; -} - void SkScalerContext::getAdvance(SkGlyph* glyph) { // mark us as just having a valid advance glyph->fMaskFormat = MASK_FORMAT_JUST_ADVANCE; diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp index 8b589916d6..d8f779a32c 100644 --- a/src/core/SkScan_Path.cpp +++ b/src/core/SkScan_Path.cpp @@ -387,6 +387,7 @@ static SkEdge* sort_edges(SkEdge* list[], int count, SkEdge** last) return list[0]; } +#ifdef SK_DEBUG /* 'quick' computation of the max sized needed to allocated for our edgelist. */ @@ -422,6 +423,7 @@ static int worst_case_edge_count(const SkPath& path, size_t* storage) *storage = size; return edgeCount; } +#endif /* Much faster than worst_case_edge_count, but over estimates even more */ diff --git a/src/core/SkUtils.cpp b/src/core/SkUtils.cpp index 20f7ddc759..a4c6c16cd1 100644 --- a/src/core/SkUtils.cpp +++ b/src/core/SkUtils.cpp @@ -427,10 +427,12 @@ size_t SkUTF16_ToUTF8(const uint16_t utf16[], int numberOf16BitValues, char utf8 #include <stdlib.h> +#if 0 static int round_to_K(size_t bytes) { return (bytes + 512) >> 10; } +#endif SkAutoMemoryUsageProbe::SkAutoMemoryUsageProbe(const char label[]) : fLabel(label) diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp index 61d0051bcc..819803fbd3 100644 --- a/src/core/SkWriter32.cpp +++ b/src/core/SkWriter32.cpp @@ -37,15 +37,6 @@ struct SkWriter32::Block { } }; -static size_t compute_block_size(size_t currSize, size_t minSize) -{ - if (currSize < minSize) - currSize = minSize; - - currSize += (currSize >> 1); - return SkAlign4(currSize); -} - /////////////////////////////////////////////////////////////////////////////// SkWriter32::~SkWriter32() diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp index e8a202dc08..80bafcedc7 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -30,6 +30,7 @@ static SkPMColor SkFourByteInterp(SkPMColor src, SkPMColor dst, U8CPU alpha) { return SkPackARGB32(a, r, g, b); } +#if 0 // idea for higher precision blends in xfer procs (and slightly faster) // see DstATop as a probable caller static U8CPU mulmuldiv255round(U8CPU a, U8CPU b, U8CPU c, U8CPU d) { @@ -42,6 +43,7 @@ static U8CPU mulmuldiv255round(U8CPU a, U8CPU b, U8CPU c, U8CPU d) { SkASSERT(result <= 255); return result; } +#endif /////////////////////////////////////////////////////////////////////////////// @@ -778,7 +780,7 @@ bool SkPorterDuff::IsMode(SkXfermode* xfer, Mode* mode) { /////////////////////////////////////////////////////////////////////////////// -#ifdef SK_DEBUG +#ifdef SK_DEBUGx static void unit_test() { for (unsigned a = 0; a <= 255; a++) { for (unsigned c = 0; c <= a; c++) { diff --git a/src/effects/SkGradientShader.cpp b/src/effects/SkGradientShader.cpp index b0d91ee8c5..9b5d922ce9 100644 --- a/src/effects/SkGradientShader.cpp +++ b/src/effects/SkGradientShader.cpp @@ -608,7 +608,7 @@ private: }; // Return true if fx, fx+dx, fx+2*dx, ... is always in range -static bool no_need_for_clamp(int fx, int dx, int count) +static inline bool no_need_for_clamp(int fx, int dx, int count) { SkASSERT(count > 0); return (unsigned)((fx | (fx + (count - 1) * dx)) >> 8) <= 0xFF; |