diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 98f3aee..53175bd 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -665,6 +665,10 @@ bool QImageData::checkForAlphaPixels() const
                             The unused bits are always zero.
     \value Format_ARGB4444_Premultiplied  The image is stored using a
                             premultiplied 16-bit ARGB format (4-4-4-4).
+    \value Format_RGBX8888   The image is stored using a 32-bit byte-ordered RGBx format (8-8-8-8).
+    \value Format_RGBA8888   The image is stored using a 32-bit byte-ordered RGBA format (8-8-8-8).
+    \value Format_RGBA8888_Premultiplied    The image is stored using a
+                            premultiplied 32-bit byte-ordered RGBA format (8-8-8-8).
 
     \note Drawing into a QImage with QImage::Format_Indexed8 is not
     supported.
@@ -1871,8 +1875,8 @@ typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFla
 
 static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
 {
-    Q_ASSERT(src->format == QImage::Format_ARGB32);
-    Q_ASSERT(dest->format == QImage::Format_ARGB32_Premultiplied);
+    Q_ASSERT(src->format == QImage::Format_ARGB32 || src->format == QImage::Format_RGBA8888);
+    Q_ASSERT(dest->format == QImage::Format_ARGB32_Premultiplied || dest->format == QImage::Format_RGBA8888_Premultiplied);
     Q_ASSERT(src->width == dest->width);
     Q_ASSERT(src->height == dest->height);
 
@@ -1912,6 +1916,191 @@ static bool convert_ARGB_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversio
     return true;
 }
 
