fix warnings on Mac in src/effects
Fix these class of warnings:
- unused functions
- unused locals
- sign mismatch
- missing function prototypes
- missing newline at end of file
- 64 to 32 bit truncation
The changes prefer to link in dead code in the debug build
with 'if (false)' than to comment it out, but trivial cases
are commented out or sometimes deleted if it appears to be
a copy/paste error.
Review URL: https://codereview.appspot.com/6299049
git-svn-id: http://skia.googlecode.com/svn/trunk@4181 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index 45464c2..c999ce0 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -133,6 +133,7 @@
#endif
}
+#if 0 // UNUSED
static int32_t toDot8(SkScalar x) {
#ifdef SK_SCALAR_IS_FIXED
x += 1 << 7;
@@ -142,17 +143,18 @@
return (int32_t)(x * 256);
#endif
}
+#endif
SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2,
SkScalar k3, SkScalar k4) {
if (fitsInBits(k1, 8) && fitsInBits(k2, 16) &&
fitsInBits(k2, 16) && fitsInBits(k2, 24)) {
+#if 0 // UNUSED
int32_t i1 = toDot8(k1);
int32_t i2 = toDot8(k2);
int32_t i3 = toDot8(k3);
int32_t i4 = toDot8(k4);
-#if 0
if (i1) {
return SkNEW_ARGS(SkArithmeticMode_quad, (i1, i2, i3, i4));
}
diff --git a/src/effects/SkGradientShader.cpp b/src/effects/SkGradientShader.cpp
index 1ef6446..8203d60 100644
--- a/src/effects/SkGradientShader.cpp
+++ b/src/effects/SkGradientShader.cpp
@@ -2093,6 +2093,7 @@
const SkPoint fCenter;
};
+#ifndef SK_SCALAR_IS_FLOAT
#ifdef COMPUTE_SWEEP_TABLE
#define PI 3.14159265
static bool gSweepTableReady;
@@ -2129,12 +2130,14 @@
};
static const uint8_t* build_sweep_table() { return gSweepTable; }
#endif
+#endif
// divide numer/denom, with a bias of 6bits. Assumes numer <= denom
// and denom != 0. Since our table is 6bits big (+1), this is a nice fit.
// Same as (but faster than) SkFixedDiv(numer, denom) >> 10
//unsigned div_64(int numer, int denom);
+#ifndef SK_SCALAR_IS_FLOAT
static unsigned div_64(int numer, int denom) {
SkASSERT(numer <= denom);
SkASSERT(numer > 0);
@@ -2201,8 +2204,10 @@
}
return result;
}
+#endif
// Given x,y in the first quadrant, return 0..63 for the angle [0..90]
+#ifndef SK_SCALAR_IS_FLOAT
static unsigned atan_0_90(SkFixed y, SkFixed x) {
#ifdef SK_DEBUG
{
@@ -2256,6 +2261,7 @@
SkASSERT(result <= 63);
return result;
}
+#endif
// returns angle in a circle [0..2PI) -> [0..255]
#ifdef SK_SCALAR_IS_FLOAT
diff --git a/src/effects/SkTableMaskFilter.cpp b/src/effects/SkTableMaskFilter.cpp
index fed0c5d..43da55e 100644
--- a/src/effects/SkTableMaskFilter.cpp
+++ b/src/effects/SkTableMaskFilter.cpp
@@ -89,7 +89,7 @@
float x = 0;
for (int i = 0; i < 256; i++) {
- float ee = powf(x, g) * 255;
+ // float ee = powf(x, g) * 255;
table[i] = SkPin32(sk_float_round2int(powf(x, g) * 255), 0, 255);
x += dx;
}