Auto-detect Endianess of image data by looking at width value.

Change-Id: I403fe7dcf841129e4c24b2c2787f58aa94540c6e
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Friedemann Kleint
2012-12-28 18:57:33 +01:00
committed by hjk
parent 7bc0818d7a
commit 82b781f5a7

View File

@@ -1678,7 +1678,8 @@ void WatchHandler::showEditValue(const WatchData &data)
if (data.editformat == DisplayImageData) {
ba = QByteArray::fromHex(data.editvalue);
const int *header = (int *)(ba.data());
swapEndian(ba.data(), ba.size());
if (!ba.at(0) && !ba.at(1)) // Check on 'width' for Python dumpers returning 4-byte swapped-data.
swapEndian(ba.data(), ba.size());
bits = 12 + (uchar *)(ba.data());
width = header[0];
height = header[1];