Fixed remaining clang compiler warnings

https://codereview.appspot.com/6865053/



git-svn-id: http://skia.googlecode.com/svn/trunk@6646 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2012-12-03 17:35:19 +00:00
parent 08cb7286c6
commit 93f0332418
10 changed files with 26 additions and 21 deletions

View File

@ -59,8 +59,8 @@ public:
fBitmap.eraseColor(SK_ColorBLACK); fBitmap.eraseColor(SK_ColorBLACK);
drawIntoBitmap(fBitmap); drawIntoBitmap(fBitmap);
fSrcR.set(0, 0, w, h); fSrcR.iset(0, 0, w, h);
fDstR.set(0, 0, w, h); fDstR.iset(0, 0, w, h);
} }
protected: protected:

View File

@ -94,9 +94,9 @@ static void make_3x3_bitmap(SkBitmap* bitmap) {
static const int gYSize = 3; static const int gYSize = 3;
SkColor textureData[gXSize][gYSize] = { SkColor textureData[gXSize][gYSize] = {
SK_ColorRED, SK_ColorWHITE, SK_ColorBLUE, { SK_ColorRED, SK_ColorWHITE, SK_ColorBLUE },
SK_ColorGREEN, SK_ColorBLACK, SK_ColorCYAN, { SK_ColorGREEN, SK_ColorBLACK, SK_ColorCYAN },
SK_ColorYELLOW, SK_ColorGRAY, SK_ColorMAGENTA { SK_ColorYELLOW, SK_ColorGRAY, SK_ColorMAGENTA }
}; };

View File

@ -81,7 +81,8 @@ protected:
for (int i = 0; i < REPEAT_LOOP; ++i) { for (int i = 0; i < REPEAT_LOOP; ++i) {
SkPath line, path; SkPath line, path;
line.moveTo(1, 2); line.lineTo(4 + i, 1); line.moveTo(SkIntToScalar(1), SkIntToScalar(2));
line.lineTo(SkIntToScalar(4 + i), SkIntToScalar(1));
paint.getFillPath(line, &path); paint.getFillPath(line, &path);
draw_fatpath(canvas, surface, &path, 1); draw_fatpath(canvas, surface, &path, 1);

View File

@ -123,11 +123,11 @@ protected:
int idx = 0; int idx = 0;
static const int kRectsPerRow = SkMax32(this->getISize().fWidth / kRectWidth, 1); static const int kRectsPerRow = SkMax32(this->getISize().fWidth / kRectWidth, 1);
for (size_t cfm = 0; cfm < SK_ARRAY_COUNT(modes); ++cfm) { for (size_t cfm = 0; cfm < SK_ARRAY_COUNT(modes); ++cfm) {
for (int cfc = 0; cfc < SK_ARRAY_COUNT(colors); ++cfc) { for (size_t cfc = 0; cfc < SK_ARRAY_COUNT(colors); ++cfc) {
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[cfc], SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[cfc],
modes[cfm])); modes[cfm]));
paint.setColorFilter(cf); paint.setColorFilter(cf);
for (int s = 0; s < SK_ARRAY_COUNT(shaders); ++s) { for (size_t s = 0; s < SK_ARRAY_COUNT(shaders); ++s) {
paint.setShader(shaders[s]); paint.setShader(shaders[s]);
bool hasShader = NULL == paint.getShader(); bool hasShader = NULL == paint.getShader();
int paintColorCnt = hasShader ? SK_ARRAY_COUNT(alphas) : SK_ARRAY_COUNT(colors); int paintColorCnt = hasShader ? SK_ARRAY_COUNT(alphas) : SK_ARRAY_COUNT(colors);
@ -146,7 +146,7 @@ protected:
} }
} }
for (int i = 0; i < SK_ARRAY_COUNT(shaders); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(shaders); ++i) {
SkSafeUnref(shaders[i]); SkSafeUnref(shaders[i]);
} }
} }

View File

