summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorWater-Team <water@pad.test.qt.nokia.com>2011-10-10 23:00:14 (GMT)
committerWater-Team <water@pad.test.qt.nokia.com>2011-10-10 23:00:14 (GMT)
commit3e7056ad406d59eb4a052f02f82ba92ab474ea0e (patch)
tree3106d240d8fb0a70d340c33a0f8269fd4a3f96bc /src/gui/image
parentecd78168271cfe71715e074a50752712f4aa3229 (diff)
parent22d7b6c1afb3e8558941052b09f755cceb0a46fd (diff)
downloadQt-3e7056ad406d59eb4a052f02f82ba92ab474ea0e.zip
Qt-3e7056ad406d59eb4a052f02f82ba92ab474ea0e.tar.gz
Qt-3e7056ad406d59eb4a052f02f82ba92ab474ea0e.tar.bz2
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qnativeimage.cpp12
-rw-r--r--src/gui/image/qpixmap_x11.cpp18
2 files changed, 19 insertions, 11 deletions
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index aebcbaf..e1382dd 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -153,7 +153,12 @@ QImage::Format QNativeImage::systemFormat()
QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* isTextBuffer */, QWidget *widget)
: xshmimg(0), xshmpm(0)
{
- if (!X11->use_mitshm) {
+ QX11Info info = widget->x11Info();
+
+ int dd = info.depth();
+ Visual *vis = (Visual*) info.visual();
+
+ if (!X11->use_mitshm || format != QImage::Format_RGB16 && X11->bppForDepth.value(dd) != 32) {
image = QImage(width, height, format);
// follow good coding practice and set xshminfo attributes, though values not used in this case
xshminfo.readOnly = true;
@@ -163,11 +168,6 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /*
return;
}
- QX11Info info = widget->x11Info();
-
- int dd = info.depth();
- Visual *vis = (Visual*) info.visual();
-
xshmimg = XShmCreateImage(X11->display, vis, dd, ZPixmap, 0, &xshminfo, width, height);
if (!xshmimg) {
qWarning("QNativeImage: Unable to create shared XImage.");
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 77c2a2a..0e1401c 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -897,12 +897,20 @@ void QX11PixmapData::fromImage(const QImage &img,
}
)
break;
- case BPP24_888: // 24 bit MSB
+ case BPP24_888:
CYCLE(
- for (int x=0; x<w; x++) {
- *dst++ = qRed (*p);
- *dst++ = qGreen(*p);
- *dst++ = qBlue (*p++);
+ if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
+ for (int x=0; x<w; x++) {
+ *dst++ = qRed (*p);
+ *dst++ = qGreen(*p);
+ *dst++ = qBlue (*p++);
+ }
+ } else {
+ for (int x=0; x<w; x++) {
+ *dst++ = qBlue (*p);
+ *dst++ = qGreen(*p);
+ *dst++ = qRed (*p++);
+ }
}
)
break;