summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2012-06-19 14:18:16 +0200
committerQt by Nokia <qt-info@nokia.com>2012-06-21 09:01:32 +0200
commitc7e21f392355fddcf586815ed42279a3663bf981 (patch)
tree6cc0a8f6a0bceae7ebd88eaf9cf6b8bd6f418b56 /src
parent1838a6c2fb5e3b4368c871aa330d028b255b83af (diff)
Avoid unnecessary detach when saving to BMP.
Task-number: QTBUG-11486 Change-Id: Ic9aa733da4f23dc3eaba111c97a39bfd911f8cb3 Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qbmphandler.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 8ff1e43b71..fd5ce87b3c 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -624,7 +624,7 @@ bool qt_write_dib(QDataStream &s, QImage image)
if (nbits == 1 || nbits == 8) { // direct output
for (y=image.height()-1; y>=0; y--) {
- if (d->write((char*)image.scanLine(y), bpl) == -1)
+ if (d->write((char*)image.constScanLine(y), bpl) == -1)
return false;
}
return true;
@@ -632,12 +632,12 @@ bool qt_write_dib(QDataStream &s, QImage image)
uchar *buf = new uchar[bpl_bmp];
uchar *b, *end;
- register uchar *p;
+ register const uchar *p;
memset(buf, 0, bpl_bmp);
for (y=image.height()-1; y>=0; y--) { // write the image bits
if (nbits == 4) { // convert 8 -> 4 bits
- p = image.scanLine(y);
+ p = image.constScanLine(y);
b = buf;
end = b + image.width()/2;
while (b < end) {
@@ -647,8 +647,8 @@ bool qt_write_dib(QDataStream &s, QImage image)
if (image.width() & 1)
*b = *p << 4;
} else { // 32 bits
- QRgb *p = (QRgb *)image.scanLine(y);
- QRgb *end = p + image.width();
+ const QRgb *p = (const QRgb *)image.constScanLine(y);
+ const QRgb *end = p + image.width();
b = buf;
while (p < end) {
*b++ = qBlue(*p);