+static void convert_ARGB_to_RGBx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_ARGB32);
+    Q_ASSERT(dest->format == QImage::Format_RGBX8888);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const quint32 *src_data = (quint32 *) src->data;
+    quint32 *dest_data = (quint32 *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const quint32 *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = ARGB2RGBA(0xff000000 | *src_data);
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_ARGB_to_RGBA(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_ARGB32 || src->format == QImage::Format_ARGB32_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const quint32 *src_data = (quint32 *) src->data;
+    quint32 *dest_data = (quint32 *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const uint32_t *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = ARGB2RGBA(*src_data);
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static bool convert_ARGB_to_RGBA_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(data->format == QImage::Format_ARGB32 || src->format == QImage::Format_ARGB32_Premultiplied);
+
+    const int pad = (data->bytes_per_line >> 2) - data->width;
+    quint32 *rgb_data = (quint32 *) data->data;
+
+    for (int i = 0; i < data->height; ++i) {
+        const quint32 *end = rgb_data + data->width;
+        while (rgb_data < end) {
+            *rgb_data = ARGB2RGBA(*rgb_data);
+            ++rgb_data;
+        }
+        rgb_data += pad;
+    }
+    if (data->format == QImage::Format_ARGB32)
+        data->format = QImage::Format_RGBA8888;
+    else
+        data->format = QImage::Format_RGBA8888_Premultiplied;
+    return true;
+}
+
+static void convert_ARGB_to_RGBA_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_ARGB32);
+    Q_ASSERT(dest->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const uint32_t *src_data = (uint32_t *) src->data;
+    uint32_t *dest_data = (uint32_t *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const uint32_t *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = ARGB2RGBA(PREMUL(*src_data));
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_RGBA_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_RGBX8888 || src->format == QImage::Format_RGBA8888 || src->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const uint32_t *src_data = (uint32_t *) src->data;
+    uint32_t *dest_data = (uint32_t *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const uint32_t *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = RGBA2ARGB(*src_data);
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static bool convert_RGBA_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(data->format == QImage::Format_RGBX8888 || data->format == QImage::Format_RGBA8888 || data->format == QImage::Format_RGBA8888_Premultiplied);
+
+    const int pad = (data->bytes_per_line >> 2) - data->width;
+    QRgb *rgb_data = (QRgb *) data->data;
+
+    for (int i = 0; i < data->height; ++i) {
+        const QRgb *end = rgb_data + data->width;
+        while (rgb_data < end) {
+            *rgb_data = RGBA2ARGB(*rgb_data);
+            ++rgb_data;
+        }
+        rgb_data += pad;
+    }
+    if (data->format == QImage::Format_RGBA8888_Premultiplied)
+        data->format = QImage::Format_ARGB32_Premultiplied;
+    else if (data->format == QImage::Format_RGBX8888)
+        data->format = QImage::Format_RGB32;
+    else
+        data->format = QImage::Format_ARGB32;
+    return true;
+}
+
+static void convert_RGBA_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_RGBA8888);
+    Q_ASSERT(dest->format == QImage::Format_ARGB32_Premultiplied);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const uint32_t *src_data = (uint32_t *) src->data;
+    uint32_t *dest_data = (uint32_t *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const uint32_t *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = PREMUL(RGBA2ARGB(*src_data));
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static bool convert_RGBA_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(data->format == QImage::Format_RGBA8888);
+
+    const int pad = (data->bytes_per_line >> 2) - data->width;
+    QRgb *rgb_data = (QRgb *) data->data;
+
+    for (int i = 0; i < data->height; ++i) {
+        const QRgb *end = rgb_data + data->width;
+        while (rgb_data < end) {
+            *rgb_data = PREMUL(RGBA2ARGB(*rgb_data));
+            ++rgb_data;
+        }
+        rgb_data += pad;
+    }
+    data->format = QImage::Format_ARGB32_Premultiplied;
+    return true;
+}
+
 static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
 {
     Q_ASSERT(data->format == QImage::Format_Indexed8);
@@ -2099,8 +2288,8 @@ static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFl
 
 static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
 {
-    Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied);
-    Q_ASSERT(dest->format == QImage::Format_ARGB32);
+    Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied || src->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_ARGB32 || src->format == QImage::Format_RGBA8888);
     Q_ASSERT(src->width == dest->width);
     Q_ASSERT(src->height == dest->height);
 
@@ -2123,7 +2312,127 @@ static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt:
 
 static void convert_ARGB_PM_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
 {
+    Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied || src->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_RGBX8888);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const QRgb *src_data = (QRgb *) src->data;
+    QRgb *dest_data = (QRgb *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const QRgb *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = 0xff000000 | INV_PREMUL(*src_data);
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_ARGB_PM_to_RGBx(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
     Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_RGBX8888);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const QRgb *src_data = (QRgb *) src->data;
+    QRgb *dest_data = (QRgb *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const QRgb *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = ARGB2RGBA(0xff000000 | INV_PREMUL(*src_data));
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_ARGB_PM_to_RGBA(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_RGBA8888);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const QRgb *src_data = (QRgb *) src->data;
+    QRgb *dest_data = (QRgb *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const QRgb *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = ARGB2RGBA(INV_PREMUL(*src_data));
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_RGBA_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_RGBA8888);
+    Q_ASSERT(dest->format == QImage::Format_RGB32);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const uint *src_data = (const uint *)src->data;
+    uint *dest_data = (uint *)dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const uint *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = RGBA2ARGB(*src_data) | 0xff000000;
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_RGB_to_RGBA(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_RGB32);
+    Q_ASSERT(dest->format == QImage::Format_RGBX8888 || dest->format == QImage::Format_RGBA8888 || dest->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const uint *src_data = (const uint *)src->data;
+    uint *dest_data = (uint *)dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const uint *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = ARGB2RGBA(*src_data | 0xff000000);
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_RGBA_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_RGBA8888_Premultiplied);
     Q_ASSERT(dest->format == QImage::Format_RGB32);
     Q_ASSERT(src->width == dest->width);
     Q_ASSERT(src->height == dest->height);
@@ -2136,7 +2445,31 @@ static void convert_ARGB_PM_to_RGB(QImageData *dest, const QImageData *src, Qt::
     for (int i = 0; i < src->height; ++i) {
         const QRgb *end = src_data + src->width;
         while (src_data < end) {
-            *dest_data = 0xff000000 | INV_PREMUL(*src_data);
+            *dest_data = INV_PREMUL(RGBA2ARGB(*src_data));
+            ++src_data;
+            ++dest_data;
+        }
+        src_data += src_pad;
+        dest_data += dest_pad;
+    }
+}
+
+static void convert_RGBA_PM_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
+{
+    Q_ASSERT(src->format == QImage::Format_RGBA8888_Premultiplied);
+    Q_ASSERT(dest->format == QImage::Format_RGB32);
+    Q_ASSERT(src->width == dest->width);
+    Q_ASSERT(src->height == dest->height);
+
+    const int src_pad = (src->bytes_per_line >> 2) - src->width;
+    const int dest_pad = (dest->bytes_per_line >> 2) - dest->width;
+    const QRgb *src_data = (QRgb *) src->data;
+    QRgb *dest_data = (QRgb *) dest->data;
+
+    for (int i = 0; i < src->height; ++i) {
+        const QRgb *end = src_data + src->width;
+        while (src_data < end) {
+            *dest_data = 0xff000000 | INV_PREMUL(RGBA2ARGB(*src_data));
             ++src_data;
             ++dest_data;
         }
@@ -2941,6 +3274,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_Mono
 
@@ -2960,6 +3296,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_MonoLSB
 
@@ -2979,6 +3318,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_Indexed8
 
@@ -2998,7 +3340,10 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         convert_generic,
         convert_generic,
         convert_generic,
-        convert_generic
+        convert_generic,
+        convert_RGB_to_RGBA,
+        convert_RGB_to_RGBA,
+        convert_RGB_to_RGBA
     }, // Format_RGB32
 
     {
@@ -3017,7 +3362,10 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         convert_generic,
         convert_generic,
         convert_generic,
-        convert_generic
+        convert_generic,
+        convert_ARGB_to_RGBx,
+        convert_ARGB_to_RGBA,
+        convert_ARGB_to_RGBA_PM,
     }, // Format_ARGB32
 
     {
@@ -3036,7 +3384,10 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0
+        0,
+        convert_ARGB_PM_to_RGBx,
+        convert_ARGB_PM_to_RGBA,
+        convert_ARGB_to_RGBA,
     },  // Format_ARGB32_Premultiplied
 
     {
@@ -3059,6 +3410,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_RGB16
 
@@ -3078,6 +3432,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_ARGB8565_Premultiplied
 
@@ -3097,6 +3454,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_RGB666
 
@@ -3116,6 +3476,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_ARGB6666_Premultiplied
 
@@ -3139,6 +3502,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_RGB555
 
@@ -3158,6 +3524,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_ARGB8555_Premultiplied
 
@@ -3177,6 +3546,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_RGB888
 
@@ -3196,6 +3568,9 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0,
         0
     }, // Format_RGB444
 
@@ -3215,20 +3590,104 @@ static Image_Converter converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0,
+        0,
+        0
+    }, // Format_ARGB4444_Premultiplied
+    {
+        0,
+        0,
+        0,
+        0,
+        convert_RGBA_to_RGB,
+        convert_RGBA_to_ARGB,
+        convert_RGBA_to_ARGB_PM,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        0,
+        mask_alpha_converter,
+        mask_alpha_converter,
+#else
+        0,
+        0,
+        0
+#endif
+    }, // Format_RGBX8888
+    {
+        0,
+        0,
+        0,
+        0,
+        convert_RGBA_to_RGB,
+        convert_RGBA_to_ARGB,
+        convert_RGBA_to_ARGB_PM,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        mask_alpha_converter,
+        0,
+        convert_ARGB_to_ARGB_PM,
+#else
+        0,
+        0,
         0
-    } // Format_ARGB4444_Premultiplied
+#endif
+    }, // Format_RGBA8888
+
+    {
+        0,
+        0,
+        0,
+        0,
+        convert_RGBA_PM_to_RGB,
+        convert_RGBA_PM_to_ARGB,
+        convert_RGBA_to_ARGB,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        convert_ARGB_PM_to_RGB,
+        convert_ARGB_PM_to_ARGB,
+        0,
+#else
+        0,
+        0,
+        0
+#endif
+    } // Format_RGBA8888_Premultiplied
 };
 
 static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
 {
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     },
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_Mono
     {
-       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_MonoLSB
     {
         0,
@@ -3247,6 +3706,9 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
+        0,
+        0,
+        0,
     }, // Format_Indexed8
     {
         0,
@@ -3265,6 +3727,9 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
+        0,
+        0,
+        0,
     }, // Format_ARGB32
     {
         0,
@@ -3283,37 +3748,118 @@ static InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
+        0,
+        convert_ARGB_to_RGBA_inplace,
+        0,
     }, // Format_ARGB32
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        convert_ARGB_to_RGBA_inplace
     },  // Format_ARGB32_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB16
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB8565_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB666
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB6666_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB555
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB8555_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB888
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB444
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    } // Format_ARGB4444_Premultiplied
+        0,
+        0,
+        0,
+        0,
+        0,
+        convert_RGBA_to_ARGB_inplace,
+        convert_RGBA_to_ARGB_inplace,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+    }, // Format_RGBX8888
+    {
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        convert_RGBA_to_ARGB_inplace,
+        convert_RGBA_to_ARGB_PM_inplace,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+    }, // Format_RGBA8888
+    {
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        convert_RGBA_to_ARGB_inplace,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+        0,
+    }  // Format_RGBA8888_Premultiplied
 };
 
 void qInitImageConversions()
