Fix MSVC-warnings about double to float truncation.

Change-Id: I4aef12bd8fe37dffb06fc7d0b6a330bfc42fa270
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This commit is contained in:
Friedemann Kleint 2014-01-24 15:34:54 +01:00 committed by The Qt Project
parent 558ae43b1b
commit 1fb42377a2
3 changed files with 31 additions and 31 deletions

View File

@ -79,40 +79,40 @@ void GeometryEngine::initCubeGeometry()
// is different. // is different.
VertexData vertices[] = { VertexData vertices[] = {
// Vertex data for face 0 // Vertex data for face 0
{QVector3D(-1.0, -1.0, 1.0), QVector2D(0.0, 0.0)}, // v0 {QVector3D(-1.0f, -1.0f, 1.0f), QVector2D(0.0f, 0.0f)}, // v0
{QVector3D( 1.0, -1.0, 1.0), QVector2D(0.33, 0.0)}, // v1 {QVector3D( 1.0f, -1.0f, 1.0f), QVector2D(0.33f, 0.0f)}, // v1
{QVector3D(-1.0, 1.0, 1.0), QVector2D(0.0, 0.5)}, // v2 {QVector3D(-1.0f, 1.0f, 1.0f), QVector2D(0.0f, 0.5f)}, // v2
{QVector3D( 1.0, 1.0, 1.0), QVector2D(0.33, 0.5)}, // v3 {QVector3D( 1.0f, 1.0f, 1.0f), QVector2D(0.33f, 0.5f)}, // v3
// Vertex data for face 1 // Vertex data for face 1
{QVector3D( 1.0, -1.0, 1.0), QVector2D( 0.0, 0.5)}, // v4 {QVector3D( 1.0f, -1.0f, 1.0f), QVector2D( 0.0f, 0.5f)}, // v4
{QVector3D( 1.0, -1.0, -1.0), QVector2D(0.33, 0.5)}, // v5 {QVector3D( 1.0f, -1.0f, -1.0f), QVector2D(0.33f, 0.5f)}, // v5
{QVector3D( 1.0, 1.0, 1.0), QVector2D(0.0, 1.0)}, // v6 {QVector3D( 1.0f, 1.0f, 1.0f), QVector2D(0.0f, 1.0f)}, // v6
{QVector3D( 1.0, 1.0, -1.0), QVector2D(0.33, 1.0)}, // v7 {QVector3D( 1.0f, 1.0f, -1.0f), QVector2D(0.33f, 1.0f)}, // v7
// Vertex data for face 2 // Vertex data for face 2
{QVector3D( 1.0, -1.0, -1.0), QVector2D(0.66, 0.5)}, // v8 {QVector3D( 1.0f, -1.0f, -1.0f), QVector2D(0.66f, 0.5f)}, // v8
{QVector3D(-1.0, -1.0, -1.0), QVector2D(1.0, 0.5)}, // v9 {QVector3D(-1.0f, -1.0f, -1.0f), QVector2D(1.0f, 0.5f)}, // v9
{QVector3D( 1.0, 1.0, -1.0), QVector2D(0.66, 1.0)}, // v10 {QVector3D( 1.0f, 1.0f, -1.0f), QVector2D(0.66f, 1.0f)}, // v10
{QVector3D(-1.0, 1.0, -1.0), QVector2D(1.0, 1.0)}, // v11 {QVector3D(-1.0f, 1.0f, -1.0f), QVector2D(1.0f, 1.0f)}, // v11
// Vertex data for face 3 // Vertex data for face 3
{QVector3D(-1.0, -1.0, -1.0), QVector2D(0.66, 0.0)}, // v12 {QVector3D(-1.0f, -1.0f, -1.0f), QVector2D(0.66f, 0.0f)}, // v12
{QVector3D(-1.0, -1.0, 1.0), QVector2D(1.0, 0.0)}, // v13 {QVector3D(-1.0f, -1.0f, 1.0f), QVector2D(1.0f, 0.0f)}, // v13
{QVector3D(-1.0, 1.0, -1.0), QVector2D(0.66, 0.5)}, // v14 {QVector3D(-1.0f, 1.0f, -1.0f), QVector2D(0.66f, 0.5f)}, // v14
{QVector3D(-1.0, 1.0, 1.0), QVector2D(1.0, 0.5)}, // v15 {QVector3D(-1.0f, 1.0f, 1.0f), QVector2D(1.0f, 0.5f)}, // v15
// Vertex data for face 4 // Vertex data for face 4
{QVector3D(-1.0, -1.0, -1.0), QVector2D(0.33, 0.0)}, // v16 {QVector3D(-1.0f, -1.0f, -1.0f), QVector2D(0.33f, 0.0f)}, // v16
{QVector3D( 1.0, -1.0, -1.0), QVector2D(0.66, 0.0)}, // v17 {QVector3D( 1.0f, -1.0f, -1.0f), QVector2D(0.66f, 0.0f)}, // v17
{QVector3D(-1.0, -1.0, 1.0), QVector2D(0.33, 0.5)}, // v18 {QVector3D(-1.0f, -1.0f, 1.0f), QVector2D(0.33f, 0.5f)}, // v18
{QVector3D( 1.0, -1.0, 1.0), QVector2D(0.66, 0.5)}, // v19 {QVector3D( 1.0f, -1.0f, 1.0f), QVector2D(0.66f, 0.5f)}, // v19
// Vertex data for face 5 // Vertex data for face 5
{QVector3D(-1.0, 1.0, 1.0), QVector2D(0.33, 0.5)}, // v20 {QVector3D(-1.0f, 1.0f, 1.0f), QVector2D(0.33f, 0.5f)}, // v20
{QVector3D( 1.0, 1.0, 1.0), QVector2D(0.66, 0.5)}, // v21 {QVector3D( 1.0f, 1.0f, 1.0f), QVector2D(0.66f, 0.5f)}, // v21
{QVector3D(-1.0, 1.0, -1.0), QVector2D(0.33, 1.0)}, // v22 {QVector3D(-1.0f, 1.0f, -1.0f), QVector2D(0.33f, 1.0f)}, // v22
{QVector3D( 1.0, 1.0, -1.0), QVector2D(0.66, 1.0)} // v23 {QVector3D( 1.0f, 1.0f, -1.0f), QVector2D(0.66f, 1.0f)} // v23
}; };
// Indices for drawing cube faces using triangle strips. // Indices for drawing cube faces using triangle strips.

