48 lines
1.6 KiB
Plaintext
48 lines
1.6 KiB
Plaintext
$OpenBSD: patch-src_imageutils_jpegcontent_cpp,v 1.2 2009/09/10 16:43:35 sthen Exp $
|
|
|
|
second two hunks: adapt to exiv2 0.18, from Gentoo via FreeBSD
|
|
|
|
--- src/imageutils/jpegcontent.cpp.orig Fri Jul 17 23:00:09 2009
|
|
+++ src/imageutils/jpegcontent.cpp Fri Jul 17 23:00:12 2009
|
|
@@ -329,12 +329,17 @@ int JPEGContent::dotsPerMeter(const QString& keyName)
|
|
// 2 = inches
|
|
// 3 = centimeters
|
|
// Other = reserved
|
|
- const float INCHESPERMETER = (100. / 2.54);
|
|
+ const double INCHESPERMETER = (100. / 2.54);
|
|
+ Exiv2::Rational r = it->toRational();
|
|
+ if (r.second == 0) {
|
|
+ // a rational with 0 as second will make hang toLong() conversion
|
|
+ r.second = 1;
|
|
+ }
|
|
switch (res) {
|
|
case 3: // dots per cm
|
|
- return (it->toLong() * 100);
|
|
+ return int(double(r.first) * 100 / double(r.second));
|
|
default: // dots per inch
|
|
- return (it->toLong() * INCHESPERMETER);
|
|
+ return int(double(r.first) * INCHESPERMETER / double(r.second));
|
|
}
|
|
|
|
return 0;
|
|
@@ -589,7 +594,8 @@ void JPEGContent::applyPendingTransformation() {
|
|
QImage JPEGContent::thumbnail() const {
|
|
QImage image;
|
|
if (!d->mExifData.empty()) {
|
|
- Exiv2::DataBuf thumbnail = d->mExifData.copyThumbnail();
|
|
+ Exiv2::ExifThumbC thumb(d->mExifData);
|
|
+ Exiv2::DataBuf const thumbnail = thumb.copy();
|
|
image.loadFromData(thumbnail.pData_, thumbnail.size_);
|
|
}
|
|
return image;
|
|
@@ -611,7 +617,8 @@ void JPEGContent::setThumbnail(const QImage& thumbnail
|
|
return;
|
|
}
|
|
|
|
- d->mExifData.setJpegThumbnail((unsigned char*)array.data(), array.size());
|
|
+ Exiv2::ExifThumb thumb(d->mExifData);
|
|
+ thumb.setJpegThumbnail((unsigned char*)array.data(), array.size());
|
|
}
|
|
|
|
|