diff options
author | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-14 15:03:35 +0000 |
---|---|---|
committer | tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-14 15:03:35 +0000 |
commit | 8afae61a57f87e4a50578effce6c428031499301 (patch) | |
tree | ba9a4d4497a0416b932b384502e3b519af57e3a1 | |
parent | 9ed02b9da25a76ee4c73c1ab19c18b899a223a17 (diff) |
Clean up most clang warnings outside animator/
http://codereview.appspot.com/6464058/
git-svn-id: http://skia.googlecode.com/svn/trunk@5079 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | bench/ShaderMaskBench.cpp | 2 | ||||
-rw-r--r-- | bench/benchmain.cpp | 44 | ||||
-rw-r--r-- | src/core/SkBitmapProcState_procs.h | 1 | ||||
-rw-r--r-- | src/gpu/GrClipMaskManager.cpp | 29 | ||||
-rw-r--r-- | src/opts/SkBitmapProcState_opts_SSSE3.cpp | 2 | ||||
-rw-r--r-- | src/pipe/SkGPipeRead.cpp | 7 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 15 | ||||
-rw-r--r-- | tests/CanvasTest.cpp | 2 | ||||
-rw-r--r-- | tests/MathTest.cpp | 4 | ||||
-rw-r--r-- | tools/skdiff_main.cpp | 7 |
10 files changed, 59 insertions, 54 deletions
diff --git a/bench/ShaderMaskBench.cpp b/bench/ShaderMaskBench.cpp index bd31075797..0a68b44303 100644 --- a/bench/ShaderMaskBench.cpp +++ b/bench/ShaderMaskBench.cpp @@ -51,7 +51,7 @@ public: protected: virtual const char* onGetName() { - fName.printf("shadermask", SkScalarToFloat(fPaint.getTextSize())); + fName.printf("shadermask"); fName.appendf("_%s", fontQualityName(fPaint)); fName.appendf("_%02X", fPaint.getAlpha()); return fName.c_str(); diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp index fa43155da9..a91d348828 100644 --- a/bench/benchmain.cpp +++ b/bench/benchmain.cpp @@ -242,31 +242,29 @@ public: bool init(SkGLContext* glCtx, int width, int height) { GrContext* grCtx; - GrRenderTarget* rt; - if (glCtx->init(width, height)) { - GrPlatform3DContext ctx = - reinterpret_cast<GrPlatform3DContext>(glCtx->gl()); - grCtx = GrContext::Create(kOpenGL_Shaders_GrEngine, ctx); - if (NULL != grCtx) { - GrPlatformRenderTargetDesc desc; - desc.fConfig = kSkia8888_PM_GrPixelConfig; - desc.fWidth = width; - desc.fHeight = height; - desc.fStencilBits = 8; - desc.fRenderTargetHandle = glCtx->getFBOID(); - rt = grCtx->createPlatformRenderTarget(desc); - if (NULL == rt) { - grCtx->unref(); - return false; - } - } - } else { + if (!glCtx->init(width, height)) { return false; } - glCtx->ref(); - fGLContext.reset(glCtx); - fGrContext.reset(grCtx); - fRenderTarget.reset(rt); + GrPlatform3DContext ctx = + reinterpret_cast<GrPlatform3DContext>(glCtx->gl()); + grCtx = GrContext::Create(kOpenGL_Shaders_GrEngine, ctx); + if (NULL != grCtx) { + GrPlatformRenderTargetDesc desc; + desc.fConfig = kSkia8888_PM_GrPixelConfig; + desc.fWidth = width; + desc.fHeight = height; + desc.fStencilBits = 8; + desc.fRenderTargetHandle = glCtx->getFBOID(); + GrRenderTarget* rt = grCtx->createPlatformRenderTarget(desc); + if (NULL == rt) { + grCtx->unref(); + return false; + } + glCtx->ref(); + fGLContext.reset(glCtx); + fGrContext.reset(grCtx); + fRenderTarget.reset(rt); + } return true; } diff --git a/src/core/SkBitmapProcState_procs.h b/src/core/SkBitmapProcState_procs.h index 7b0588402d..6d17193cdd 100644 --- a/src/core/SkBitmapProcState_procs.h +++ b/src/core/SkBitmapProcState_procs.h @@ -341,3 +341,4 @@ static inline U8CPU Filter_8(unsigned x, unsigned y, #include "SkBitmapProcState_shaderproc.h" #undef NAME_WRAP + diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp index a424b02dfc..a1cd75b5f8 100644 --- a/src/gpu/GrClipMaskManager.cpp +++ b/src/gpu/GrClipMaskManager.cpp @@ -795,7 +795,7 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, // with the existing clip. for ( ; NULL != clip; clip = iter.next()) { GrPathFill fill; - bool fillInverted; + bool fillInverted = false; // enabled at bottom of loop drawState->disableState(GrGpu::kModifyStencilClip_StateBit); // if the target is MSAA then we want MSAA enabled when the clip is soft @@ -807,11 +807,10 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, } } - bool canRenderDirectToStencil; // can the clip element be drawn - // directly to the stencil buffer - // with a non-inverted fill rule - // without extra passes to - // resolve in/out status. + // Can the clip element be drawn directly to the stencil buffer + // with a non-inverted fill rule without extra passes to + // resolve in/out status? + bool canRenderDirectToStencil = false; SkRegion::Op op = clip->fOp; if (first) { @@ -831,16 +830,15 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, contains(*clip->fRect, devRTRect, oldClipData->fOrigin)) { continue; } - } else if (NULL != clip->fPath) { + } else { + GrAssert(NULL != clip->fPath); fill = get_path_fill(*clip->fPath); fillInverted = GrIsFillInverted(fill); fill = GrNonInvertedFill(fill); clipPath = clip->fPath; - pr = this->getContext()->getPathRenderer(*clipPath, - fill, fGpu, false, - true); + pr = this->getContext()->getPathRenderer(*clipPath, fill, fGpu, false, true); if (NULL == pr) { - fGpu->setClip(oldClipData); // restore to the original + fGpu->setClip(oldClipData); return false; } canRenderDirectToStencil = @@ -856,10 +854,11 @@ bool GrClipMaskManager::createStencilClipMask(const GrClipData& clipDataIn, // stencil bit used for clipping. canDrawDirectToClip = GrStencilSettings::GetClipPasses(op, - canRenderDirectToStencil, - clipBit, - fillInverted, - &passes, stencilSettings); + canRenderDirectToStencil, + clipBit, + fillInverted, + &passes, + stencilSettings); // draw the element to the client stencil bits if necessary if (!canDrawDirectToClip) { diff --git a/src/opts/SkBitmapProcState_opts_SSSE3.cpp b/src/opts/SkBitmapProcState_opts_SSSE3.cpp index 3027688c3b..e9dcc7f70d 100644 --- a/src/opts/SkBitmapProcState_opts_SSSE3.cpp +++ b/src/opts/SkBitmapProcState_opts_SSSE3.cpp @@ -415,7 +415,7 @@ void S32_generic_D32_filter_DX_SSSE3(const SkBitmapProcState& s, // (0, 0, 0, 0, 0, 0, 0, 0) const __m128i zero = _mm_setzero_si128(); - __m128i alpha; + __m128i alpha = _mm_setzero_si128(); if (has_alpha) // 8x(alpha) alpha = _mm_set1_epi16(s.fAlphaScale); diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp index e6013db49e..e485d500d1 100644 --- a/src/pipe/SkGPipeRead.cpp +++ b/src/pipe/SkGPipeRead.cpp @@ -645,7 +645,12 @@ static const ReadProc gReadTable[] = { /////////////////////////////////////////////////////////////////////////////// -SkGPipeState::SkGPipeState(): fReader(0), fFlags(0), fSharedHeap(NULL) {} +SkGPipeState::SkGPipeState() + : fReader(0) + , fSharedHeap(NULL) + , fFlags(0) { + +} SkGPipeState::~SkGPipeState() { fTypefaces.safeUnrefAll(); diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index d1db4e23a8..8573f885de 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -129,20 +129,21 @@ static void toString(const SkBitmap& bm, SkString* str) { } } -static void toString(const void* text, size_t len, SkPaint::TextEncoding enc, +static void toString(const void* text, size_t byteLen, SkPaint::TextEncoding enc, SkString* str) { + // FIXME: this code appears to be untested - and probably unused - and probably wrong switch (enc) { case SkPaint::kUTF8_TextEncoding: - str->printf("\"%.*s\"%s", SkMax32(len, 32), (const char*) text, - len > 32 ? "..." : ""); + str->printf("\"%.*s\"%s", SkMax32(byteLen, 32), (const char*) text, + byteLen > 32 ? "..." : ""); break; case SkPaint::kUTF16_TextEncoding: - str->printf("\"%.*S\"%s", SkMax32(len, 32), (const wchar_t*) text, - len > 64 ? "..." : ""); + str->printf("\"%.*S\"%s", SkMax32(byteLen, 32), (const wchar_t*) text, + byteLen > 64 ? "..." : ""); break; case SkPaint::kUTF32_TextEncoding: - str->printf("\"%.*S\"%s", SkMax32(len, 32), (const wchar_t*) text, - len > 128 ? "..." : ""); + str->printf("\"%.*S\"%s", SkMax32(byteLen, 32), (const wchar_t*) text, + byteLen > 128 ? "..." : ""); break; case SkPaint::kGlyphID_TextEncoding: str->set("<glyphs>"); diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 2e15ebb17b..1d8e3cd45f 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -478,7 +478,7 @@ static void SaveRestoreTestStep(SkCanvas* canvas, skiatest::Reporter* reporter, CanvasTestStep* testStep) { int baseSaveCount = canvas->getSaveCount(); - size_t n = canvas->save(); + int n = canvas->save(); REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount == n, testStep->assertMessage()); REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(), testStep->assertMessage()); diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp index e2e63c5da4..6f945dd79e 100644 --- a/tests/MathTest.cpp +++ b/tests/MathTest.cpp @@ -6,6 +6,7 @@ * found in the LICENSE file. */ #include "Test.h" +#include "SkFloatBits.h" #include "SkFloatingPoint.h" #include "SkMathPriv.h" #include "SkPoint.h" @@ -199,7 +200,8 @@ static void assert_float_equal(skiatest::Reporter* reporter, const char op[], float x, uint32_t ni, uint32_t si) { if (!equal_float_native_skia(x, ni, si)) { SkString desc; - desc.printf("%s float %g bits %x native %x skia %x\n", op, x, ni, si); + uint32_t xi = SkFloat2Bits(x); + desc.printf("%s float %g bits %x native %x skia %x\n", op, x, xi, ni, si); reporter->reportFailed(desc); } } diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp index 3fc18e7ad8..9c327dfab6 100644 --- a/tools/skdiff_main.cpp +++ b/tools/skdiff_main.cpp @@ -773,14 +773,13 @@ static void create_diff_images (DiffMetricProc dmp, drp = new DiffRecord(*baseFiles[i], basePath, comparisonPath); SkASSERT(kUnknown == drp->fResult); - SkData* baseFileBits; - SkData* comparisonFileBits; + SkData* baseFileBits = NULL; + SkData* comparisonFileBits = NULL; if (NULL == (baseFileBits = read_file(basePath.c_str()))) { SkDebugf("WARNING: couldn't read base file <%s>\n", basePath.c_str()); drp->fResult = kBaseMissing; - } else if (NULL == (comparisonFileBits = read_file( - comparisonPath.c_str()))) { + } else if (NULL == (comparisonFileBits = read_file(comparisonPath.c_str()))) { SkDebugf("WARNING: couldn't read comparison file <%s>\n", comparisonPath.c_str()); drp->fResult = kComparisonMissing; |