Fix Windows platform plugin narrowing conversion compile errors
authorJonathan Liu <net147@gmail.com>
Tue, 4 Sep 2012 09:40:17 +0000 (19:40 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 5 Sep 2012 01:02:23 +0000 (03:02 +0200)
Implicit conversions from int to BYTE (unsigned char) result in
compile errors when compiling with the GCC -std=c++0x option.

Change-Id: Iaf8190426207bf15ab4b337300510596d70659ed
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
src/plugins/platforms/windows/qwindowsbackingstore.cpp
src/plugins/platforms/windows/qwindowswindow.cpp

index c30d566..4349b45 100644 (file)
@@ -99,7 +99,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
         SIZE size = {r.width(), r.height()};
         POINT ptDst = {r.x(), r.y()};
         POINT ptSrc = {0, 0};
-        BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * rw->opacity()), AC_SRC_ALPHA};
+        BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA};
         RECT dirty = {dirtyRect.x(), dirtyRect.y(),
             dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
         UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty};
index 7e79e1c..b43032d 100644 (file)
@@ -223,7 +223,7 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level)
         if ((wl & WS_EX_LAYERED) == 0)
             SetWindowLong(hwnd, GWL_EXSTYLE, wl | WS_EX_LAYERED);
         if (flags & Qt::FramelessWindowHint) {
-            BLENDFUNCTION blend = {AC_SRC_OVER, 0, (int)(255.0 * level), AC_SRC_ALPHA};
+            BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA};
             QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
         } else {
             QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, (int)(level * 255), LWA_ALPHA);