View File

@ -756,7 +756,7 @@ void tst_QEasingCurve::testCbrtDouble()
void tst_QEasingCurve::testCbrtFloat() void tst_QEasingCurve::testCbrtFloat()
{ {
const float errorBound = 0.0005; const float errorBound = 0.0005f;
for (int i = 0; i < 100000; i++) { for (int i = 0; i < 100000; i++) {
float f = float(i) / 1000.0f; float f = float(i) / 1000.0f;

View File

@ -468,8 +468,8 @@ void tst_QGuiVariant::vector3D()
QVariant variant; QVariant variant;
QVector3D vector = qvariant_cast<QVector3D>(variant); QVector3D vector = qvariant_cast<QVector3D>(variant);
QVERIFY(vector.isNull()); QVERIFY(vector.isNull());
variant.setValue(QVector3D(0.1, 0.2, 0.3)); variant.setValue(QVector3D(0.1f, 0.2f, 0.3f));
QCOMPARE(QVector3D(0.1, 0.2, 0.3), qvariant_cast<QVector3D>(variant)); QCOMPARE(QVector3D(0.1f, 0.2f, 0.3f), qvariant_cast<QVector3D>(variant));
void *pvector = QMetaType::create(QVariant::Vector3D, 0); void *pvector = QMetaType::create(QVariant::Vector3D, 0);
QVERIFY(pvector); QVERIFY(pvector);
@ -481,8 +481,8 @@ void tst_QGuiVariant::vector4D()
QVariant variant; QVariant variant;
QVector4D vector = qvariant_cast<QVector4D>(variant); QVector4D vector = qvariant_cast<QVector4D>(variant);
QVERIFY(vector.isNull()); QVERIFY(vector.isNull());
variant.setValue(QVector4D(0.1, 0.2, 0.3, 0.4)); variant.setValue(QVector4D(0.1f, 0.2f, 0.3f, 0.4f));
QCOMPARE(QVector4D(0.1, 0.2, 0.3, 0.4), qvariant_cast<QVector4D>(variant)); QCOMPARE(QVector4D(0.1f, 0.2f, 0.3f, 0.4f), qvariant_cast<QVector4D>(variant));
void *pvector = QMetaType::create(QVariant::Vector4D, 0); void *pvector = QMetaType::create(QVariant::Vector4D, 0);
QVERIFY(pvector); QVERIFY(pvector);
@ -494,8 +494,8 @@ void tst_QGuiVariant::quaternion()
QVariant variant; QVariant variant;
QQuaternion quaternion = qvariant_cast<QQuaternion>(variant); QQuaternion quaternion = qvariant_cast<QQuaternion>(variant);
QVERIFY(quaternion.isIdentity()); QVERIFY(quaternion.isIdentity());
variant.setValue(QQuaternion(0.1, 0.2, 0.3, 0.4)); variant.setValue(QQuaternion(0.1f, 0.2f, 0.3f, 0.4f));
QCOMPARE(QQuaternion(0.1, 0.2, 0.3, 0.4), qvariant_cast<QQuaternion>(variant)); QCOMPARE(QQuaternion(0.1f, 0.2f, 0.3f, 0.4f), qvariant_cast<QQuaternion>(variant));
void *pquaternion = QMetaType::create(QVariant::Quaternion, 0); void *pquaternion = QMetaType::create(QVariant::Quaternion, 0);
QVERIFY(pquaternion); QVERIFY(pquaternion);