diff options
author | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-10-27 15:27:51 +0000 |
---|---|---|
committer | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-10-27 15:27:51 +0000 |
commit | 83a444602ec580a0040713eed588c245b4ae0ee9 (patch) | |
tree | 118af159669bc015ee8219a47065d6649a7e06d2 | |
parent | 71dd3e0359b1c1e09fea751cd58f1728e467e750 (diff) |
Remove warnings (trailing \, signed vs unsigned, parenthesization).
Convert some tabs into spaces.
git-svn-id: http://skia.googlecode.com/svn/trunk@2541 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | samplecode/SampleFuzz.cpp | 6 | ||||
-rw-r--r-- | src/core/SkBlitMask_D32.cpp | 2 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 134 | ||||
-rw-r--r-- | tests/BlurTest.cpp | 2 | ||||
-rw-r--r-- | tests/MatrixTest.cpp | 6 |
5 files changed, 76 insertions, 74 deletions
diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp index 02b2391be9..36149c391a 100644 --- a/samplecode/SampleFuzz.cpp +++ b/samplecode/SampleFuzz.cpp @@ -131,9 +131,11 @@ static void do_fuzz(SkCanvas* canvas) { case 2: { SkXfermode::Mode mode; switch (R(3)) { - case 0: mode = SkXfermode::kSrc_Mode; break; + case 0: mode = SkXfermode::kSrc_Mode; break; case 1: mode = SkXfermode::kXor_Mode; break; - case 2: mode = SkXfermode::kSrcOver_Mode; break; + case 2: + default: // silence warning + mode = SkXfermode::kSrcOver_Mode; break; } paint.setXfermodeMode(mode); } diff --git a/src/core/SkBlitMask_D32.cpp b/src/core/SkBlitMask_D32.cpp index d68d44302e..2eb5fb7b0c 100644 --- a/src/core/SkBlitMask_D32.cpp +++ b/src/core/SkBlitMask_D32.cpp @@ -115,7 +115,7 @@ static void blit_lcd16_row(SkPMColor dst[], const uint16_t src[], int dstG = SkGetPackedG32(d); int dstB = SkGetPackedB32(d); - // LCD blitting is only supported if the dst is known/required\ + // LCD blitting is only supported if the dst is known/required // to be opaque dst[i] = SkPackARGB32(0xFF, blend32(srcR, dstR, maskR), diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 83ccc9e73f..e7bcee5945 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1337,9 +1337,9 @@ static void D1G_NoBounder_RectClip(const SkDraw1Glyph& state, int left = SkFixedFloor(fx); int top = SkFixedFloor(fy); SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); - SkASSERT(NULL == state.fBounder); - SkASSERT(NULL == state.fClip && state.fAAClip || - state.fClip && NULL == state.fAAClip && state.fClip->isRect()); + SkASSERT(NULL == state.fBounder); + SkASSERT((NULL == state.fClip && state.fAAClip) || + (state.fClip && NULL == state.fAAClip && state.fClip->isRect())); left += glyph.fLeft; top += glyph.fTop; @@ -1347,42 +1347,42 @@ static void D1G_NoBounder_RectClip(const SkDraw1Glyph& state, int right = left + glyph.fWidth; int bottom = top + glyph.fHeight; - SkMask mask; - SkIRect storage; - SkIRect* bounds = &mask.fBounds; - - mask.fBounds.set(left, top, right, bottom); - - // this extra test is worth it, assuming that most of the time it succeeds - // since we can avoid writing to storage - if (!state.fClipBounds.containsNoEmptyCheck(left, top, right, bottom)) { - if (!storage.intersectNoEmptyCheck(mask.fBounds, state.fClipBounds)) - return; - bounds = &storage; - } - - uint8_t* aa = (uint8_t*)glyph.fImage; - if (NULL == aa) { - aa = (uint8_t*)state.fCache->findImage(glyph); - if (NULL == aa) { - return; // can't rasterize glyph + SkMask mask; + SkIRect storage; + SkIRect* bounds = &mask.fBounds; + + mask.fBounds.set(left, top, right, bottom); + + // this extra test is worth it, assuming that most of the time it succeeds + // since we can avoid writing to storage + if (!state.fClipBounds.containsNoEmptyCheck(left, top, right, bottom)) { + if (!storage.intersectNoEmptyCheck(mask.fBounds, state.fClipBounds)) + return; + bounds = &storage; + } + + uint8_t* aa = (uint8_t*)glyph.fImage; + if (NULL == aa) { + aa = (uint8_t*)state.fCache->findImage(glyph); + if (NULL == aa) { + return; // can't rasterize glyph } - } + } - mask.fRowBytes = glyph.rowBytes(); - mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); - mask.fImage = aa; - state.fBlitter->blitMask(mask, *bounds); + mask.fRowBytes = glyph.rowBytes(); + mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); + mask.fImage = aa; + state.fBlitter->blitMask(mask, *bounds); } static void D1G_NoBounder_RgnClip(const SkDraw1Glyph& state, SkFixed fx, SkFixed fy, - const SkGlyph& glyph) { + const SkGlyph& glyph) { int left = SkFixedFloor(fx); int top = SkFixedFloor(fy); SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); - SkASSERT(!state.fClip->isRect()); - SkASSERT(NULL == state.fBounder); + SkASSERT(!state.fClip->isRect()); + SkASSERT(NULL == state.fBounder); SkMask mask; @@ -1390,31 +1390,31 @@ static void D1G_NoBounder_RgnClip(const SkDraw1Glyph& state, top += glyph.fTop; mask.fBounds.set(left, top, left + glyph.fWidth, top + glyph.fHeight); - SkRegion::Cliperator clipper(*state.fClip, mask.fBounds); - - if (!clipper.done()) { - const SkIRect& cr = clipper.rect(); - const uint8_t* aa = (const uint8_t*)glyph.fImage; - if (NULL == aa) { - aa = (uint8_t*)state.fCache->findImage(glyph); - if (NULL == aa) { - return; + SkRegion::Cliperator clipper(*state.fClip, mask.fBounds); + + if (!clipper.done()) { + const SkIRect& cr = clipper.rect(); + const uint8_t* aa = (const uint8_t*)glyph.fImage; + if (NULL == aa) { + aa = (uint8_t*)state.fCache->findImage(glyph); + if (NULL == aa) { + return; } - } + } - mask.fRowBytes = glyph.rowBytes(); - mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); - mask.fImage = (uint8_t*)aa; - do { - state.fBlitter->blitMask(mask, cr); - clipper.next(); - } while (!clipper.done()); - } + mask.fRowBytes = glyph.rowBytes(); + mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); + mask.fImage = (uint8_t*)aa; + do { + state.fBlitter->blitMask(mask, cr); + clipper.next(); + } while (!clipper.done()); + } } static void D1G_Bounder(const SkDraw1Glyph& state, SkFixed fx, SkFixed fy, - const SkGlyph& glyph) { + const SkGlyph& glyph) { int left = SkFixedFloor(fx); int top = SkFixedFloor(fy); SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); @@ -1427,30 +1427,30 @@ static void D1G_Bounder(const SkDraw1Glyph& state, mask.fBounds.set(left, top, left + glyph.fWidth, top + glyph.fHeight); SkRegion::Cliperator clipper(*state.fClip, mask.fBounds); - if (!clipper.done()) { - const SkIRect& cr = clipper.rect(); - const uint8_t* aa = (const uint8_t*)glyph.fImage; - if (NULL == aa) { - aa = (uint8_t*)state.fCache->findImage(glyph); - if (NULL == aa) { - return; + if (!clipper.done()) { + const SkIRect& cr = clipper.rect(); + const uint8_t* aa = (const uint8_t*)glyph.fImage; + if (NULL == aa) { + aa = (uint8_t*)state.fCache->findImage(glyph); + if (NULL == aa) { + return; } - } + } // we need to pass the origin, which we approximate with our // (unadjusted) left,top coordinates (the caller called fixedfloor) - if (state.fBounder->doIRectGlyph(cr, + if (state.fBounder->doIRectGlyph(cr, left - glyph.fLeft, top - glyph.fTop, glyph)) { - mask.fRowBytes = glyph.rowBytes(); - mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); - mask.fImage = (uint8_t*)aa; - do { - state.fBlitter->blitMask(mask, cr); - clipper.next(); - } while (!clipper.done()); - } - } + mask.fRowBytes = glyph.rowBytes(); + mask.fFormat = static_cast<SkMask::Format>(glyph.fMaskFormat); + mask.fImage = (uint8_t*)aa; + do { + state.fBlitter->blitMask(mask, cr); + clipper.next(); + } while (!clipper.done()); + } + } } static void D1G_Bounder_AAClip(const SkDraw1Glyph& state, diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp index cdfa8d21cd..c0d16f8f3f 100644 --- a/tests/BlurTest.cpp +++ b/tests/BlurTest.cpp @@ -121,7 +121,7 @@ static void test_blur(skiatest::Reporter* reporter) { paint.setMaskFilter(filter); filter->unref(); - for (int test = 0; test < SK_ARRAY_COUNT(tests); ++test) { + for (size_t test = 0; test < SK_ARRAY_COUNT(tests); ++test) { SkPath path; tests[test].addPath(&path); SkPath strokedPath; diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 7bad9de9e9..c9a696c548 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -92,7 +92,7 @@ void test_matrix_max_stretch(skiatest::Reporter* reporter) { SkMatrix baseMats[] = {scale, rot90Scale, rotate, translate, perspX, perspY}; SkMatrix mats[2*SK_ARRAY_COUNT(baseMats)]; - for (int i = 0; i < SK_ARRAY_COUNT(baseMats); ++i) { + for (size_t i = 0; i < SK_ARRAY_COUNT(baseMats); ++i) { mats[i] = baseMats[i]; bool invertable = mats[i].invert(&mats[i + SK_ARRAY_COUNT(baseMats)]); REPORTER_ASSERT(reporter, invertable); @@ -125,7 +125,7 @@ void test_matrix_max_stretch(skiatest::Reporter* reporter) { static const SkScalar gMaxStretchTol = (97 * SK_Scalar1) / 100; SkScalar max = 0; SkVector vectors[1000]; - for (int i = 0; i < SK_ARRAY_COUNT(vectors); ++i) { + for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) { vectors[i].fX = rand.nextSScalar1(); vectors[i].fY = rand.nextSScalar1(); if (!vectors[i].normalize()) { @@ -134,7 +134,7 @@ void test_matrix_max_stretch(skiatest::Reporter* reporter) { } } mat.mapVectors(vectors, SK_ARRAY_COUNT(vectors)); - for (int i = 0; i < SK_ARRAY_COUNT(vectors); ++i) { + for (size_t i = 0; i < SK_ARRAY_COUNT(vectors); ++i) { SkScalar d = vectors[i].length(); REPORTER_ASSERT(reporter, SkScalarDiv(d, stretch) < gStretchTol); if (max < d) { |