aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:09:34 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-06 12:09:34 +0000
commit803eceb6afd13f07416df0b4a9bb714e9370f081 (patch)
tree94cf7f5d543aec6cebe9ff0a7462283a80cca493
parent383d5d494992554cde776c8b5b359d30e431bc78 (diff)
fix warnings on Mac in src/core
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/6301046 git-svn-id: http://skia.googlecode.com/svn/trunk@4182 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--src/core/SkAAClip.cpp16
-rw-r--r--src/core/SkBitmapProcState_matrix.h18
-rw-r--r--src/core/SkBitmapProcState_sample.h15
-rw-r--r--src/core/SkBlitMask_D32.cpp5
-rw-r--r--src/core/SkConcaveToTriangles.cpp16
-rw-r--r--src/core/SkPath.cpp2
-rw-r--r--src/core/SkPixelRef.cpp2
-rw-r--r--src/core/SkPoint.cpp2
-rw-r--r--src/core/SkRegion.cpp2
-rw-r--r--src/core/SkScalerContext.cpp4
-rw-r--r--src/core/SkScan_AntiPath.cpp2
-rw-r--r--src/core/SkString.cpp2
12 files changed, 63 insertions, 23 deletions
diff --git a/src/core/SkAAClip.cpp b/src/core/SkAAClip.cpp
index fe0fb286dc..86c99d8c0c 100644
--- a/src/core/SkAAClip.cpp
+++ b/src/core/SkAAClip.cpp
@@ -1055,6 +1055,9 @@ public:
void validate() {
#ifdef SK_DEBUG
+ if (false) { // avoid bit rot, suppress warning
+ test_count_left_right_zeros();
+ }
int prevY = -1;
for (int i = 0; i < fRows.count(); ++i) {
const Row& row = fRows[i];
@@ -1324,12 +1327,6 @@ typedef void (*RowProc)(SkAAClip::Builder&, int bottom,
const uint8_t* rowA, const SkIRect& rectA,
const uint8_t* rowB, const SkIRect& rectB);
-static void sectRowProc(SkAAClip::Builder& builder, int bottom,
- const uint8_t* rowA, const SkIRect& rectA,
- const uint8_t* rowB, const SkIRect& rectB) {
-
-}
-
typedef U8CPU (*AlphaProc)(U8CPU alphaA, U8CPU alphaB);
static U8CPU sectAlphaProc(U8CPU alphaA, U8CPU alphaB) {
@@ -1434,6 +1431,7 @@ static void adjust_row(RowIter& iter, int& leftA, int& riteA, int rite) {
}
}
+#if 0 // UNUSED
static bool intersect(int& min, int& max, int boundsMin, int boundsMax) {
SkASSERT(min < max);
SkASSERT(boundsMin < boundsMax);
@@ -1448,6 +1446,7 @@ static bool intersect(int& min, int& max, int boundsMin, int boundsMax) {
}
return true;
}
+#endif
static void operatorX(SkAAClip::Builder& builder, int lastY,
RowIter& iterA, RowIter& iterB,
@@ -1975,8 +1974,8 @@ static inline uint16_t mergeOne(uint16_t value, unsigned alpha) {
unsigned g = SkGetPackedG16(value);
unsigned b = SkGetPackedB16(value);
return SkPackRGB16(SkMulDiv255Round(r, alpha),
- SkMulDiv255Round(r, alpha),
- SkMulDiv255Round(r, alpha));
+ SkMulDiv255Round(g, alpha),
+ SkMulDiv255Round(b, alpha));
}
static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) {
unsigned a = SkGetPackedA32(value);
@@ -1992,7 +1991,6 @@ static inline SkPMColor mergeOne(SkPMColor value, unsigned alpha) {
template <typename T> void mergeT(const T* SK_RESTRICT src, int srcN,
const uint8_t* SK_RESTRICT row, int rowN,
T* SK_RESTRICT dst) {
- SkDEBUGCODE(int accumulated = 0;)
for (;;) {
SkASSERT(rowN > 0);
SkASSERT(srcN > 0);
diff --git a/src/core/SkBitmapProcState_matrix.h b/src/core/SkBitmapProcState_matrix.h
index 0fe0c19459..5ea780e9b7 100644
--- a/src/core/SkBitmapProcState_matrix.h
+++ b/src/core/SkBitmapProcState_matrix.h
@@ -26,6 +26,22 @@
#define PREAMBLE_ARG_Y
#endif
+// declare functions externally to suppress warnings.
+void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
+ uint32_t xy[], int count, int x, int y);
+void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s,
+ uint32_t xy[], int count, int x, int y);
+void PERSP_NOFILTER_NAME(const SkBitmapProcState& s,
+ uint32_t* SK_RESTRICT xy,
+ int count, int x, int y);
+void SCALE_FILTER_NAME(const SkBitmapProcState& s,
+ uint32_t xy[], int count, int x, int y);
+void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
+ uint32_t xy[], int count, int x, int y);
+void PERSP_FILTER_NAME(const SkBitmapProcState& s,
+ uint32_t* SK_RESTRICT xy, int count,
+ int x, int y);
+
void SCALE_NOFILTER_NAME(const SkBitmapProcState& s,
uint32_t xy[], int count, int x, int y) {
SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
@@ -189,7 +205,7 @@ void SCALE_FILTER_NAME(const SkBitmapProcState& s,
if (dx > 0 &&
(unsigned)(fx >> 16) <= maxX &&
(unsigned)((fx + dx * (count - 1)) >> 16) < maxX) {
- decal_filter_scale(xy, fx, dx, count);
+ decal_filter_scale(xy, (SkFixed) fx, (SkFixed) dx, count);
} else
#endif
{
diff --git a/src/core/SkBitmapProcState_sample.h b/src/core/SkBitmapProcState_sample.h
index e6b587f912..7bd0080c43 100644
--- a/src/core/SkBitmapProcState_sample.h
+++ b/src/core/SkBitmapProcState_sample.h
@@ -23,6 +23,21 @@
#error "unsupported DSTSIZE"
#endif
+
+// declare functions externally to suppress warnings.
+void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
+ const uint32_t* SK_RESTRICT xy,
+ int count, DSTTYPE* SK_RESTRICT colors);
+void MAKENAME(_nofilter_DX)(const SkBitmapProcState& s,
+ const uint32_t* SK_RESTRICT xy,
+ int count, DSTTYPE* SK_RESTRICT colors);
+void MAKENAME(_filter_DX)(const SkBitmapProcState& s,
+ const uint32_t* SK_RESTRICT xy,
+ int count, DSTTYPE* SK_RESTRICT colors);
+void MAKENAME(_filter_DXDY)(const SkBitmapProcState& s,
+ const uint32_t* SK_RESTRICT xy,
+ int count, DSTTYPE* SK_RESTRICT colors);
+
void MAKENAME(_nofilter_DXDY)(const SkBitmapProcState& s,
const uint32_t* SK_RESTRICT xy,
int count, DSTTYPE* SK_RESTRICT colors) {
diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp
index c97e9e6747..6576acb837 100644
--- a/src/core/SkBlitMask_D32.cpp
+++ b/src/core/SkBlitMask_D32.cpp
@@ -353,7 +353,9 @@ static void A8_RowProc_Blend(SkPMColor* SK_RESTRICT dst,
static void A8_RowProc_Opaque(SkPMColor* SK_RESTRICT dst,
const uint8_t* SK_RESTRICT mask,
const SkPMColor* SK_RESTRICT src, int count) {
+#if 0 // suppress warning
const uint32_t rbmask = gMask_00FF00FF;
+#endif
for (int i = 0; i < count; ++i) {
int m = mask[i];
if (m) {
@@ -564,7 +566,8 @@ SkBlitMask::RowProc SkBlitMask::RowFactory(SkBitmap::Config config,
static const RowProc gProcs[] = {
// need X coordinate to handle BW
- NULL, NULL, //(RowProc)BW_RowProc_Blend, (RowProc)BW_RowProc_Opaque,
+ false ? (RowProc)BW_RowProc_Blend : NULL, // suppress unused warning
+ false ? (RowProc)BW_RowProc_Opaque : NULL, // suppress unused warning
(RowProc)A8_RowProc_Blend, (RowProc)A8_RowProc_Opaque,
(RowProc)LCD16_RowProc_Blend, (RowProc)LCD16_RowProc_Opaque,
(RowProc)LCD32_RowProc_Blend, (RowProc)LCD32_RowProc_Opaque,
diff --git a/src/core/SkConcaveToTriangles.cpp b/src/core/SkConcaveToTriangles.cpp
index 2ca6795f52..4821e69c4d 100644
--- a/src/core/SkConcaveToTriangles.cpp
+++ b/src/core/SkConcaveToTriangles.cpp
@@ -34,6 +34,7 @@
// - There is no need to use SkTDArray for everything. Use SkAutoTMalloc for
// everything else.
+#include "SkConcaveToTriangles.h"
#include "SkTDArray.h"
#include "SkGeometry.h"
#include "SkTSort.h"
@@ -420,7 +421,7 @@ public:
};
-bool operator<(VertexPtr &v0, VertexPtr &v1) {
+static bool operator<(VertexPtr &v0, VertexPtr &v1) {
// DebugPrintf("< %p %p\n", &v0, &v1);
if (v0.vt->point().fY < v1.vt->point().fY) return true;
if (v0.vt->point().fY > v1.vt->point().fY) return false;
@@ -429,14 +430,15 @@ bool operator<(VertexPtr &v0, VertexPtr &v1) {
}
-bool operator>(VertexPtr &v0, VertexPtr &v1) {
+#if 0 // UNUSED
+static bool operator>(VertexPtr &v0, VertexPtr &v1) {
// DebugPrintf("> %p %p\n", &v0, &v1);
if (v0.vt->point().fY > v1.vt->point().fY) return true;
if (v0.vt->point().fY < v1.vt->point().fY) return false;
if (v0.vt->point().fX > v1.vt->point().fX) return true;
else return false;
}
-
+#endif
static void SetVertexPoints(size_t numPts, const SkPoint *pt, Vertex *vt) {
for (; numPts-- != 0; ++pt, ++vt)
@@ -675,7 +677,7 @@ static void RemoveDegenerateTrapezoids(size_t numVt, Vertex *vt) {
// Enhance the polygon with trapezoids.
-bool ConvertPointsToVertices(size_t numPts, const SkPoint *pts, Vertex *vta) {
+static bool ConvertPointsToVertices(size_t numPts, const SkPoint *pts, Vertex *vta) {
DebugPrintf("ConvertPointsToVertices()\n");
// Clear everything.
@@ -835,7 +837,7 @@ static size_t CountVertices(const Vertex *first, const Vertex *last) {
}
-bool operator<(const SkPoint &p0, const SkPoint &p1) {
+static bool operator<(const SkPoint &p0, const SkPoint &p1) {
if (p0.fY < p1.fY) return true;
if (p0.fY > p1.fY) return false;
if (p0.fX < p1.fX) return true;
@@ -854,7 +856,7 @@ static void PrintLinkedVertices(size_t n, Vertex *vertices) {
// Triangulate an unimonotone chain.
-bool TriangulateMonotone(Vertex *first, Vertex *last,
+static bool TriangulateMonotone(Vertex *first, Vertex *last,
SkTDArray<SkPoint> *triangles) {
DebugPrintf("TriangulateMonotone()\n");
@@ -915,7 +917,7 @@ bool TriangulateMonotone(Vertex *first, Vertex *last,
// Split the polygon into sets of unimonotone chains, and eventually call
// TriangulateMonotone() to convert them into triangles.
-bool Triangulate(Vertex *first, Vertex *last, SkTDArray<SkPoint> *triangles) {
+static bool Triangulate(Vertex *first, Vertex *last, SkTDArray<SkPoint> *triangles) {
DebugPrintf("Triangulate()\n");
Vertex *currentVertex = first;
while (!currentVertex->done()) {
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 5f63651d6d..a9693c2f67 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -479,7 +479,6 @@ void SkPath::incReserve(U16CPU inc) {
void SkPath::moveTo(SkScalar x, SkScalar y) {
SkDEBUGCODE(this->validate();)
- int vc = fVerbs.count();
SkPoint* pt;
// remember our index
@@ -1206,7 +1205,6 @@ void SkPath::reversePathTo(const SkPath& path) {
void SkPath::reverseAddPath(const SkPath& src) {
this->incReserve(src.fPts.count());
- const SkPoint* startPts = src.fPts.begin();
const SkPoint* pts = src.fPts.end();
const uint8_t* startVerbs = src.fVerbs.begin();
const uint8_t* verbs = src.fVerbs.end();
diff --git a/src/core/SkPixelRef.cpp b/src/core/SkPixelRef.cpp
index 88ce76fb6a..310b74dbe8 100644
--- a/src/core/SkPixelRef.cpp
+++ b/src/core/SkPixelRef.cpp
@@ -19,7 +19,7 @@
SK_DECLARE_STATIC_MUTEX(gPixelRefMutex);
#endif
-SkBaseMutex* get_default_mutex() {
+static SkBaseMutex* get_default_mutex() {
#ifdef PIXELREF_MUTEX_RING_COUNT
// atomic_inc might be overkill here. It may be fine if once in a while
// we hit a race-condition and two subsequent calls get the same index...
diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp
index c51b7cabe1..488bacb3dd 100644
--- a/src/core/SkPoint.cpp
+++ b/src/core/SkPoint.cpp
@@ -110,7 +110,7 @@ SkScalar SkPoint::Normalize(SkPoint* pt) {
float mag2;
if (!isLengthNearlyZero(pt->fX, pt->fY, &mag2)) {
float mag = sk_float_sqrt(mag2);
- float scale = 1.0 / mag;
+ float scale = 1.0f / mag;
pt->fX = pt->fX * scale;
pt->fY = pt->fY * scale;
return mag;
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp
index fac948db14..e403b1956a 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -925,10 +925,12 @@ static int operate(const SkRegion::RunType a_runs[],
interval, but we can first trim off the const overhead of the initial TOP
value, plus the final BOTTOM + 2 sentinels.
*/
+#if 0 // UNUSED
static int count_to_intervals(int count) {
SkASSERT(count >= 6); // a single rect is 6 values
return (count - 4) >> 1;
}
+#endif
/* Given a number of intervals, what is the worst case representation of that
many intervals?
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index d47c314834..2cce8ab1c6 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -341,11 +341,14 @@ SK_ERROR:
glyph->fMaskFormat = fRec.fMaskFormat;
}
+#if 0 // UNUSED
static bool isLCD(const SkScalerContext::Rec& rec) {
return SkMask::kLCD16_Format == rec.fMaskFormat ||
SkMask::kLCD32_Format == rec.fMaskFormat;
}
+#endif
+#if 0 // UNUSED
static uint16_t a8_to_rgb565(unsigned a8) {
return SkPackRGB16(a8 >> 3, a8 >> 2, a8 >> 3);
}
@@ -368,6 +371,7 @@ static void copyToLCD16(const SkBitmap& src, const SkMask& dst) {
dstP = (uint16_t*)((char*)dstP + dstRB);
}
}
+#endif
#define SK_FREETYPE_LCD_LERP 160
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 914d813afc..153778e0a6 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -235,6 +235,7 @@ void SuperBlitter::blitH(int x, int y, int width) {
#endif
}
+#if 0 // UNUSED
static void set_left_rite_runs(SkAlphaRuns& runs, int ileft, U8CPU leftA,
int n, U8CPU riteA) {
SkASSERT(leftA <= 0xFF);
@@ -270,6 +271,7 @@ static void set_left_rite_runs(SkAlphaRuns& runs, int ileft, U8CPU leftA,
}
run[0] = 0;
}
+#endif
void SuperBlitter::blitRect(int x, int y, int width, int height) {
SkASSERT(width > 0);
diff --git a/src/core/SkString.cpp b/src/core/SkString.cpp
index 0e0318b078..85fecc9e04 100644
--- a/src/core/SkString.cpp
+++ b/src/core/SkString.cpp
@@ -101,7 +101,7 @@ char* SkStrAppendS64(char string[], int64_t dec, int minDigits) {
}
do {
- *--p = SkToU8('0' + dec % 10);
+ *--p = SkToU8('0' + (int32_t) (dec % 10));
dec /= 10;
minDigits--;
} while (dec != 0);