Fix compilation
authorOlivier Goffart <olivier.goffart@nokia.com>
Wed, 29 Jun 2011 16:20:52 +0000 (18:20 +0200)
committerQt by Nokia <qt-info@nokia.com>
Fri, 1 Jul 2011 13:00:39 +0000 (15:00 +0200)
qsgdefaultrectanglenode.cpp:221:22: error: narrowing conversion of '(((& c)->QColor::redF() * (&c)->QColor::alphaF()) * 2.55e+2)' from 'qreal {aka double}' to 'unsigned char' inside { } [-fpermissive]

Change-Id: I4f051f07d5db28fd03739343c255cc72d968a99d
Reviewed-on: http://codereview.qt.nokia.com/1004
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
src/declarative/scenegraph/qsgdefaultrectanglenode.cpp

index 34a6db4..a153a11 100644 (file)
@@ -214,10 +214,10 @@ Color4ub operator +(Color4ub a, Color4ub b) {  a.a += b.a; a.r += b.r; a.g += b.
 
 static inline Color4ub colorToColor4ub(const QColor &c)
 {
-    Color4ub color = { c.redF() * c.alphaF() * 255,
-                       c.greenF() * c.alphaF() * 255,
-                       c.blueF() * c.alphaF() * 255,
-                       c.alphaF() * 255
+    Color4ub color = { uchar(c.redF() * c.alphaF() * 255),
+                       uchar(c.greenF() * c.alphaF() * 255),
+                       uchar(c.blueF() * c.alphaF() * 255),
+                       uchar(c.alphaF() * 255)
                      };
     return color;
 }