ticket1357_detect_libtiff4.patch
src/core/raster/qgsrasterlayer.cpp (copie de travail) | ||
---|---|---|
1014 | 1014 | |
1015 | 1015 |
if ( theTryInternalFlag ) |
1016 | 1016 |
{ |
1017 |
QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) ); |
|
1018 |
if ( "JPEG" == myCompressionType ) |
|
1017 |
// libtiff < 4.0 has a bug that prevents safe building of overviews on JPEG compressed files |
|
1018 |
// we detect libtiff < 4.0 by checking that BIGTIFF is not in the creation options of the GTiff driver |
|
1019 |
// see https://trac.osgeo.org/qgis/ticket/1357 |
|
1020 |
const char* pszGTiffCreationOptions = |
|
1021 |
GDALGetMetadataItem(GDALGetDriverByName("GTiff"), GDAL_DMD_CREATIONOPTIONLIST, ""); |
|
1022 |
if (strstr(pszGTiffCreationOptions, "BIGTIFF") == NULL) |
|
1019 | 1023 |
{ |
1020 |
return "ERROR_JPEG_COMPRESSION"; |
|
1024 |
QString myCompressionType = QString( GDALGetMetadataItem( mGdalDataset, "COMPRESSION", "IMAGE_STRUCTURE" ) ); |
|
1025 |
if ( "JPEG" == myCompressionType ) |
|
1026 |
{ |
|
1027 |
return "ERROR_JPEG_COMPRESSION"; |
|
1028 |
} |
|
1021 | 1029 |
} |
1030 | ||
1022 | 1031 |
//close the gdal dataset and reopen it in read / write mode |
1023 | 1032 |
GDALClose( mGdalDataset ); |
1024 | 1033 |
mGdalBaseDataset = GDALOpen( QFile::encodeName( mDataSource ).constData(), GA_Update ); |