Bug 793201 - Fix compiler warnings in Azure with MSVC r=bas
authorAndrew Quartey <andrew.quartey@gmail.com>
Fri, 28 Sep 2012 13:21:40 -0400
changeset 108631 96ef3b8bd9ed911a42f1c27cd23604edc846cda1
parent 108630 92530b29ac24905f1799c36dc1ac9dc44b6165ff
child 108632 e81ac71f110718b70c2a881df6d0a84513a17672
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersbas
bugs793201
milestone18.0a1
Bug 793201 - Fix compiler warnings in Azure with MSVC r=bas
gfx/2d/Blur.cpp
gfx/2d/Blur.h
gfx/2d/DrawTargetCairo.cpp
gfx/2d/DrawTargetD2D.cpp
gfx/2d/DrawTargetSkia.cpp
gfx/2d/PathCairo.cpp
gfx/2d/PathHelpers.h
gfx/2d/PathSkia.cpp
gfx/thebes/gfxBlur.cpp
--- a/gfx/2d/Blur.cpp
+++ b/gfx/2d/Blur.cpp
@@ -42,17 +42,17 @@ BoxBlurHorizontal(unsigned char* aInput,
 
     int32_t boxSize = aLeftLobe + aRightLobe + 1;
     bool skipRectCoversWholeRow = 0 >= aSkipRect.x &&
                                   aWidth <= aSkipRect.XMost();
     if (boxSize == 1) {
         memcpy(aOutput, aInput, aWidth*aRows);
         return;
     }
-    uint32_t reciprocal = (uint64_t(1) << 32) / boxSize;
+    uint32_t reciprocal = uint32_t((uint64_t(1) << 32) / boxSize);
 
     for (int32_t y = 0; y < aRows; y++) {
         // Check whether the skip rect intersects this row. If the skip
         // rect covers the whole surface in this row, we can avoid
         // this row entirely (and any others along the skip rect).
         bool inSkipRectY = y >= aSkipRect.y &&
                            y < aSkipRect.YMost();
         if (inSkipRectY && skipRectCoversWholeRow) {
@@ -120,17 +120,17 @@ BoxBlurVertical(unsigned char* aInput,
 
     int32_t boxSize = aTopLobe + aBottomLobe + 1;
     bool skipRectCoversWholeColumn = 0 >= aSkipRect.y &&
                                      aRows <= aSkipRect.YMost();
     if (boxSize == 1) {
         memcpy(aOutput, aInput, aWidth*aRows);
         return;
     }
-    uint32_t reciprocal = (uint64_t(1) << 32) / boxSize;
+    uint32_t reciprocal = uint32_t((uint64_t(1) << 32) / boxSize);
 
     for (int32_t x = 0; x < aWidth; x++) {
         bool inSkipRectX = x >= aSkipRect.x &&
                            x < aSkipRect.XMost();
         if (inSkipRectX && skipRectCoversWholeColumn) {
             x = aSkipRect.XMost() - 1;
             continue;
         }
@@ -344,29 +344,31 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& a
     mDirtyRect = *aDirtyRect;
     Rect requiredBlurArea = mDirtyRect.Intersect(rect);
     requiredBlurArea.Inflate(Size(aBlurRadius + aSpreadRadius));
     rect = requiredBlurArea.Intersect(rect);
   } else {
     mHasDirtyRect = false;
   }
 
-  mRect = IntRect(rect.x, rect.y, rect.width, rect.height);
+  mRect = IntRect(int32_t(rect.x), int32_t(rect.y),
+                  int32_t(rect.width), int32_t(rect.height));
   if (mRect.IsEmpty()) {
     return;
   }
 
   if (aSkipRect) {
     // If we get passed a skip rect, we can lower the amount of
     // blurring/spreading we need to do. We convert it to IntRect to avoid
     // expensive int<->float conversions if we were to use Rect instead.
     Rect skipRect = *aSkipRect;
     skipRect.RoundIn();
     skipRect.Deflate(Size(aBlurRadius + aSpreadRadius));
-    mSkipRect = IntRect(skipRect.x, skipRect.y, skipRect.width, skipRect.height);
+    mSkipRect = IntRect(int32_t(skipRect.x), int32_t(skipRect.y),
+                        int32_t(skipRect.width), int32_t(skipRect.height));
 
     mSkipRect = mSkipRect.Intersect(mRect);
     if (mSkipRect.IsEqualInterior(mRect))
       return;
 
     mSkipRect -= mRect.TopLeft();
   } else {
     mSkipRect = IntRect(0, 0, 0, 0);
@@ -384,17 +386,18 @@ AlphaBoxBlur::AlphaBoxBlur(const Rect& a
     }
   }
 }
 
 AlphaBoxBlur::AlphaBoxBlur(uint8_t* aData,
                            const Rect& aRect,
                            int32_t aStride,
                            float aSigma)
-  : mRect(aRect.x, aRect.y, aRect.width, aRect.height),
+  : mRect(int32_t(aRect.x), int32_t(aRect.y),
+          int32_t(aRect.width), int32_t(aRect.height)),
     mSpreadRadius(),
     mBlurRadius(CalculateBlurRadius(Point(aSigma, aSigma))),
     mData(aData),
     mFreeData(false),
     mStride(aStride)
 {
 }
 
@@ -497,17 +500,17 @@ AlphaBoxBlur::Blur()
  * Much of this, the 3 * sqrt(2 * pi) / 4, is the known value for
  * approximating a Gaussian using box blurs.  This yields quite a good
  * approximation for a Gaussian.  Then we multiply this by 1.5 since our
  * code wants the radius of the entire triple-box-blur kernel instead of
  * the diameter of an individual box blur.  For more details, see:
  *   http://www.w3.org/TR/SVG11/filters.html#feGaussianBlurElement
  *   https://bugzilla.mozilla.org/show_bug.cgi?id=590039#c19
  */
-static const Float GAUSSIAN_SCALE_FACTOR = (3 * sqrt(2 * M_PI) / 4) * 1.5;
+static const Float GAUSSIAN_SCALE_FACTOR = Float((3 * sqrt(2 * M_PI) / 4) * 1.5);
 
 IntSize
 AlphaBoxBlur::CalculateBlurRadius(const Point& aStd)
 {
     IntSize size(static_cast<int32_t>(floor(aStd.x * GAUSSIAN_SCALE_FACTOR + 0.5)),
                  static_cast<int32_t>(floor(aStd.y * GAUSSIAN_SCALE_FACTOR + 0.5)));
 
     return size;
--- a/gfx/2d/Blur.h
+++ b/gfx/2d/Blur.h
@@ -6,16 +6,20 @@
 #define MOZILLA_GFX_BLUR_H_
 
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/gfx/Point.h"
 
 namespace mozilla {
 namespace gfx {
 
+#ifdef _MSC_VER
+#pragma warning( disable : 4251 )
+#endif
+
 /**
  * Implementation of a triple box blur approximation of a Gaussian blur.
  *
  * A Gaussian blur is good for blurring because, when done independently
  * in the horizontal and vertical directions, it matches the result that
  * would be obtained using a different (rotated) set of axes.  A triple
  * box blur is a very close approximation of a Gaussian.
  *
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -398,19 +398,19 @@ DrawTargetCairo::DrawSurfaceWithShadow(S
                                        const Point &aOffset,
                                        Float aSigma,
                                        CompositionOp aOperator)
 {
   if (aSurface->GetType() != SURFACE_CAIRO) {
     return;
   }
 
-  Float width = aSurface->GetSize().width;
-  Float height = aSurface->GetSize().height;
- 
+  Float width = Float(aSurface->GetSize().width);
+  Float height = Float(aSurface->GetSize().height);
+
   SourceSurfaceCairo* source = static_cast<SourceSurfaceCairo*>(aSurface);
   cairo_surface_t* sourcesurf = source->GetSurface();
   cairo_surface_t* blursurf;
   cairo_surface_t* surf;
 
   // We only use the A8 surface for blurred shadows. Unblurred shadows can just
   // use the RGBA surface directly.
   if (cairo_surface_get_type(sourcesurf) == CAIRO_SURFACE_TYPE_TEE) {
--- a/gfx/2d/DrawTargetD2D.cpp
+++ b/gfx/2d/DrawTargetD2D.cpp
@@ -949,17 +949,17 @@ DrawTargetD2D::Mask(const Pattern &aSour
   layer = GetCachedLayer();
 
   rt->PushLayer(D2D1::LayerParameters(D2D1::InfiniteRect(), nullptr,
                                       D2D1_ANTIALIAS_MODE_PER_PRIMITIVE,
                                       D2D1::IdentityMatrix(),
                                       1.0f, maskBrush),
                 layer);
 
-  Rect rect(0, 0, mSize.width, mSize.height);
+  Rect rect(0, 0, (Float)mSize.width, (Float)mSize.height);
   Matrix mat = mTransform;
   mat.Invert();
   
   rt->FillRectangle(D2DRect(mat.TransformBounds(rect)), brush);
   PopCachedLayer(rt);
 
   FinalizeRTForOperation(aOptions.mCompositionOp, aSource, Rect(0, 0, (Float)mSize.width, (Float)mSize.height));
 }
@@ -1673,26 +1673,26 @@ DrawTargetD2D::GetClippedGeometry(IntRec
     pathRectIsAxisAligned = iter->mIsPixelAligned;
   }
 
   iter++;
   for (;iter != mPushedClips.end(); iter++) {
     // Do nothing but add it to the current clip bounds.
     if (!iter->mPath && iter->mIsPixelAligned) {
       mCurrentClipBounds.IntersectRect(mCurrentClipBounds,
-        IntRect(iter->mBounds.left, iter->mBounds.top,
+        IntRect(int32_t(iter->mBounds.left), int32_t(iter->mBounds.top),
                 int32_t(iter->mBounds.right - iter->mBounds.left),
                 int32_t(iter->mBounds.bottom - iter->mBounds.top)));
       continue;
     }
 
     if (!pathGeom) {
       if (pathRectIsAxisAligned) {
         mCurrentClipBounds.IntersectRect(mCurrentClipBounds,
-          IntRect(pathRect.left, pathRect.top,
+          IntRect(int32_t(pathRect.left), int32_t(pathRect.top),
                   int32_t(pathRect.right - pathRect.left),
                   int32_t(pathRect.bottom - pathRect.top)));
       }
       if (iter->mPath) {
         // See if pathRect needs to go into the path geometry.
         if (!pathRectIsAxisAligned) {
           pathGeom = ConvertRectToGeometry(pathRect);
         } else {
@@ -2022,19 +2022,20 @@ DrawTargetD2D::FillGlyphsManual(ScaledFo
   IntRect clipBoundsStorage;
   IntRect *clipBounds = nullptr;
 
   if (!mPushedClips.empty()) {
     clipBounds = &clipBoundsStorage;
     RefPtr<ID2D1Geometry> geom = GetClippedGeometry(clipBounds);
 
     RefPtr<ID2D1RectangleGeometry> rectGeom;
-    factory()->CreateRectangleGeometry(D2D1::RectF(rectBounds.x, rectBounds.y,
-                                                   rectBounds.width + rectBounds.x,
-                                                   rectBounds.height + rectBounds.y),
+    factory()->CreateRectangleGeometry(D2D1::RectF(Float(rectBounds.x),
+                                                   Float(rectBounds.y),
+                                                   Float(rectBounds.width + rectBounds.x),
+                                                   Float(rectBounds.height + rectBounds.y)),
                                        byRef(rectGeom));
 
     D2D1_GEOMETRY_RELATION relation;
     if (FAILED(geom->CompareWithGeometry(rectGeom, D2D1::IdentityMatrix(), &relation)) ||
         relation != D2D1_GEOMETRY_RELATION_CONTAINS ) {
       isMasking = true;
     }        
   }
@@ -2427,25 +2428,25 @@ DrawTargetD2D::CreatePartialBitmapForSur
 
   Matrix transform = mTransform;
   Matrix invTransform = transform = aMatrix * transform;
   if (!invTransform.Invert()) {
     // Singular transform, nothing to be drawn.
     return nullptr;
   }
 
-  Rect rect(0, 0, mSize.width, mSize.height);
+  Rect rect(0, 0, Float(mSize.width), Float(mSize.height));
 
   // Calculate the rectangle of the source mapped to our surface.
   rect = invTransform.TransformBounds(rect);
   rect.RoundOut();
 
   IntSize size = aSurface->GetSize();
 
-  Rect uploadRect(0, 0, size.width, size.height);
+  Rect uploadRect(0, 0, Float(size.width), Float(size.height));
 
   // Limit the uploadRect as much as possible without supporting discontiguous uploads 
   //
   //                               region we will paint from
   //   uploadRect
   //   .---------------.              .---------------.         resulting uploadRect
   //   |               |rect          |               |
   //   |          .---------.         .----.     .----.          .---------------.
@@ -2498,25 +2499,27 @@ DrawTargetD2D::CreatePartialBitmapForSur
       // This shouldn't actually happen in practice!
       MOZ_ASSERT(false);
       return nullptr;
     }
 
     ImageHalfScaler scaler(aSurface->GetData(), stride, size);
 
     // Calculate the maximum width/height of the image post transform.
-    Point topRight = transform * Point(size.width, 0);
+    Point topRight = transform * Point(Float(size.width), 0);
     Point topLeft = transform * Point(0, 0);
-    Point bottomRight = transform * Point(size.width, size.height);
-    Point bottomLeft = transform * Point(0, size.height);
+    Point bottomRight = transform * Point(Float(size.width), Float(size.height));
+    Point bottomLeft = transform * Point(0, Float(size.height));
     
     IntSize scaleSize;
 
-    scaleSize.width = max(Distance(topRight, topLeft), Distance(bottomRight, bottomLeft));
-    scaleSize.height = max(Distance(topRight, bottomRight), Distance(topLeft, bottomLeft));
+    scaleSize.width = int32_t(max(Distance(topRight, topLeft),
+                                  Distance(bottomRight, bottomLeft)));
+    scaleSize.height = int32_t(max(Distance(topRight, bottomRight),
+                                   Distance(topLeft, bottomLeft)));
 
     if (unsigned(scaleSize.width) > mRT->GetMaximumBitmapSize()) {
       // Ok, in this case we'd really want a downscale of a part of the bitmap,
       // perhaps we can do this later but for simplicity let's do something
       // different here and assume it's good enough, this should be rare!
       scaleSize.width = 4095;
     }
     if (unsigned(scaleSize.height) > mRT->GetMaximumBitmapSize()) {
@@ -2527,17 +2530,18 @@ DrawTargetD2D::CreatePartialBitmapForSur
 
     IntSize newSize = scaler.GetSize();
     
     mRT->CreateBitmap(D2D1::SizeU(newSize.width, newSize.height),
                       scaler.GetScaledData(), scaler.GetStride(),
                       D2D1::BitmapProperties(D2DPixelFormat(aSurface->GetFormat())),
                       byRef(bitmap));
 
-    aMatrix.Scale(size.width / newSize.width, size.height / newSize.height);
+    aMatrix.Scale(Float(size.width / newSize.width),
+                  Float(size.height / newSize.height));
     return bitmap;
   }
 }
 
 void
 DrawTargetD2D::SetupEffectForRadialGradient(const RadialGradientPattern *aPattern)
 {
   mPrivateData->mEffect->GetTechniqueByName("SampleRadialGradient")->GetPassByIndex(0)->Apply(0);
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -27,17 +27,18 @@
 #endif
 
 namespace mozilla {
 namespace gfx {
 
 SkColor ColorToSkColor(const Color &color, Float aAlpha)
 {
   //XXX: do a better job converting to int
-  return SkColorSetARGB(color.a*aAlpha*255.0, color.r*255.0, color.g*255.0, color.b*255.0);
+  return SkColorSetARGB(U8CPU(color.a*aAlpha*255.0), U8CPU(color.r*255.0),
+                        U8CPU(color.g*255.0), U8CPU(color.b*255.0));
 }
 
 class GradientStopsSkia : public GradientStops
 {
 public:
   GradientStopsSkia(const std::vector<GradientStop>& aStops, uint32_t aNumStops, ExtendMode aExtendMode)
     : mCount(aNumStops)
     , mExtendMode(aExtendMode)
@@ -126,17 +127,18 @@ IntRectToSkRect(const IntRect& aRect)
 {
   return SkRect::MakeXYWH(SkIntToScalar(aRect.x), SkIntToScalar(aRect.y), 
                           SkIntToScalar(aRect.width), SkIntToScalar(aRect.height));
 }
 
 SkIRect
 RectToSkIRect(const Rect& aRect)
 {
-  return SkIRect::MakeXYWH(aRect.x, aRect.y, aRect.width, aRect.height);
+  return SkIRect::MakeXYWH(int32_t(aRect.x), int32_t(aRect.y),
+                           int32_t(aRect.width), int32_t(aRect.height));
 }
 
 SkIRect
 IntRectToSkIRect(const IntRect& aRect)
 {
   return SkIRect::MakeXYWH(aRect.x, aRect.y, aRect.width, aRect.height);
 }
 
@@ -304,22 +306,22 @@ struct AutoPaintSetup {
     
     // TODO: We could skip the temporary for operator_source and just
     // clear the clip rect. The other operators would be harder
     // but could be worth it to skip pushing a group.
     if (!IsOperatorBoundByMask(aOptions.mCompositionOp)) {
       mPaint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
       SkPaint temp;
       temp.setXfermodeMode(GfxOpToSkiaOp(aOptions.mCompositionOp));
-      temp.setAlpha(aOptions.mAlpha*255);
+      temp.setAlpha(U8CPU(aOptions.mAlpha*255));
       //TODO: Get a rect here
       mCanvas->saveLayer(nullptr, &temp);
       mNeedsRestore = true;
     } else {
-      mPaint.setAlpha(aOptions.mAlpha*255.0);
+      mPaint.setAlpha(U8CPU(aOptions.mAlpha*255.0));
       mAlpha = aOptions.mAlpha;
     }
     mPaint.setFilterBitmap(true);
   }
 
   // TODO: Maybe add an operator overload to access this easier?
   SkPaint mPaint;
   bool mNeedsRestore;
@@ -420,17 +422,18 @@ DrawTargetSkia::DrawSurfaceWithShadow(So
   raster->addLayer(maskPaint, 0, 0);
   
   SkPaint paint;
   paint.setAntiAlias(true);
   SkSafeUnref(paint.setRasterizer(raster));
   paint.setXfermodeMode(GfxOpToSkiaOp(aOperator));
   SkSafeUnref(paint.setLooper(dl));
 
-  SkRect rect = RectToSkRect(Rect(aDest.x, aDest.y, bitmap.width(), bitmap.height()));
+  SkRect rect = RectToSkRect(Rect(Float(aDest.x), Float(aDest.y),
+                                  Float(bitmap.width()), Float(bitmap.height())));
   mCanvas->drawRect(rect, paint);
   mCanvas->restore();
 }
 
 void
 DrawTargetSkia::FillRect(const Rect &aRect,
                          const Pattern &aPattern,
                          const DrawOptions &aOptions)
@@ -565,17 +568,17 @@ DrawTargetSkia::Mask(const Pattern &aSou
   SkLayerRasterizer *raster = new SkLayerRasterizer();
   raster->addLayer(maskPaint);
   SkSafeUnref(paint.mPaint.setRasterizer(raster));
 
   // Skia only uses the mask rasterizer when we are drawing a path/rect.
   // Take our destination bounds and convert them into user space to use
   // as the path to draw.
   SkPath path;
-  path.addRect(SkRect::MakeWH(mSize.width, mSize.height));
+  path.addRect(SkRect::MakeWH(SkScalar(mSize.width), SkScalar(mSize.height)));
  
   Matrix temp = mTransform;
   temp.Invert();
   SkMatrix mat;
   GfxMatrixToSkiaMatrix(temp, mat);
   path.transform(mat);
 
   mCanvas->drawPath(path, paint.mPaint);
--- a/gfx/2d/PathCairo.cpp
+++ b/gfx/2d/PathCairo.cpp
@@ -191,17 +191,17 @@ PathBuilderCairo::Arc(const Point &aOrig
 }
 
 Point
 PathBuilderCairo::CurrentPoint() const
 {
   CairoTempMatrix tempMatrix(*mPathContext, mTransform);
   double x, y;
   cairo_get_current_point(*mPathContext, &x, &y);
-  return Point(x, y);
+  return Point((Float)x, (Float)y);
 }
 
 TemporaryRef<Path>
 PathBuilderCairo::Finish()
 {
   return new PathCairo(mPathContext, mTransform, mFillRule);
 }
 
@@ -266,32 +266,32 @@ PathCairo::ContainsPoint(const Point &aP
 Rect
 PathCairo::GetBounds(const Matrix &aTransform) const
 {
   CairoTempMatrix(*mPathContext, mTransform);
 
   double x1, y1, x2, y2;
 
   cairo_path_extents(*mPathContext, &x1, &y1, &x2, &y2);
-  Rect bounds(x1, y1, x2 - x1, y2 - y1);
+  Rect bounds(Float(x1), Float(y1), Float(x2 - x1), Float(y2 - y1));
   return aTransform.TransformBounds(bounds);
 }
 
 Rect
 PathCairo::GetStrokedBounds(const StrokeOptions &aStrokeOptions,
                             const Matrix &aTransform) const
 {
   CairoTempMatrix(*mPathContext, mTransform);
 
   double x1, y1, x2, y2;
 
   SetCairoStrokeOptions(*mPathContext, aStrokeOptions);
 
   cairo_stroke_extents(*mPathContext, &x1, &y1, &x2, &y2);
-  Rect bounds(x1, y1, x2 - x1, y2 - y1);
+  Rect bounds((Float)x1, (Float)y1, (Float)(x2 - x1), (Float)(y2 - y1));
   return aTransform.TransformBounds(bounds);
 }
 
 TemporaryRef<CairoPathContext>
 PathCairo::GetPathContext()
 {
   return mPathContext;
 }
--- a/gfx/2d/PathHelpers.h
+++ b/gfx/2d/PathHelpers.h
@@ -11,77 +11,77 @@
 
 namespace mozilla {
 namespace gfx {
 
 template <typename T>
 void ArcToBezier(T* aSink, const Point &aOrigin, float aRadius, float aStartAngle,
                  float aEndAngle, bool aAntiClockwise)
 {
-  Point startPoint(aOrigin.x + cos(aStartAngle) * aRadius, 
-                   aOrigin.y + sin(aStartAngle) * aRadius); 
-  
-  aSink->LineTo(startPoint); 
+  Point startPoint(aOrigin.x + cos(aStartAngle) * aRadius,
+                   aOrigin.y + sin(aStartAngle) * aRadius);
 
-  // Clockwise we always sweep from the smaller to the larger angle, ccw 
+  aSink->LineTo(startPoint);
+
+  // Clockwise we always sweep from the smaller to the larger angle, ccw
   // it's vice versa.
   if (!aAntiClockwise && (aEndAngle < aStartAngle)) {
-    Float correction = ceil((aStartAngle - aEndAngle) / (2.0f * M_PI));
-    aEndAngle += correction * 2.0f * M_PI;
+    Float correction = Float(ceil((aStartAngle - aEndAngle) / (2.0f * M_PI)));
+    aEndAngle += float(correction * 2.0f * M_PI);
   } else if (aAntiClockwise && (aStartAngle < aEndAngle)) {
-    Float correction = ceil((aEndAngle - aStartAngle) / (2.0f * M_PI));
-    aStartAngle += correction * 2.0f * M_PI;
+    Float correction = (Float)ceil((aEndAngle - aStartAngle) / (2.0f * M_PI));
+    aStartAngle += float(correction * 2.0f * M_PI);
   }
-  
+
   // Sweeping more than 2 * pi is a full circle.
   if (!aAntiClockwise && (aEndAngle - aStartAngle > 2 * M_PI)) {
-    aEndAngle = aStartAngle + 2.0f * M_PI;
+    aEndAngle = float(aStartAngle + 2.0f * M_PI);
   } else if (aAntiClockwise && (aStartAngle - aEndAngle > 2.0f * M_PI)) {
-    aEndAngle = aStartAngle - 2.0f * M_PI;
+    aEndAngle = float(aStartAngle - 2.0f * M_PI);
   }
 
   // Calculate the total arc we're going to sweep.
   Float arcSweepLeft = fabs(aEndAngle - aStartAngle);
-  
+
   Float sweepDirection = aAntiClockwise ? -1.0f : 1.0f;
-  
+
   Float currentStartAngle = aStartAngle;
-  
+
   while (arcSweepLeft > 0) {
     // We guarantee here the current point is the start point of the next
     // curve segment.
     Float currentEndAngle;
-    
+
     if (arcSweepLeft > M_PI / 2.0f) {
-      currentEndAngle = currentStartAngle + M_PI / 2.0f * sweepDirection;                                                               
+      currentEndAngle = Float(currentStartAngle + M_PI / 2.0f * sweepDirection);
     } else {
       currentEndAngle = currentStartAngle + arcSweepLeft * sweepDirection;
     }
-    
+
     Point currentStartPoint(aOrigin.x + cos(currentStartAngle) * aRadius,
                             aOrigin.y + sin(currentStartAngle) * aRadius);
     Point currentEndPoint(aOrigin.x + cos(currentEndAngle) * aRadius,
                           aOrigin.y + sin(currentEndAngle) * aRadius);
-    
+
     // Calculate kappa constant for partial curve. The sign of angle in the
-    // tangent will actually ensure this is negative for a counter clockwise                                                            
+    // tangent will actually ensure this is negative for a counter clockwise
     // sweep, so changing signs later isn't needed.
     Float kappa = (4.0f / 3.0f) * tan((currentEndAngle - currentStartAngle) / 4.0f) * aRadius;
-    
+
     Point tangentStart(-sin(currentStartAngle), cos(currentStartAngle));
     Point cp1 = currentStartPoint;
     cp1 += tangentStart * kappa;
-    
+
     Point revTangentEnd(sin(currentEndAngle), -cos(currentEndAngle));
     Point cp2 = currentEndPoint;
     cp2 += revTangentEnd * kappa;
-    
+
     aSink->BezierTo(cp1, cp2, currentEndPoint);
-    
-    arcSweepLeft -= M_PI / 2.0f;
+
+    arcSweepLeft -= Float(M_PI / 2.0f);
     currentStartAngle = currentEndAngle;
   }
 }
 
 }
 }
 
 #endif /* MOZILLA_GFX_PATHHELPERS_H_ */
--- a/gfx/2d/PathSkia.cpp
+++ b/gfx/2d/PathSkia.cpp
@@ -132,18 +132,20 @@ PathSkia::ContainsPoint(const Point &aPo
   Rect bounds = GetBounds(aTransform);
 
   if (aPoint.x < bounds.x || aPoint.y < bounds.y ||
       aPoint.x > bounds.XMost() || aPoint.y > bounds.YMost()) {
     return false;
   }
 
   SkRegion pointRect;
-  pointRect.setRect(SkFloatToScalar(transformed.x - 1), SkFloatToScalar(transformed.y - 1), 
-                    SkFloatToScalar(transformed.x + 1), SkFloatToScalar(transformed.y + 1));
+  pointRect.setRect(int32_t(SkFloatToScalar(transformed.x - 1)),
+                    int32_t(SkFloatToScalar(transformed.y - 1)),
+                    int32_t(SkFloatToScalar(transformed.x + 1)),
+                    int32_t(SkFloatToScalar(transformed.y + 1)));
 
   SkRegion pathRegion;
   
   return pathRegion.setPath(mPath, pointRect);
 }
 
 static Rect SkRectToRect(const SkRect& aBounds)
 {
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -25,26 +25,33 @@ gfxAlphaBoxBlur::~gfxAlphaBoxBlur()
 
 gfxContext*
 gfxAlphaBoxBlur::Init(const gfxRect& aRect,
                       const gfxIntSize& aSpreadRadius,
                       const gfxIntSize& aBlurRadius,
                       const gfxRect* aDirtyRect,
                       const gfxRect* aSkipRect)
 {
-    mozilla::gfx::Rect rect(aRect.x, aRect.y, aRect.width, aRect.height);
+    mozilla::gfx::Rect rect(Float(aRect.x), Float(aRect.y),
+                            Float(aRect.width), Float(aRect.height));
     IntSize spreadRadius(aSpreadRadius.width, aSpreadRadius.height);
     IntSize blurRadius(aBlurRadius.width, aBlurRadius.height);
     nsAutoPtr<mozilla::gfx::Rect> dirtyRect;
     if (aDirtyRect) {
-      dirtyRect = new mozilla::gfx::Rect(aDirtyRect->x, aDirtyRect->y, aDirtyRect->width, aDirtyRect->height);
+      dirtyRect = new mozilla::gfx::Rect(Float(aDirtyRect->x),
+                                         Float(aDirtyRect->y),
+                                         Float(aDirtyRect->width),
+                                         Float(aDirtyRect->height));
     }
     nsAutoPtr<mozilla::gfx::Rect> skipRect;
     if (aSkipRect) {
-      skipRect = new mozilla::gfx::Rect(aSkipRect->x, aSkipRect->y, aSkipRect->width, aSkipRect->height);
+      skipRect = new mozilla::gfx::Rect(Float(aSkipRect->x),
+                                        Float(aSkipRect->y),
+                                        Float(aSkipRect->width),
+                                        Float(aSkipRect->height));
     }
 
     mBlur = new AlphaBoxBlur(rect, spreadRadius, blurRadius, dirtyRect, skipRect);
 
     unsigned char* data = mBlur->GetData();
     if (!data)
       return nullptr;
 
@@ -94,12 +101,12 @@ gfxAlphaBoxBlur::Paint(gfxContext* aDest
         aDestinationCtx->Restore();
     } else {
         aDestinationCtx->Mask(mImageSurface, offset);
     }
 }
 
 gfxIntSize gfxAlphaBoxBlur::CalculateBlurRadius(const gfxPoint& aStd)
 {
-    mozilla::gfx::Point std(aStd.x, aStd.y);
+    mozilla::gfx::Point std(Float(aStd.x), Float(aStd.y));
     IntSize size = AlphaBoxBlur::CalculateBlurRadius(std);
     return gfxIntSize(size.width, size.height);
 }