author | alwin <alwin> | 2004-11-01 13:33:51 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-01 13:33:51 (UTC) |
commit | 915af02212ea80e43da5bcc24415e3e48778bea9 (patch) (unidiff) | |
tree | eff6dbcc2f1e62dfbb8f6ababe183306fe2077e1 | |
parent | b3153506a1be76a386f23a3af44f84042d148111 (diff) | |
download | opie-915af02212ea80e43da5bcc24415e3e48778bea9.zip opie-915af02212ea80e43da5bcc24415e3e48778bea9.tar.gz opie-915af02212ea80e43da5bcc24415e3e48778bea9.tar.bz2 |
when jpeg image is smaller than requested thumbsize it will not use
scaled loading
-rw-r--r-- | noncore/graphics/opie-eye/slave/jpeg_slave.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp index fb7d5de..1bb81d9 100644 --- a/noncore/graphics/opie-eye/slave/jpeg_slave.cpp +++ b/noncore/graphics/opie-eye/slave/jpeg_slave.cpp | |||
@@ -15,3 +15,3 @@ using namespace Opie::Core; | |||
15 | /** | 15 | /** |
16 | exif.h | 16 | exif.h |
17 | */ | 17 | */ |
@@ -268,3 +268,3 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) | |||
268 | 268 | ||
269 | owarn << "too many padding bytes" << oendl; | 269 | owarn << "too many padding bytes" << oendl; |
270 | return false; | 270 | return false; |
@@ -333,3 +333,3 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) | |||
333 | case M_EOI: // in case it's a tables-only JPEG stream | 333 | case M_EOI: // in case it's a tables-only JPEG stream |
334 | owarn << "No image in jpeg!" << oendl; | 334 | owarn << "No image in jpeg!" << oendl; |
335 | return false; | 335 | return false; |
@@ -337,6 +337,6 @@ int ExifData::ReadJpegSections (QFile & infile, ReadMode_t ReadMode) | |||
337 | case M_COM: // Comment section | 337 | case M_COM: // Comment section |
338 | // pieczy 2002-02-12 | 338 | // pieczy 2002-02-12 |
339 | // now the User comment goes to UserComment | 339 | // now the User comment goes to UserComment |
340 | // so we can store a Comment section also in READ_EXIF mode | 340 | // so we can store a Comment section also in READ_EXIF mode |
341 | process_COM(Data, itemlen); | 341 | process_COM(Data, itemlen); |
342 | break; | 342 | break; |
@@ -549,3 +549,3 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
549 | ExifData::CameraModel = QString((char*)ValuePtr); | 549 | ExifData::CameraModel = QString((char*)ValuePtr); |
550 | break; | 550 | break; |
551 | 551 | ||
@@ -556,3 +556,3 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
556 | case TAG_DATETIME_ORIGINAL: | 556 | case TAG_DATETIME_ORIGINAL: |
557 | DateTime = QString((char*)ValuePtr); | 557 | DateTime = QString((char*)ValuePtr); |
558 | break; | 558 | break; |
@@ -591,3 +591,3 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
591 | // (overwrite previously computd value if there is one) | 591 | // (overwrite previously computd value if there is one) |
592 | ExifData::ApertureFNumber = (float)ConvertAnyFormat(ValuePtr, Format); | 592 | ExifData::ApertureFNumber = (float)ConvertAnyFormat(ValuePtr, Format); |
593 | break; | 593 | break; |
@@ -668,4 +668,4 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
668 | case TAG_EXPOSURE_BIAS: | 668 | case TAG_EXPOSURE_BIAS: |
669 | ExifData::ExposureBias = (float)ConvertAnyFormat(ValuePtr, Format); | 669 | ExifData::ExposureBias = (float)ConvertAnyFormat(ValuePtr, Format); |
670 | break; | 670 | break; |
671 | 671 | ||
@@ -673,3 +673,3 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
673 | ExifData::Whitebalance = (int)ConvertAnyFormat(ValuePtr, Format); | 673 | ExifData::Whitebalance = (int)ConvertAnyFormat(ValuePtr, Format); |
674 | break; | 674 | break; |
675 | 675 | ||
@@ -722,6 +722,6 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
722 | Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries)); | 722 | Offset = Get32u(DIR_ENTRY_ADDR(DirStart, NumDirEntries)); |
723 | // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT. | 723 | // There is at least one jpeg from an HP camera having an Offset of almost MAXUINT. |
724 | // Adding OffsetBase to it produces an overflow, so compare with ExifLength here. | 724 | // Adding OffsetBase to it produces an overflow, so compare with ExifLength here. |
725 | // See http://bugs.kde.org/show_bug.cgi?id=54542 | 725 | // See http://bugs.kde.org/show_bug.cgi?id=54542 |
726 | if (Offset && Offset < ExifLength){ | 726 | if (Offset && Offset < ExifLength){ |
727 | SubdirStart = OffsetBase + Offset; | 727 | SubdirStart = OffsetBase + Offset; |
@@ -732,3 +732,3 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
732 | // I'll just let it pass silently | 732 | // I'll just let it pass silently |
733 | owarn << "Thumbnail removed with Jhead 1.3 or earlier" << oendl; | 733 | owarn << "Thumbnail removed with Jhead 1.3 or earlier" << oendl; |
734 | }else{ | 734 | }else{ |
@@ -750,3 +750,3 @@ void ExifData::ProcessExifDir(unsigned char * DirStart, unsigned char * OffsetBa | |||
750 | // The thumbnail pointer appears to be valid. Store it. | 750 | // The thumbnail pointer appears to be valid. Store it. |
751 | Thumbnail.loadFromData(OffsetBase + ThumbnailOffset, ThumbnailSize, "JPEG"); | 751 | Thumbnail.loadFromData(OffsetBase + ThumbnailOffset, ThumbnailSize, "JPEG"); |
752 | } | 752 | } |
@@ -919,3 +919,3 @@ bool ExifData::scan(const QString & path) | |||
919 | if (ret == false){ | 919 | if (ret == false){ |
920 | owarn << "Not JPEG file!" << oendl; | 920 | owarn << "Not JPEG file!" << oendl; |
921 | DiscardData(); | 921 | DiscardData(); |
@@ -1417,2 +1417,4 @@ QPixmap JpegSlave::pixmap( const QString& path, int wid, int hei) { | |||
1417 | ExifData ImageInfo; | 1417 | ExifData ImageInfo; |
1418 | /* | ||
1419 | */ | ||
1418 | if ( !ImageInfo.scan( path ) || ImageInfo.isNullThumbnail() ) { | 1420 | if ( !ImageInfo.scan( path ) || ImageInfo.isNullThumbnail() ) { |
@@ -1420,4 +1422,10 @@ QPixmap JpegSlave::pixmap( const QString& path, int wid, int hei) { | |||
1420 | QImageIO iio( path, 0l ); | 1422 | QImageIO iio( path, 0l ); |
1421 | QString str = QString( "Fast Shrink( 4 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); | 1423 | if (wid < ImageInfo.getWidth() || hei<ImageInfo.getHeight()) { |
1422 | iio.setParameters( str.latin1() );// will be strdupped anyway | 1424 | odebug << "Scaling "<<ImageInfo.getWidth()<<"x"<<ImageInfo.getHeight() |
1425 | << " to "<<wid<<"x"<<hei<< " ("<<path<<")"<<oendl; | ||
1426 | QString str = QString( "Fast Shrink( 4 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); | ||
1427 | iio.setParameters( str.latin1() );// will be strdupped anyway | ||
1428 | } else { | ||
1429 | odebug << "Not scaling "<<ImageInfo.getWidth()<<"x"<<ImageInfo.getHeight()<< " ("<<path<<")"<<oendl; | ||
1430 | } | ||
1423 | img = iio.read() ? iio.image() : QImage(); | 1431 | img = iio.read() ? iio.image() : QImage(); |