diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2009-10-15 03:21:30 (GMT) |
---|---|---|
committer | Andreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com> | 2009-12-23 12:27:46 (GMT) |
commit | 5c0a117f62607ed439cdfa3d94aaef627c47ce8a (patch) | |
tree | 93f18723ee6cf98d6fc217a664d84d231f3efa9b /src/gui/image/qpnghandler.cpp | |
parent | d2f10dae860cea0de33b4cb9005ba8d2203ce1d1 (diff) | |
download | Qt-5c0a117f62607ed439cdfa3d94aaef627c47ce8a.zip Qt-5c0a117f62607ed439cdfa3d94aaef627c47ce8a.tar.gz Qt-5c0a117f62607ed439cdfa3d94aaef627c47ce8a.tar.bz2 |
png: Avoid calling QImage::scanLine(int) from within a loop
Reviewed-by: Andreas
Diffstat (limited to 'src/gui/image/qpnghandler.cpp')
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 14c863b..1de0f32 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -67,6 +67,9 @@ QT_BEGIN_NAMESPACE # define Q_INTERNAL_WIN_NO_THROW #endif +// avoid going through QImage::scanLine() which calls detach +#define FAST_SCAN_LINE(data, bpl, y) (data + (y) * bpl) + /* All PNG files load to the minimal QImage equivalent. @@ -510,7 +513,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) && outImage->format() == QImage::Format_Indexed8) { int color_table_size = outImage->colorCount(); for (int y=0; y<(int)height; ++y) { - uchar *p = outImage->scanLine(y); + uchar *p = FAST_SCAN_LINE(data, bpl, y); uchar *end = p + width; while (p < end) { if (*p >= color_table_size) |