From: tomhudson@google.com Date: Tue, 10 Apr 2012 19:14:48 +0000 (+0000) Subject: Clean up more Visual Studio warnings, including apparent bug in Arithmetic mode. X-Git-Tag: accepted/tizen/5.0/unified/20181102.025319~16436 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5efe0cb04961ef98fbe520ee732fbe50b4195ad3;p=platform%2Fupstream%2FlibSkiaSharp.git Clean up more Visual Studio warnings, including apparent bug in Arithmetic mode. git-svn-id: http://skia.googlecode.com/svn/trunk@3645 2bbb7eff-a529-9590-31e7-b0007b416f81 --- diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index a1d3826..13bc718 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -978,9 +978,9 @@ void SkCanvas::internalDrawDevice(SkDevice* srcDev, int x, int y, SkBitmap dst; const SkBitmap& src = srcDev->accessBitmap(false); if (filter->filterImage(&proxy, src, *iter.fMatrix, &dst, &pos)) { - SkPaint tmp(*paint); - tmp.setImageFilter(NULL); - dstDev->drawSprite(iter, dst, pos.x(), pos.y(), tmp); + SkPaint tmpUnfiltered(*paint); + tmpUnfiltered.setImageFilter(NULL); + dstDev->drawSprite(iter, dst, pos.x(), pos.y(), tmpUnfiltered); } } else { dstDev->drawDevice(iter, srcDev, pos.x(), pos.y(), *paint); @@ -1011,10 +1011,12 @@ void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y, if (filter && !iter.fDevice->canHandleImageFilter(filter)) { DeviceImageFilterProxy proxy(iter.fDevice); SkBitmap dst; - if (filter->filterImage(&proxy, bitmap, *iter.fMatrix, &dst, &pos)) { - SkPaint tmp(*paint); - tmp.setImageFilter(NULL); - iter.fDevice->drawSprite(iter, dst, pos.x(), pos.y(), tmp); + if (filter->filterImage(&proxy, bitmap, *iter.fMatrix, + &dst, &pos)) { + SkPaint tmpUnfiltered(*paint); + tmpUnfiltered.setImageFilter(NULL); + iter.fDevice->drawSprite(iter, dst, pos.x(), pos.y(), + tmpUnfiltered); } } else { iter.fDevice->drawSprite(iter, bitmap, pos.x(), pos.y(), *paint); diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp index de86827..77affa0 100644 --- a/src/core/SkGeometry.cpp +++ b/src/core/SkGeometry.cpp @@ -839,7 +839,6 @@ static SkScalar refine_cubic_root(const SkFP coeff[4], SkScalar root) * keeping the existing sorting, and return the new count */ static int collaps_duplicates(float array[], int count) { - int n = count; for (int n = count; n > 1; --n) { if (array[0] == array[1]) { for (int i = 1; i < n; ++i) { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index c2082c7..c51ddcc 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -171,11 +171,9 @@ SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src) { fReader.setMemory(buffer, size); } - int i; - fBitmapCount = src.fBitmapCount; fBitmaps = SkNEW_ARRAY(SkBitmap, fBitmapCount); - for (i = 0; i < fBitmapCount; i++) { + for (int i = 0; i < fBitmapCount; i++) { fBitmaps[i] = src.fBitmaps[i]; } @@ -185,7 +183,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src) { fPaintCount = src.fPaintCount; fPaints = SkNEW_ARRAY(SkPaint, fPaintCount); - for (i = 0; i < fPaintCount; i++) { + for (int i = 0; i < fPaintCount; i++) { fPaints[i] = src.fPaints[i]; } @@ -201,7 +199,7 @@ SkPicturePlayback::SkPicturePlayback(const SkPicturePlayback& src) { fRegionCount = src.fRegionCount; fRegions = SkNEW_ARRAY(SkRegion, fRegionCount); - for (i = 0; i < fRegionCount; i++) { + for (int i = 0; i < fRegionCount; i++) { fRegions[i] = src.fRegions[i]; } } @@ -429,11 +427,11 @@ SkPicturePlayback::SkPicturePlayback(SkStream* stream) { /* Now read the arrays chunk, and parse using a read buffer */ - uint32_t size = readTagSize(stream, PICT_ARRAYS_TAG); - SkAutoMalloc storage(size); - stream->read(storage.get(), size); + uint32_t tagSize = readTagSize(stream, PICT_ARRAYS_TAG); + SkAutoMalloc storage(tagSize); + stream->read(storage.get(), tagSize); - SkFlattenableReadBuffer buffer(storage.get(), size); + SkFlattenableReadBuffer buffer(storage.get(), tagSize); fFactoryPlayback->setupBuffer(buffer); fTFPlayback.setupBuffer(buffer); @@ -463,9 +461,10 @@ SkPicturePlayback::SkPicturePlayback(SkStream* stream) { fRegionCount = readTagSize(buffer, PICT_REGION_TAG); fRegions = SkNEW_ARRAY(SkRegion, fRegionCount); for (i = 0; i < fRegionCount; i++) { - uint32_t size = buffer.readU32(); - SkDEBUGCODE(uint32_t bytes =) fRegions[i].unflatten(buffer.skip(size)); - SkASSERT(size == bytes); + uint32_t bufferSize = buffer.readU32(); + SkDEBUGCODE(uint32_t bytes =) + fRegions[i].unflatten(buffer.skip(bufferSize)); + SkASSERT(bufferSize == bytes); } } diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp index cf651e1..45464c2 100644 --- a/src/effects/SkArithmeticMode.cpp +++ b/src/effects/SkArithmeticMode.cpp @@ -66,7 +66,7 @@ void SkArithmeticMode_scalar::xfer32(SkPMColor dst[], const SkPMColor src[], int a, r, g, b; - if (!srcNeedsUnpremul && !srcNeedsUnpremul) { + if (!srcNeedsUnpremul && !dstNeedsUnpremul) { a = arith(k1, k2, k3, k4, sa, sa); r = arith(k1, k2, k3, k4, SkGetPackedR32(sc), SkGetPackedR32(dc)); g = arith(k1, k2, k3, k4, SkGetPackedG32(sc), SkGetPackedG32(dc)); diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp index c688625..e2123e5 100644 --- a/src/effects/SkColorMatrixFilter.cpp +++ b/src/effects/SkColorMatrixFilter.cpp @@ -128,10 +128,7 @@ void SkColorMatrixFilter::setup(const SkScalar* SK_RESTRICT src) { } int32_t* array = fState.fArray; - - int i; SkFixed max = 0; - for (int i = 0; i < 20; i++) { SkFixed value = SkScalarToFixed(src[i]); array[i] = value; @@ -150,7 +147,7 @@ void SkColorMatrixFilter::setup(const SkScalar* SK_RESTRICT src) { if (bits < 9) { bits = 9 - bits; fState.fShift -= bits; - for (i = 0; i < 20; i++) { + for (int i = 0; i < 20; i++) { array[i] >>= bits; } one >>= bits;