Bug 1012860: Explicitly static_cast M_PI to float, to fix MSVC warnings for double-to-float conversion. r=roc

This commit is contained in:
Daniel Holbert 2014-05-20 12:43:57 -07:00
parent e63fdf5095
commit aa50397bac

View File

@ -14,20 +14,22 @@ ComputeTransformForRotation(const nsIntRect& aBounds,
ScreenRotation aRotation)
{
gfx::Matrix transform;
static const gfx::Float floatPi = static_cast<gfx::Float>(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");