@@ -3716,6 +4262,13 @@ void QImage::setPixel(int x, int y, uint index_or_rgb)
     case Format_RGB16:
         ((quint16 *)s)[x] = qConvertRgb32To16(INV_PREMUL(index_or_rgb));
         return;
+    case Format_RGBX8888:
+        ((uint *)s)[x] = ARGB2RGBA(index_or_rgb | 0xff000000);
+        return;
+    case Format_RGBA8888:
+    case Format_RGBA8888_Premultiplied:
+        ((uint *)s)[x] = ARGB2RGBA(index_or_rgb);
+        return;
     case Format_Invalid:
     case NImageFormats:
         Q_ASSERT(false);
@@ -3756,6 +4309,11 @@ bool QImage::allGray() const
     case Format_RGB32:
     case Format_ARGB32:
     case Format_ARGB32_Premultiplied:
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+    case Format_RGBX8888:
+    case Format_RGBA8888:
+    case Format_RGBA8888_Premultiplied:
+#endif
         for (int j = 0; j < d->height; ++j) {
             const QRgb *b = (const QRgb *)constScanLine(j);
             for (int i = 0; i < d->width; ++i) {
@@ -4330,6 +4888,11 @@ QImage QImage::rgbSwapped() const
     case Format_RGB32:
     case Format_ARGB32:
     case Format_ARGB32_Premultiplied:
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+    case Format_RGBX8888:
+    case Format_RGBA8888:
+    case Format_RGBA8888_Premultiplied:
+#endif
         res = QImage(d->width, d->height, d->format);
         QIMAGE_SANITYCHECK_MEMORY(res);
         for (int i = 0; i < d->height; i++) {
@@ -5373,7 +5936,11 @@ QImage QImage::alphaChannel() const
         }
     } else {
         QImage alpha32 = *this;
-        if (d->format != Format_ARGB32 && d->format != Format_ARGB32_Premultiplied)
+        bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied);
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        canSkipConversion = canSkipConversion || (d->format == Format_RGBA8888 || d->format == Format_RGBA8888_Premultiplied);
+#endif
+        if (!canSkipConversion)
             alpha32 = convertToFormat(Format_ARGB32);
 
         const uchar *src_data = alpha32.d->data;
@@ -5408,6 +5975,8 @@ bool QImage::hasAlphaChannel() const
                  || d->format == Format_ARGB8555_Premultiplied
                  || d->format == Format_ARGB6666_Premultiplied
                  || d->format == Format_ARGB4444_Premultiplied
+                 || d->format == Format_RGBA8888
+                 || d->format == Format_RGBA8888_Premultiplied
                  || (d->has_alpha_clut && (d->format == Format_Indexed8
                                            || d->format == Format_Mono
                                            || d->format == Format_MonoLSB)));
