From aa50397bacf154d7a39db0b7e8e0a858e59da201 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Tue, 20 May 2014 12:43:57 -0700 Subject: [PATCH] Bug 1012860: Explicitly static_cast M_PI to float, to fix MSVC warnings for double-to-float conversion. r=roc --- widget/xpwidgets/WidgetUtils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/widget/xpwidgets/WidgetUtils.cpp b/widget/xpwidgets/WidgetUtils.cpp index c1df718d53b7..9ad278005cff 100644 --- a/widget/xpwidgets/WidgetUtils.cpp +++ b/widget/xpwidgets/WidgetUtils.cpp @@ -14,20 +14,22 @@ ComputeTransformForRotation(const nsIntRect& aBounds, ScreenRotation aRotation) { gfx::Matrix transform; + static const gfx::Float floatPi = static_cast(M_PI); + switch (aRotation) { case ROTATION_0: break; case ROTATION_90: transform.Translate(aBounds.width, 0); - transform = gfx::Matrix::Rotation(M_PI / 2) * transform; + transform = gfx::Matrix::Rotation(floatPi / 2) * transform; break; case ROTATION_180: transform.Translate(aBounds.width, aBounds.height); - transform = gfx::Matrix::Rotation(M_PI) * transform; + transform = gfx::Matrix::Rotation(floatPi) * transform; break; case ROTATION_270: transform.Translate(0, aBounds.height); - transform = gfx::Matrix::Rotation(M_PI * 3 / 2) * transform; + transform = gfx::Matrix::Rotation(floatPi * 3 / 2) * transform; break; default: MOZ_CRASH("Unknown rotation");