extragear/graphics/gwenview
Angelo Naselli <[email protected]>
| Newsgroups | gmane.comp.kde.gwenview |
|---|---|
| Message-ID | <[email protected]> |
SVN commit 648473 by anaselli:
Fixed code style
CCMAIL:gwenview-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
M +2 -2 gvcore/imageloader.cpp
M +12 -31 imageutils/jpegcontent.cpp
M +3 -2 imageutils/jpegcontent.h
--- trunk/extragear/graphics/gwenview/gvcore/imageloader.cpp #648472:648473
@@ -673,8 +673,8 @@
QSize size = content.size();
d->mProcessedImage = QImage(size, d->mDecoder.image().depth());
}
- d->mProcessedImage.setDotsPerMeterX(content.getDotsPerMeterX());
- d->mProcessedImage.setDotsPerMeterY(content.getDotsPerMeterY());
+ d->mProcessedImage.setDotsPerMeterX(content.dotsPerMeterX());
+ d->mProcessedImage.setDotsPerMeterY(content.dotsPerMeterY());
} else {
kdWarning() << "ImageLoader::changed(): JPEGContent could not load '" << d->mURL.prettyURL() << "'\n";
}
--- trunk/extragear/graphics/gwenview/imageutils/jpegcontent.cpp #648472:648473
@@ -290,45 +290,26 @@
}
-int JPEGContent::getDotsPerMeterX() const {
- Exiv2::ExifKey keyResUnit("Exif.Image.ResolutionUnit");
- Exiv2::ExifData::iterator it = d->mExifData.findKey(keyResUnit);
- if (it == d->mExifData.end()) {
- return 0;
- }
- int XRes = it->toLong();
- Exiv2::ExifKey keyXResolution("Exif.Image.XResolution");
- it = d->mExifData.findKey(keyXResolution);
- if (it == d->mExifData.end()) {
- return 0;
- }
- // The unit for measuring XResolution and YResolution. The same unit is used for both XResolution and YResolution.
- // If the image resolution in unknown, 2 (inches) is designated.
- // Default = 2
- // 2 = inches
- // 3 = centimeters
- // Other = reserved
- const float INCHESPERMETER = (100. / 2.54);
- switch (XRes) {
- case 3: // dots per cm
- return (it->toLong() * 100);
- default: // dots per inch
- return (it->toLong() * INCHESPERMETER);
- }
+int JPEGContent::dotsPerMeterX() const {
+ return dotsPerMeter("XResolution");
+}
- return 0;
+
+int JPEGContent::dotsPerMeterY() const {
+ return dotsPerMeter("YResolution");
}
-int JPEGContent::getDotsPerMeterY() const {
+int JPEGContent::dotsPerMeter(const QString& keyName) const {
Exiv2::ExifKey keyResUnit("Exif.Image.ResolutionUnit");
Exiv2::ExifData::iterator it = d->mExifData.findKey(keyResUnit);
if (it == d->mExifData.end()) {
return 0;
}
- int YRes = it->toLong();
- Exiv2::ExifKey keyYResolution("Exif.Image.YResolution");
- it = d->mExifData.findKey(keyYResolution);
+ int res = it->toLong();
+ QString keyVal = "Exif.Image." + keyName;
+ Exiv2::ExifKey keyResolution(keyVal.ascii());
+ it = d->mExifData.findKey(keyResolution);
if (it == d->mExifData.end()) {
return 0;
}
@@ -339,7 +320,7 @@
// 3 = centimeters
// Other = reserved
const float INCHESPERMETER = (100. / 2.54);
- switch (YRes) {
+ switch (res) {
case 3: // dots per cm
return (it->toLong() * 100);
default: // dots per inch
--- trunk/extragear/graphics/gwenview/imageutils/jpegcontent.h #648472:648473
@@ -44,8 +44,8 @@
Orientation orientation() const;
void resetOrientation();
- int getDotsPerMeterX() const;
- int getDotsPerMeterY() const;
+ int dotsPerMeterX() const;
+ int dotsPerMeterY() const;
QSize size() const;
@@ -69,6 +69,7 @@
JPEGContent(const JPEGContent&);
void operator=(const JPEGContent&);
void applyPendingTransformation();
+ int dotsPerMeter(const QString& keyName) const;
};
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV