From 9c4e5ac5b7d32151d4d8ab1fb7ed443b35eb1254 Mon Sep 17 00:00:00 2001 From: "jvanverth@google.com" Date: Mon, 7 Jan 2013 18:41:28 +0000 Subject: [PATCH] Cleaned up warnings in Windows build. git-svn-id: http://skia.googlecode.com/svn/trunk@7057 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/effects/SkBlurMask.cpp | 18 +++++++++--------- tools/PictureRenderer.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp index b430727f31..a44f439e6f 100644 --- a/src/effects/SkBlurMask.cpp +++ b/src/effects/SkBlurMask.cpp @@ -1060,13 +1060,13 @@ static float gaussian_integral( float x ) { float x2 = x*x; float x3 = x2*x; - if ( x > 0.5 ) { - return .5625 - ( x3 / 6 - 3 * x2 / 4 + 1.125 * x); + if ( x > 0.5f ) { + return 0.5625f - ( x3 / 6.0f - 3.0f * x2 * 0.25f + 1.125f * x); } - if ( x > -0.5 ) { - return 0.5 - (0.75 * x - x3 / 3); + if ( x > -0.5f ) { + return 0.5f - (0.75f * x - x3 / 3.0f); } - return 0.4375 + (-x3 / 6 - 3 * x2 / 4 - 1.125 * x); + return 0.4375f + (-x3 / 6.0f - 3.0f * x2 * 0.25f - 1.125f * x); } /* @@ -1083,7 +1083,7 @@ static float gaussian_integral( float x ) { */ static int compute_profile( SkScalar radius, unsigned int **profile_out ) { - int size = radius * 3 + 1; + int size = SkScalarFloorToInt(radius * 3 + 1); int center = size >> 1; unsigned int *profile = new unsigned int [size]; @@ -1123,7 +1123,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, if (margin) { margin->set( pad, pad ); } - dst->fBounds = SkIRect::MakeWH(src.width(), src.height()); + dst->fBounds = SkIRect::MakeWH(SkScalarFloorToInt(src.width()), SkScalarFloorToInt(src.height())); dst->fBounds.outset(pad, pad); dst->fRowBytes = dst->fBounds.width(); @@ -1135,8 +1135,8 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, return false; // too big to allocate, abort } - int sw = src.width(); - int sh = src.height(); + int sw = SkScalarFloorToInt(src.width()); + int sh = SkScalarFloorToInt(src.height()); uint8_t* dp = SkMask::AllocImage(dstSize); diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index 88e296c378..616613df50 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -522,8 +522,8 @@ bool TiledPictureRenderer::render(const SkString* path, SkBitmap** out) { } if (NULL != out) { if (fCanvas->readPixels(&bitmap, 0, 0)) { - bitmapCopySubset(bitmap, *out, fTileRects[i].left(), - fTileRects[i].top()); + bitmapCopySubset(bitmap, *out, SkScalarFloorToInt(fTileRects[i].left()), + SkScalarFloorToInt(fTileRects[i].top())); } else { success = false; } @@ -594,7 +594,7 @@ public: SkBitmap bitmap; if (fBitmap != NULL) { // All tiles are the same size. - setup_bitmap(&bitmap, fRects[0].width(), fRects[0].height()); + setup_bitmap(&bitmap, SkScalarFloorToInt(fRects[0].width()), SkScalarFloorToInt(fRects[0].height())); } for (int i = fStart; i < fEnd; i++) { @@ -608,8 +608,8 @@ public: if (fBitmap != NULL) { if (fCanvas->readPixels(&bitmap, 0, 0)) { SkAutoLockPixels alp(*fBitmap); - bitmapCopySubset(bitmap, fBitmap, fRects[i].left(), - fRects[i].top()); + bitmapCopySubset(bitmap, fBitmap, SkScalarFloorToInt(fRects[i].left()), + SkScalarFloorToInt(fRects[i].top())); } else { *fSuccess = false; // If one tile fails to read pixels, do not continue drawing the rest.