@ -170,6 +170,8 @@ static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) {
case 2: case 2:
return SkGradientShader::CreateSweep(center.fX, center.fY, colors, NULL, SK_ARRAY_COUNT(colors)); return SkGradientShader::CreateSweep(center.fX, center.fY, colors, NULL, SK_ARRAY_COUNT(colors));
} }
return NULL;
} }
static SkShader* make_radial(SkShader::TileMode tx, SkShader::TileMode ty) { static SkShader* make_radial(SkShader::TileMode tx, SkShader::TileMode ty) {

View File

@ -10,6 +10,7 @@
class SkRunnable { class SkRunnable {
public: public:
virtual ~SkRunnable() {};
virtual void run() = 0; virtual void run() = 0;
}; };

View File

@ -417,7 +417,7 @@ GrEffect* ColorMatrixEffect::TestCreate(SkRandom* random,
GrContext*, GrContext*,
GrTexture* dummyTextures[2]) { GrTexture* dummyTextures[2]) {
SkColorMatrix colorMatrix; SkColorMatrix colorMatrix;
for (int i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) {
colorMatrix.fMat[i] = random->nextSScalar1(); colorMatrix.fMat[i] = random->nextSScalar1();
} }
return SkNEW_ARGS(ColorMatrixEffect, (colorMatrix)); return SkNEW_ARGS(ColorMatrixEffect, (colorMatrix));

View File

@ -102,7 +102,7 @@ void SkMatrix44::setColMajord(const double src[]) {
memcpy(dst, src, 16 * sizeof(double)); memcpy(dst, src, 16 * sizeof(double));
#elif defined SK_MSCALAR_IS_FLOAT #elif defined SK_MSCALAR_IS_FLOAT
for (int i = 0; i < 16; ++i) { for (int i = 0; i < 16; ++i) {
dst[i] = SkMScalarToDouble(src[i]); dst[i] = SkDoubleToMScalar(src[i]);
} }
#endif #endif
fIdentity = false; fIdentity = false;
@ -124,10 +124,10 @@ void SkMatrix44::setRowMajorf(const float src[]) {
void SkMatrix44::setRowMajord(const double src[]) { void SkMatrix44::setRowMajord(const double src[]) {
SkMScalar* dst = &fMat[0][0]; SkMScalar* dst = &fMat[0][0];
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
dst[0] = SkMScalarToDouble(src[0]); dst[0] = SkDoubleToMScalar(src[0]);
dst[4] = SkMScalarToDouble(src[1]); dst[4] = SkDoubleToMScalar(src[1]);
dst[8] = SkMScalarToDouble(src[2]); dst[8] = SkDoubleToMScalar(src[2]);
dst[12] = SkMScalarToDouble(src[3]); dst[12] = SkDoubleToMScalar(src[3]);
src += 4; src += 4;
dst += 1; dst += 1;
} }

View File

@ -98,7 +98,8 @@ static void test_matrix_recttorect(skiatest::Reporter* reporter) {
dst.fRight += SK_Scalar1; dst.fRight += SK_Scalar1;
matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit); matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
REPORTER_ASSERT(reporter, SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask == matrix.getType()); REPORTER_ASSERT(reporter,
(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask) == matrix.getType());
REPORTER_ASSERT(reporter, matrix.rectStaysRect()); REPORTER_ASSERT(reporter, matrix.rectStaysRect());
dst = src; dst = src;

View File

@ -136,7 +136,7 @@ static void test_round_rect_rects(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, SkRRect::kRect_Type == rr1.type()); REPORTER_ASSERT(reporter, SkRRect::kRect_Type == rr1.type());
r = rr1.rect(); r = rr1.rect();
REPORTER_ASSERT(reporter, rect == r); REPORTER_ASSERT(reporter, rect == r);
for (int i = 0; i < SK_ARRAY_COUNT(pts); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
REPORTER_ASSERT(reporter, isIn[i] == rr1.contains(pts[i].fX, pts[i].fY)); REPORTER_ASSERT(reporter, isIn[i] == rr1.contains(pts[i].fX, pts[i].fY));
} }
@ -149,7 +149,7 @@ static void test_round_rect_rects(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, SkRRect::kRect_Type == rr2.type()); REPORTER_ASSERT(reporter, SkRRect::kRect_Type == rr2.type());
r = rr2.rect(); r = rr2.rect();
REPORTER_ASSERT(reporter, rect == r); REPORTER_ASSERT(reporter, rect == r);
for (int i = 0; i < SK_ARRAY_COUNT(pts); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
REPORTER_ASSERT(reporter, isIn[i] == rr2.contains(pts[i].fX, pts[i].fY)); REPORTER_ASSERT(reporter, isIn[i] == rr2.contains(pts[i].fX, pts[i].fY));
} }
@ -195,7 +195,7 @@ static void test_round_rect_ovals(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, SkRRect::kOval_Type == rr1.type()); REPORTER_ASSERT(reporter, SkRRect::kOval_Type == rr1.type());
oval = rr1.rect(); oval = rr1.rect();
REPORTER_ASSERT(reporter, oval == rect); REPORTER_ASSERT(reporter, oval == rect);
for (int i = 0; i < SK_ARRAY_COUNT(pts); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
REPORTER_ASSERT(reporter, isIn[i] == rr1.contains(pts[i].fX, pts[i].fY)); REPORTER_ASSERT(reporter, isIn[i] == rr1.contains(pts[i].fX, pts[i].fY));
} }
} }
@ -230,7 +230,7 @@ static void test_round_rect_general(skiatest::Reporter* reporter) {
rr1.setRectXY(rect, 20, 20); rr1.setRectXY(rect, 20, 20);
REPORTER_ASSERT(reporter, SkRRect::kSimple_Type == rr1.type()); REPORTER_ASSERT(reporter, SkRRect::kSimple_Type == rr1.type());
for (int i = 0; i < SK_ARRAY_COUNT(pts); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
REPORTER_ASSERT(reporter, isIn[i] == rr1.contains(pts[i].fX, pts[i].fY)); REPORTER_ASSERT(reporter, isIn[i] == rr1.contains(pts[i].fX, pts[i].fY));
} }
@ -261,7 +261,7 @@ static void test_round_rect_general(skiatest::Reporter* reporter) {
rr2.setRectRadii(rect, radii); rr2.setRectRadii(rect, radii);
REPORTER_ASSERT(reporter, SkRRect::kComplex_Type == rr2.type()); REPORTER_ASSERT(reporter, SkRRect::kComplex_Type == rr2.type());
for (int i = 0; i < SK_ARRAY_COUNT(pts); ++i) { for (size_t i = 0; i < SK_ARRAY_COUNT(pts); ++i) {
REPORTER_ASSERT(reporter, isIn[i] == rr2.contains(pts2[i].fX, pts2[i].fY)); REPORTER_ASSERT(reporter, isIn[i] == rr2.contains(pts2[i].fX, pts2[i].fY));
} }
} }