summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-13 10:09:53 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-13 10:33:13 +0200
commit5114fcb45d584ea50da7397088f084dfd74922b9 (patch)
tree18cb40f048186ebf0eac568e2ae53ec092044c55 /src/gui/image/qimage.cpp
parent55e47566dd1ac83ff674401dfd6284f07490cd8b (diff)
parentee62807198a2525577c14f718b98d07ae0ec7bec (diff)
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/gui/painting/qpainter.cpp src/gui/text/qtextengine.cpp tests/auto/qimage/tst_qimage.cpp tests/auto/qpainter/tst_qpainter.cpp tools/qdoc3/test/assistant.qdocconf tools/qdoc3/test/designer.qdocconf tools/qdoc3/test/linguist.qdocconf tools/qdoc3/test/qmake.qdocconf tools/qdoc3/test/qt-build-docs.qdocconf tools/qdoc3/test/qt-html-templates.qdocconf tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf tools/qdoc3/test/qt.qdocconf
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp84
1 files changed, 43 insertions, 41 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 0e7ced83e1..300e04b4ee 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -3851,6 +3851,14 @@ void qInitImageConversions()
converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_ssse3;
}
#endif
+#ifdef QT_HAVE_NEON
+ if (features & NEON) {
+ extern void convert_RGB888_to_RGB32_neon(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+ converter_map[QImage::Format_RGB888][QImage::Format_RGB32] = convert_RGB888_to_RGB32_neon;
+ converter_map[QImage::Format_RGB888][QImage::Format_ARGB32] = convert_RGB888_to_RGB32_neon;
+ converter_map[QImage::Format_RGB888][QImage::Format_ARGB32_Premultiplied] = convert_RGB888_to_RGB32_neon;
+ }
+#endif
}
/*!
@@ -4911,7 +4919,7 @@ QImage QImage::rgbSwapped() const
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
uint *q = (uint*)res.scanLine(i);
- uint *p = (uint*)scanLine(i);
+ uint *p = (uint*)constScanLine(i);
uint *end = p + d->width;
while (p < end) {
*q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | (*p & 0xff00ff00);
@@ -4925,7 +4933,7 @@ QImage QImage::rgbSwapped() const
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
ushort *q = (ushort*)res.scanLine(i);
- const ushort *p = (const ushort*)scanLine(i);
+ const ushort *p = (const ushort*)constScanLine(i);
const ushort *end = p + d->width;
while (p < end) {
*q = ((*p << 11) & 0xf800) | ((*p >> 11) & 0x1f) | (*p & 0x07e0);
@@ -4938,12 +4946,15 @@ QImage QImage::rgbSwapped() const
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
- quint8 *p = (quint8*)scanLine(i);
+ const quint8 *p = constScanLine(i);
+ quint8 *q = res.scanLine(i);
const quint8 *end = p + d->width * sizeof(qargb8565);
while (p < end) {
- quint16 *q = reinterpret_cast<quint16*>(p + 1);
- *q = ((*q << 11) & 0xf800) | ((*q >> 11) & 0x1f) | (*q & 0x07e0);
+ q[0] = p[0];
+ q[1] = (p[1] & 0xe0) | (p[2] >> 3);
+ q[2] = (p[2] & 0x07) | (p[1] << 3);
p += sizeof(qargb8565);
+ q += sizeof(qargb8565);
}
}
break;
@@ -4952,7 +4963,7 @@ QImage QImage::rgbSwapped() const
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
qrgb666 *q = reinterpret_cast<qrgb666*>(res.scanLine(i));
- const qrgb666 *p = reinterpret_cast<const qrgb666*>(scanLine(i));
+ const qrgb666 *p = reinterpret_cast<const qrgb666*>(constScanLine(i));
const qrgb666 *end = p + d->width;
while (p < end) {
const QRgb rgb = quint32(*p++);
@@ -4964,12 +4975,15 @@ QImage QImage::rgbSwapped() const
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
- qargb6666 *q = reinterpret_cast<qargb6666*>(res.scanLine(i));
- const qargb6666 *p = reinterpret_cast<const qargb6666*>(scanLine(i));
- const qargb6666 *end = p + d->width;
+ const quint8 *p = constScanLine(i);
+ const quint8 *end = p + d->width * sizeof(qargb6666);
+ quint8 *q = res.scanLine(i);
while (p < end) {
- const QRgb rgb = quint32(*p++);
- *q++ = qRgba(qBlue(rgb), qGreen(rgb), qRed(rgb), qAlpha(rgb));
+ q[0] = (p[1] >> 4) | ((p[2] & 0x3) << 4) | (p[0] & 0xc0);
+ q[1] = (p[1] & 0xf) | (p[0] << 4);
+ q[2] = (p[2] & 0xfc) | ((p[0] >> 4) & 0x3);
+ p += sizeof(qargb6666);
+ q += sizeof(qargb6666);
}
}
break;
@@ -4977,11 +4991,11 @@ QImage QImage::rgbSwapped() const
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
- ushort *q = (ushort*)res.scanLine(i);
- const ushort *p = (const ushort*)scanLine(i);
- const ushort *end = p + d->width;
+ quint16 *q = (quint16*)res.scanLine(i);
+ const quint16 *p = (const quint16*)constScanLine(i);
+ const quint16 *end = p + d->width;
while (p < end) {
- *q = ((*p << 10) & 0x7800) | ((*p >> 10) & 0x1f) | (*p & 0x83e0);
+ *q = ((*p << 10) & 0x7c00) | ((*p >> 10) & 0x1f) | (*p & 0x3e0);
p++;
q++;
}
@@ -4991,12 +5005,15 @@ QImage QImage::rgbSwapped() const
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
- quint8 *p = (quint8*)scanLine(i);
+ const quint8 *p = constScanLine(i);
+ quint8 *q = res.scanLine(i);
const quint8 *end = p + d->width * sizeof(qargb8555);
while (p < end) {
- quint16 *q = reinterpret_cast<quint16*>(p + 1);
- *q = ((*q << 10) & 0x7800) | ((*q >> 10) & 0x1f) | (*q & 0x83e0);
+ q[0] = p[0];
+ q[1] = (p[1] & 0xe0) | (p[2] >> 2);
+ q[2] = (p[2] & 0x03) | ((p[1] << 2) & 0x7f);
p += sizeof(qargb8555);
+ q += sizeof(qargb8555);
}
}
break;
@@ -5004,8 +5021,8 @@ QImage QImage::rgbSwapped() const
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
- quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i));
- const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i));
+ quint8 *q = res.scanLine(i);
+ const quint8 *p = constScanLine(i);
const quint8 *end = p + d->width * sizeof(qrgb888);
while (p < end) {
q[0] = p[2];
@@ -5017,32 +5034,17 @@ QImage QImage::rgbSwapped() const
}
break;
case Format_RGB444:
- res = QImage(d->width, d->height, d->format);
- QIMAGE_SANITYCHECK_MEMORY(res);
- for (int i = 0; i < d->height; i++) {
- quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i));
- const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i));
- const quint8 *end = p + d->width * sizeof(qrgb444);
- while (p < end) {
- q[0] = (p[0] & 0xf0) | ((p[1] & 0x0f) << 8);
- q[1] = ((p[0] & 0x0f) >> 8) | (p[1] & 0xf0);
- q += sizeof(qrgb444);
- p += sizeof(qrgb444);
- }
- }
- break;
case Format_ARGB4444_Premultiplied:
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
- quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i));
- const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i));
- const quint8 *end = p + d->width * sizeof(qargb4444);
+ quint16 *q = reinterpret_cast<quint16*>(res.scanLine(i));
+ const quint16 *p = reinterpret_cast<const quint16*>(constScanLine(i));
+ const quint16 *end = p + d->width;
while (p < end) {
- q[0] = (p[0] & 0xf0) | ((p[1] & 0x0f) << 8);
- q[1] = ((p[0] & 0x0f) >> 8) | (p[1] & 0xf0);
- q += sizeof(qargb4444);
- p += sizeof(qargb4444);
+ *q = (*p & 0xf0f0) | ((*p & 0x0f) << 8) | ((*p & 0xf00) >> 8);
+ p++;
+ q++;
}
}
break;