@@ -5434,6 +6003,7 @@ int QImage::bitPlaneCount() const
     case QImage::Format_Invalid:
         break;
     case QImage::Format_RGB32:
+    case QImage::Format_RGBX8888:
         bpc = 24;
         break;
     case QImage::Format_RGB666:
@@ -5457,9 +6027,11 @@ int QImage::bitPlaneCount() const
 
 static QImage smoothScaled(const QImage &source, int w, int h) {
     QImage src = source;
-    if (src.format() == QImage::Format_ARGB32)
-        src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
-    else if (src.depth() < 32) {
+    bool canSkipConversion = (src.format() == QImage::Format_RGB32 || src.format() == QImage::Format_ARGB32_Premultiplied);
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+    canSkipConversion = canSkipConversion || (src.format() == QImage::Format_RGBX8888 || src.format() == QImage::Format_RGBA8888_Premultiplied);
+#endif
+    if (!canSkipConversion) {
         if (src.hasAlphaChannel())
             src = src.convertToFormat(QImage::Format_ARGB32_Premultiplied);
         else
@@ -5480,6 +6052,9 @@ static QImage rotated90(const QImage &image) {
     case QImage::Format_RGB32:
     case QImage::Format_ARGB32:
     case QImage::Format_ARGB32_Premultiplied:
+    case QImage::Format_RGBX8888:
+    case QImage::Format_RGBA8888:
+    case QImage::Format_RGBA8888_Premultiplied:
         qt_memrotate270(reinterpret_cast<const quint32*>(image.bits()),
                         w, h, image.bytesPerLine(),
                         reinterpret_cast<quint32*>(out.bits()),
@@ -5539,6 +6114,9 @@ static QImage rotated270(const QImage &image) {
     case QImage::Format_RGB32:
     case QImage::Format_ARGB32:
     case QImage::Format_ARGB32_Premultiplied:
+    case QImage::Format_RGBX8888:
+    case QImage::Format_RGBA8888:
+    case QImage::Format_RGBA8888_Premultiplied:
         qt_memrotate90(reinterpret_cast<const quint32*>(image.bits()),
                        w, h, image.bytesPerLine(),
                        reinterpret_cast<quint32*>(out.bits()),
@@ -5684,6 +6262,9 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode
             case QImage::Format_RGB444:
                 target_format = Format_ARGB4444_Premultiplied;
                 break;
+            case QImage::Format_RGBX8888:
+                target_format = Format_RGBA8888_Premultiplied;
+                break;
             default:
                 target_format = Format_ARGB32_Premultiplied;
                 break;
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index a4aaf04..02f0c18 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -110,6 +110,9 @@ public:
         Format_RGB888,
         Format_RGB444,
         Format_ARGB4444_Premultiplied,
+        Format_RGBX8888,
+        Format_RGBA8888,
+        Format_RGBA8888_Premultiplied,
 #if 0
         // reserved for future use
         Format_RGB15,
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 18c686e..36f117d 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -128,6 +128,9 @@ inline int qt_depthForFormat(QImage::Format format)
     case QImage::Format_RGB32:
     case QImage::Format_ARGB32:
     case QImage::Format_ARGB32_Premultiplied:
+    case QImage::Format_RGBX8888:
+    case QImage::Format_RGBA8888:
+    case QImage::Format_RGBA8888_Premultiplied:
         depth = 32;
         break;
     case QImage::Format_RGB555:
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 90416db..247ecf7 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1012,23 +1012,28 @@ QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const
 
 Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
 {
-    QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
-                                                     : QImage::Format_RGB32);
     int w = size.width();
     int h = size.height();
 
+    while (glGetError());
+
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+    QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied
+                                                     : QImage::Format_RGB32);
 #ifdef QT_OPENGL_ES
     GLint fmt = GL_BGRA_EXT;
 #else
     GLint fmt = GL_BGRA;
 #endif
-    while (glGetError());
     glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits());
-    if (glGetError()) {
-        glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img.bits());
-        img = img.rgbSwapped();
-    }
-    return img.mirrored();
+    if (!glGetError())
+        return img.mirrored();
+#endif
+
+    QImage rgbaImage(size, (alpha_format && include_alpha) ? QImage::Format_RGBA8888_Premultiplied
+                                                           : QImage::Format_RGBX8888);
+    glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits());
+    return rgbaImage.mirrored();
 }
 
 /*!
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index c79e8ba..1badc36 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -386,7 +386,16 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
     { 5, 18, 5, 13, 5,  8, 8,  0,  true, QPixelLayout::BPP24, convertToARGB32PM, convertFromARGB32PM }, // Format_ARGB8555_Premultiplied
     { 8, 16, 8,  8, 8,  0, 0,  0, false, QPixelLayout::BPP24, convertToRGB32, convertFromARGB32PM }, // Format_RGB888
     { 4,  8, 4,  4, 4,  0, 0,  0, false, QPixelLayout::BPP16, convertToRGB32, convertFromARGB32PM }, // Format_RGB444
-    { 4,  8, 4,  4, 4,  0, 4, 12,  true, QPixelLayout::BPP16, convertToARGB32PM, convertFromARGB32PM } // Format_ARGB4444_Premultiplied
+    { 4,  8, 4,  4, 4,  0, 4, 12,  true, QPixelLayout::BPP16, convertToARGB32PM, convertFromARGB32PM }, // Format_ARGB4444_Premultiplied
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+    { 8, 24, 8, 16, 8,  8, 0,  0, false, QPixelLayout::BPP32, convertToRGB32, convertFromARGB32PM }, // Format_RGBX8888
+    { 8, 24, 8, 16, 8,  8, 8,  0, false, QPixelLayout::BPP32, convertToARGB32PM, convertFromARGB32PM }, // Format_RGBA8888
+    { 8, 24, 8, 16, 8,  8, 8,  0,  true, QPixelLayout::BPP32, convertToARGB32PM, convertFromARGB32PM }, // Format_RGBA8888_Premultiplied
+#else
+    { 8,  0, 8,  8, 8, 16, 0,  0, false, QPixelLayout::BPP32, convertToRGB32, convertFromARGB32PM }, // Format_RGBX8888
+    { 8,  0, 8,  8, 8, 16, 8, 24, false, QPixelLayout::BPP32, convertToARGB32PM, convertFromARGB32PM }, // Format_RGBA8888 (ABGR32)
+    { 8,  0, 8,  8, 8, 16, 8, 24,  true, QPixelLayout::BPP32, convertToARGB32PM, convertFromARGB32PM }  // Format_RGBA8888_Premultiplied
+#endif
 };
 
 FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
@@ -490,7 +499,10 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] =
     destFetch,          // Format_ARGB8555_Premultiplied
     destFetch,          // Format_RGB888
     destFetch,          // Format_RGB444
-    destFetch           // Format_ARGB4444_Premultiplied
+    destFetch,          // Format_ARGB4444_Premultiplied
+    destFetch,          // Format_RGBX8888
+    destFetch,          // Format_RGBA8888
+    destFetch,          // Format_RGBA8888_Premultiplied
 };
 
 /*
@@ -622,7 +634,10 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] =
     destStore,          // Format_ARGB8555_Premultiplied
     destStore,          // Format_RGB888
     destStore,          // Format_RGB444
-    destStore           // Format_ARGB4444_Premultiplied
+    destStore,          // Format_ARGB4444_Premultiplied
+    destStore,          // Format_RGBX8888
+    destStore,          // Format_RGBA8888
+    destStore           // Format_RGBA8888_Premultiplied
 };
 
 /*
@@ -1766,7 +1781,10 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchUntransformed,         // ARGB8555_Premultiplied
         fetchUntransformed,         // RGB888
         fetchUntransformed,         // RGB444
-        fetchUntransformed          // ARGB4444_Premultiplied
+        fetchUntransformed,         // ARGB4444_Premultiplied
+        fetchUntransformed,         // RGBX8888
+        fetchUntransformed,         // RGBA8888
+        fetchUntransformed          // RGBA8888_Premultiplied
     },
     // Tiled
     {
@@ -1785,7 +1803,10 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchUntransformed,         // ARGB8555_Premultiplied
         fetchUntransformed,         // RGB888
         fetchUntransformed,         // RGB444
-        fetchUntransformed          // ARGB4444_Premultiplied
+        fetchUntransformed,         // ARGB4444_Premultiplied
+        fetchUntransformed,         // RGBX8888
+        fetchUntransformed,         // RGBA8888
+        fetchUntransformed          // RGBA8888_Premultiplied
     },
     // Transformed
     {
@@ -1805,6 +1826,9 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformed<BlendTransformed>,         // RGB888
         fetchTransformed<BlendTransformed>,         // RGB444
         fetchTransformed<BlendTransformed>,         // ARGB4444_Premultiplied
+        fetchTransformed<BlendTransformed>,         // RGBX8888
+        fetchTransformed<BlendTransformed>,         // RGBA8888
+        fetchTransformed<BlendTransformed>,         // RGBA8888_Premultiplied
     },
     {
         0, // TransformedTiled
@@ -1823,6 +1847,9 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformed<BlendTransformedTiled>,            // RGB888
         fetchTransformed<BlendTransformedTiled>,            // RGB444
         fetchTransformed<BlendTransformedTiled>,            // ARGB4444_Premultiplied
+        fetchTransformed<BlendTransformedTiled>,            // RGBX8888
+        fetchTransformed<BlendTransformedTiled>,            // RGBA8888
+        fetchTransformed<BlendTransformedTiled>,            // RGBA8888_Premultiplied
     },
     {
         0, // Bilinear
@@ -1840,7 +1867,10 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformedBilinear<BlendTransformedBilinear>,         // ARGB8555_Premultiplied
         fetchTransformedBilinear<BlendTransformedBilinear>,         // RGB888
         fetchTransformedBilinear<BlendTransformedBilinear>,         // RGB444
-        fetchTransformedBilinear<BlendTransformedBilinear>          // ARGB4444_Premultiplied
+        fetchTransformedBilinear<BlendTransformedBilinear>,         // ARGB4444_Premultiplied
+        fetchTransformedBilinear<BlendTransformedBilinear>,         // RGBX8888
+        fetchTransformedBilinear<BlendTransformedBilinear>,         // RGBA8888
+        fetchTransformedBilinear<BlendTransformedBilinear>          // RGBA8888_Premultiplied
     },
     {
         0, // BilinearTiled
@@ -1858,7 +1888,10 @@ static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // ARGB8555_Premultiplied
         fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // RGB888
         fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // RGB444
-        fetchTransformedBilinear<BlendTransformedBilinearTiled>             // ARGB4444_Premultiplied
+        fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // ARGB4444_Premultiplied
+        fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // RGBX8888
+        fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // RGBA8888
+        fetchTransformedBilinear<BlendTransformedBilinearTiled>             // RGBA8888_Premultiplied
     },
 };
 
@@ -5268,6 +5301,9 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_untransformed_generic,
         blend_untransformed_generic,
         blend_untransformed_generic,
+        blend_untransformed_generic,
+        blend_untransformed_generic,
+        blend_untransformed_generic,
     },
     // Tiled
     {
@@ -5287,6 +5323,9 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_tiled_generic,
         blend_tiled_generic,
         blend_tiled_generic,
+        blend_tiled_generic,
+        blend_tiled_generic,
+        blend_tiled_generic,
     },
     // Transformed
     {
@@ -5306,6 +5345,9 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic,
         blend_src_generic,
         blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
     },
      // TransformedTiled
     {
@@ -5324,6 +5366,9 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic,
         blend_src_generic,
         blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
         blend_src_generic
     },
     // Bilinear
@@ -5344,6 +5389,9 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic,
         blend_src_generic,
         blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
     },
     // BilinearTiled
     {
@@ -5363,6 +5411,9 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic, // RGB888
         blend_src_generic, // RGB444
         blend_src_generic, // ARGB4444_Premultiplied
+        blend_src_generic, // RGBX8888
+        blend_src_generic, // RGBA8888
+        blend_src_generic, // RGBA8888_Premultiplied
     }
 };
 
@@ -5956,6 +6007,33 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
         blend_color_generic,
         blend_src_generic,
         0, 0, 0, 0
+    },
+    // Format_RGBX8888
+    {
+        blend_color_generic,
+        qt_gradient_quint32,
+        qt_bitmapblit_quint32,
+        qt_alphamapblit_quint32,
+        qt_alphargbblit_quint32,
+        qt_rectfill_quint32
+    },
+    // Format_RGBA8888
+    {
+        blend_color_generic,
+        qt_gradient_quint32,
+        qt_bitmapblit_quint32,
+        qt_alphamapblit_quint32,
+        qt_alphargbblit_quint32,
+        qt_rectfill_quint32
+    },
+    // Format_RGB8888_Premultiplied
+    {
+        blend_color_generic,
+        qt_gradient_quint32,
+        qt_bitmapblit_quint32,
+        qt_alphamapblit_quint32,
+        qt_alphargbblit_quint32,
+        qt_rectfill_quint32
     }
 };
 
@@ -6043,6 +6121,9 @@ void qInitDrawhelperAsm()
         qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_avx;
         qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_avx;
         qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_avx;
+        qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit32_avx;
+        qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit32_avx;
+        qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit32_avx;
 
         extern void qt_scale_image_argb32_on_argb32_avx(uchar *destPixels, int dbpl,
                                                          const uchar *srcPixels, int sbpl,
@@ -6052,6 +6133,10 @@ void qInitDrawhelperAsm()
                                                          int const_alpha);
         qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_avx;
         qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_avx;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32_avx;
+        qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32_avx;
+#endif
 #endif
 #ifdef QT_COMPILER_SUPPORTS_SSE2
     } else if (features & SSE2) {
@@ -6061,6 +6146,9 @@ void qInitDrawhelperAsm()
         qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2;
         qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
         qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse2;
+        qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit32_sse2;
+        qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit32_sse2;
+        qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
 
         extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
                                                          const uchar *srcPixels, int sbpl,
@@ -6070,6 +6158,10 @@ void qInitDrawhelperAsm()
                                                          int const_alpha);
         qScaleFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2;
         qScaleFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        qScaleFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2;
+        qScaleFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_scale_image_argb32_on_argb32_sse2;
+#endif
 #endif
     }
 
@@ -6088,6 +6180,12 @@ void qInitDrawhelperAsm()
         qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
         qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
         qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_sse2;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_sse2;
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
+#endif
 
         extern const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data,
                                                                       int y, int x, int length);
@@ -6104,6 +6202,10 @@ void qInitDrawhelperAsm()
 
         qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
         qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+#endif
     }
 #endif // SSSE3
 
@@ -6122,6 +6224,12 @@ void qInitDrawhelperAsm()
         qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_avx;
         qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx;
         qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_avx;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_avx;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_avx;
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_avx;
+#endif
 
         extern const uint * QT_FASTCALL qt_fetch_radial_gradient_avx(uint *buffer, const Operator *op, const QSpanData *data,
                                                                      int y, int x, int length);
@@ -6172,6 +6280,12 @@ void qInitDrawhelperAsm()
         qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon;
         qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon;
         qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon;
+        qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon;
+        qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon;
+#endif
 
         qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon;
         qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 0b8a41c..501d13e 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -653,6 +653,31 @@ static Q_ALWAYS_INLINE uint PREMUL(uint x) {
 }
 #endif
 
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+static Q_ALWAYS_INLINE quint32 RGBA2ARGB(quint32 x) {
+    quint32 rgb = x >> 8;
+    quint32 a = x << 24;
+    return a | rgb;
+}
+
+static Q_ALWAYS_INLINE quint32 ARGB2RGBA(quint32 x) {
+    uint rgb = x << 8;
+    uint a = x >> 24;
+    return a | rgb;
+}
+#else
+static Q_ALWAYS_INLINE quint32 RGBA2ARGB(quint32 x) {
+    // RGBA8888 is ABGR32 on little endian.
+    quint32 ag = x & 0xff00ff00;
+    quint32 rg = (x << 16) & 0x00ff0000;
+    quint32 gr = (x >> 16) & 0x000000ff;
+    return ag | rg | gr;
+}
+
+static Q_ALWAYS_INLINE quint32 ARGB2RGBA(quint32 x) {
+    return RGBA2ARGB(x);
+}
+#endif
 
 static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16(uint x, uint a) {
     a += 1;
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 27cb08f..89ccdd4 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -1017,7 +1017,7 @@ QImage qSmoothScaleImage(const QImage &src, int dw, int dh)
         return QImage();
     }
 
-    if (src.format() == QImage::Format_ARGB32_Premultiplied)
+    if (src.format() == QImage::Format_ARGB32_Premultiplied || src.format() == QImage::Format_RGBA8888_Premultiplied)
         qt_qimageScaleArgb(scaleinfo, (unsigned int *)buffer.scanLine(0),
                            0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
     else
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 2cd5216..54164de 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -728,6 +728,24 @@ void tst_QImage::convertToFormat_data()
                                             << int(QImage::Format_RGB888) << 0xffffffffu;
     QTest::newRow("semiblack pm -> rgb888") << int(QImage::Format_ARGB32_Premultiplied) << 0x7f000000u
                                             << int(QImage::Format_RGB888) << 0xff000000u;
+
+    QTest::newRow("red rgba8888 -> argb32") << int(QImage::Format_RGBA8888) << 0xffff0000
+                                      << int(QImage::Format_ARGB32) << 0xffff0000;
+    QTest::newRow("green rgba8888 -> argb32") << int(QImage::Format_RGBA8888) << 0xff00ff00
+                                        << int(QImage::Format_ARGB32) << 0xff00ff00;
+    QTest::newRow("blue rgba8888 -> argb32") << int(QImage::Format_RGBA8888) << 0xff0000ff
+                                       << int(QImage::Format_ARGB32) << 0xff0000ff;
+
+    QTest::newRow("semired rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7fff0000u
+                                       << int(QImage::Format_ARGB32_Premultiplied) << 0x7f7f0000u;
+    QTest::newRow("semigreen rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7f00ff00u
+                                         << int(QImage::Format_ARGB32_Premultiplied) << 0x7f007f00u;
+    QTest::newRow("semiblue rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7f0000ffu
+                                        << int(QImage::Format_ARGB32_Premultiplied) << 0x7f00007fu;
+    QTest::newRow("semiwhite rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7fffffffu
+                                         << int(QImage::Format_ARGB32_Premultiplied) << 0x7f7f7f7fu;
+    QTest::newRow("semiblack rgba8888 -> argb pm") << int(QImage::Format_RGBA8888) << 0x7f000000u
+                                         << int(QImage::Format_ARGB32_Premultiplied) << 0x7f000000u;
 }
 
 
@@ -953,6 +971,10 @@ void tst_QImage::rotate_data()
             << QImage::Format_RGB888 << d;
         QTest::newRow(qPrintable(title.arg("Format_Indexed8")))
             << QImage::Format_Indexed8 << d;
+        QTest::newRow(qPrintable(title.arg("Format_RGBX8888")))
+            << QImage::Format_RGBX8888 << d;
+        QTest::newRow(qPrintable(title.arg("Format_RGBA8888_Premultiplied")))
+            << QImage::Format_RGBA8888_Premultiplied << d;
     }
 }
 
@@ -1161,6 +1183,21 @@ void tst_QImage::setPixel_data()
                                   << 0xff00ff00 << 0x00ff00u;
     QTest::newRow("RGB888 blue") << int(QImage::Format_RGB888)
                                  << 0xff0000ff << 0x0000ffu;
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+    QTest::newRow("RGBA8888 red") << int(QImage::Format_RGBA8888)
+                                << 0xffff0000u << 0xff0000ffu;
+    QTest::newRow("RGBA8888 green") << int(QImage::Format_RGBA8888)
+                                  << 0xff00ff00u << 0x00ff00ffu;
+    QTest::newRow("RGBA8888 blue") << int(QImage::Format_RGBA8888)
+                                 << 0xff0000ffu << 0x0000ffffu;
+#else
+    QTest::newRow("RGBA8888 red") << int(QImage::Format_RGBA8888)
+                                << 0xffff0000u << 0xff0000ffu;
+    QTest::newRow("RGBA8888 green") << int(QImage::Format_RGBA8888)
+                                  << 0xff00ff00u << 0xff00ff00u;
+    QTest::newRow("RGBA8888 blue") << int(QImage::Format_RGBA8888)
+                                 << 0xff0000ffu << 0xffff0000u;
+#endif
 }
 
 void tst_QImage::setPixel()
@@ -1184,6 +1221,9 @@ void tst_QImage::setPixel()
     case int(QImage::Format_RGB32):
     case int(QImage::Format_ARGB32):
     case int(QImage::Format_ARGB32_Premultiplied):
+    case int(QImage::Format_RGBX8888):
+    case int(QImage::Format_RGBA8888):
+    case int(QImage::Format_RGBA8888_Premultiplied):
     {
         for (int y = 0; y < h; ++y) {
             const quint32 *row = (const quint32*)(img.scanLine(y));
