diff options
author | Leonard Lee <leonard.lee@digia.com> | 2013-02-06 09:40:51 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-06 20:05:45 (GMT) |
commit | 763f8e4861108a55fafe267f3e36c2ed222b3271 (patch) | |
tree | 3c9ab4970b32ee2ca005859897ca78138d60d888 | |
parent | 1fd9b8856cba6e2d3252efabc0f2c1217b1a35eb (diff) | |
download | Qt-763f8e4861108a55fafe267f3e36c2ed222b3271.zip Qt-763f8e4861108a55fafe267f3e36c2ed222b3271.tar.gz Qt-763f8e4861108a55fafe267f3e36c2ed222b3271.tar.bz2 |
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: Iedc3120d331308cea9f743de2e4d61cb52cb14c3
(Cherry picked from commit
qtimageformats/44ea4280b20179eea5520fd1ef5ac814c528c45e.)
Reviewed-by: aavit <eirik.aavitsland@digia.com>
-rw-r--r-- | src/gui/image/qtiffhandler.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp index c297cf4..110d376 100644 --- a/src/gui/image/qtiffhandler.cpp +++ b/src/gui/image/qtiffhandler.cpp @@ -295,11 +295,12 @@ 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) - && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) { + uint16 resUnit; + if (!TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit)) + resUnit = RESUNIT_INCH; + if (TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX) + && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) { switch(resUnit) { case RESUNIT_CENTIMETER: image->setDotsPerMeterX(qRound(resX * 100)); |