From 44ea4280b20179eea5520fd1ef5ac814c528c45e Mon Sep 17 00:00:00 2001 From: Leonard Lee Date: Mon, 4 Feb 2013 15:03:05 +0100 Subject: Fix TIFFTAG_RESOLUTIONUNIT handling. If there is no TIFFTAG_RESOLUTIONUNIT record, the value of resUnit should be RESUNIT_INCH and not RESUNIT_NONE. Task-number: QTBUG-22322 Change-Id: Idb1ffeec85fdb5a23d93fa53505440a9e2f8914e Reviewed-by: aavit --- src/plugins/imageformats/tiff/qtiffhandler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/plugins/imageformats/tiff/qtiffhandler.cpp') diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp index b2921c0..ef76a6d 100644 --- a/src/plugins/imageformats/tiff/qtiffhandler.cpp +++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp @@ -289,9 +289,11 @@ bool QTiffHandler::read(QImage *image) float resX = 0; float resY = 0; - uint16 resUnit = RESUNIT_NONE; - if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit) - && TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX) + uint16 resUnit; + if (!TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit)) + resUnit = RESUNIT_INCH; + + if (TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX) && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) { switch(resUnit) { -- cgit v1.2.3