void QX11Data::copyQImageToXImage(const QImage &image, XImage *ximage)
{
Q_ASSERT(ximage);
+ Q_ASSERT(image.depth() == 32);
ximage->data = static_cast<char*>(::malloc(size_t(ximage->bytes_per_line) * image.height()));
Q_CHECK_PTR(ximage->data);
const int h = image.height();
if (ximage->bits_per_pixel == image.depth()) {
- bool checkbyteorder = true;
-
switch(image.format()) {
case QImage::Format_RGB32: {
uint *xidata = (uint *)ximage->data;
break;
}
default: {
- checkbyteorder = false;
- for (int h = 0; h < image.height(); h++) {
- for (int w = 0; w < image.width(); w++) {
- const QRgb pixel = image.pixel(w, h);
- XPutPixel(ximage, w, h, pixel);
- }
- }
+ Q_ASSERT(false);
break;
}
}
- if (checkbyteorder && (ximage->byte_order == MSBFirst) != (Q_BYTE_ORDER == Q_BIG_ENDIAN)) {
+ if ((ximage->byte_order == MSBFirst) != (Q_BYTE_ORDER == Q_BIG_ENDIAN)) {
uint *xidata = (uint *)ximage->data;
uint *xiend = xidata + w*h;
while (xidata < xiend) {