diff options
author | jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-20 19:02:34 +0000 |
---|---|---|
committer | jvanverth@google.com <jvanverth@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-20 19:02:34 +0000 |
commit | d98df1a3c468a2a7a5fff5efbf6dbdaf077d1abe (patch) | |
tree | 181dae4410ebf61eaf19812603e3e8a4b5d7c7f9 | |
parent | 1e1a24e2cae6a6b2536d158294c874300ef822b1 (diff) |
Fix compile errors in blur code on Windows.
Various typecasts to remove warnings and get this code building on Windows.
git-svn-id: http://skia.googlecode.com/svn/trunk@7797 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | gm/blurrect.cpp | 8 | ||||
-rw-r--r-- | src/effects/SkBlurMask.cpp | 14 |
2 files changed, 11 insertions, 11 deletions
diff --git a/gm/blurrect.cpp b/gm/blurrect.cpp index 52f177db8a..a6fc56dd4f 100644 --- a/gm/blurrect.cpp +++ b/gm/blurrect.cpp @@ -177,14 +177,14 @@ protected: r.setWH(SkIntToScalar(fRectWidth), SkIntToScalar(fRectHeight)); SkISize canvas_size = canvas->getDeviceSize(); - int center_x = (canvas_size.fWidth - r.width())/2; - int center_y = (canvas_size.fHeight - r.height())/2; + int center_x = (canvas_size.fWidth - (int)(r.width()))/2; + int center_y = (canvas_size.fHeight - (int)(r.height()))/2; SkMask mask; if (!this->makeMask(&mask, r)) { SkPaint paint; - r.offset( center_x, center_y ); + r.offset( SkIntToScalar(center_x), SkIntToScalar(center_y) ); canvas->drawRect(r,paint); return; } @@ -197,7 +197,7 @@ protected: center_x = (canvas_size.fWidth - mask.fBounds.width())/2; center_y = (canvas_size.fHeight - mask.fBounds.height())/2; - canvas->drawBitmap(bm, center_x, center_y, NULL); + canvas->drawBitmap(bm, SkIntToScalar(center_x), SkIntToScalar(center_y), NULL); } virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } diff --git a/src/effects/SkBlurMask.cpp b/src/effects/SkBlurMask.cpp index d220a5436e..d6184538de 100644 --- a/src/effects/SkBlurMask.cpp +++ b/src/effects/SkBlurMask.cpp @@ -1208,7 +1208,7 @@ static int compute_profile(SkScalar radius, unsigned int **profile_out) { profile[0] = 255; for (int x = 1 ; x < size ; ++x) { - float scaled_x = (center - x - .5) * invr; + float scaled_x = (center - x - .5f) * invr; float gi = gaussianIntegral(scaled_x); profile[x] = 255 - (uint8_t) (255.f * gi); } @@ -1243,7 +1243,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, float radius = SkScalarToFloat( SkScalarMul( provided_radius, kBlurRadiusFudgeFactor ) ); // adjust blur radius to match interpretation from boxfilter code - radius = (radius + .5) *2; + radius = (radius + .5f) *2.f; profile_size = compute_profile( radius, &profile ); @@ -1256,8 +1256,8 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, int shadow_left = -pad; int shadow_top = -pad; - int shadow_right = src.width() + pad; - int shadow_bottom = src.height() + pad; + int shadow_right = (int)(src.width()) + pad; + int shadow_bottom = (int)(src.height()) + pad; dst->fBounds.set(shadow_left, shadow_top, shadow_right, shadow_bottom); @@ -1296,7 +1296,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, horizontalScanline[x] = profile_lookup(profile, x, dstWidth, w); } else { float span = float(sw)/radius; - float giX = 1.5 - (x+.5)/radius; + float giX = 1.5f - (x+.5f)/radius; horizontalScanline[x] = (uint8_t) (255 * (gaussianIntegral(giX) - gaussianIntegral(giX + span))); } } @@ -1307,7 +1307,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, profile_y = profile_lookup(profile, y, dstHeight, h); } else { float span = float(sh)/radius; - float giY = 1.5 - (y+.5)/radius; + float giY = 1.5f - (y+.5f)/radius; profile_y = (uint8_t) (255 * (gaussianIntegral(giY) - gaussianIntegral(giY + span))); } @@ -1319,7 +1319,7 @@ bool SkBlurMask::BlurRect(SkMask *dst, const SkRect &src, if (style == kInner_Style) { // now we allocate the "real" dst, mirror the size of src - size_t srcSize = src.width() * src.height(); + size_t srcSize = (size_t)(src.width() * src.height()); if (0 == srcSize) { return false; // too big to allocate, abort } |