summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2013-08-08 12:32:51 (GMT)
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-08 16:08:05 (GMT)
commitce86061d9ffd2d0c9f84ff48d6d10fd4dcef8016 (patch)
tree7333055420e094bcd2fddbe5597f8fc6c7086130 /src/gui/image
parente71627b6f0264ced58d90d88b8fe843268bdef34 (diff)
downloadQt-ce86061d9ffd2d0c9f84ff48d6d10fd4dcef8016.zip
Qt-ce86061d9ffd2d0c9f84ff48d6d10fd4dcef8016.tar.gz
Qt-ce86061d9ffd2d0c9f84ff48d6d10fd4dcef8016.tar.bz2
Add offset reading support in pnghandler
This patch adds the offset reading that matches the offset writing in writeImage Qt 5 fix commit 0b62a5d3c931aa4d91b986ec518567e9463a6360 Task-number: QTBUG-32674 Change-Id: I64f7e31049834ecbd052a061b79d3ed97e60e063 Reviewed-by: aavit <eirik.aavitsland@digia.com> Reviewed-by: Laszlo Papp <lpapp@kde.org>
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qpnghandler.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index fd0dd91..ac78610 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -492,10 +492,14 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
png_uint_32 width;
png_uint_32 height;
+ png_int_32 offset_x;
+ png_int_32 offset_y;
int bit_depth;
int color_type;
+ int unit_type;
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
0, 0, 0);
+ png_get_oFFs(png_ptr, info_ptr, &offset_x, &offset_y, &unit_type);
uchar *data = outImage->bits();
int bpl = outImage->bytesPerLine();
@@ -527,6 +531,9 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr));
outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr));
+ if (unit_type == PNG_OFFSET_PIXEL)
+ outImage->setOffset(QPoint(offset_x, offset_y));
+
state = ReadingEnd;
png_read_end(png_ptr, end_info);