[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [gwenview] lib: Fix for wrong rotation of RAW images
From:       Aurélien Gâteau <agateau () kde ! org>
Date:       2015-03-31 14:48:53
Message-ID: E1YcxTJ-0004T0-Rq () scm ! kde ! org
[Download RAW message or body]

Git commit f383a05dd25ce924094518962a4d82cbc914ee32 by Aurélien Gâteau, on behalf \
of Martin Kyral. Committed on 22/03/2015 at 15:53.
Pushed by gateau into branch 'master'.

Fix for wrong rotation of RAW images

Displaying of RAW images in gwenview was broken by \
https://bugreports.qt.io/browse/QTBUG-37946. I am fixing (or rather workarounding it) \
by blocking EXIF rotation iff the loaded image is RAW.

REVIEW: 122873

M  +4    -1    lib/document/loadingdocumentimpl.cpp
M  +2    -1    lib/thumbnailprovider/thumbnailgenerator.cpp
M  +1    -0    lib/thumbnailprovider/thumbnailgenerator.h

http://commits.kde.org/gwenview/f383a05dd25ce924094518962a4d82cbc914ee32

diff --git a/lib/document/loadingdocumentimpl.cpp \
b/lib/document/loadingdocumentimpl.cpp index cc8bea9..8477c28 100644
--- a/lib/document/loadingdocumentimpl.cpp
+++ b/lib/document/loadingdocumentimpl.cpp
@@ -104,6 +104,7 @@ struct LoadingDocumentImplPrivate
     std::auto_ptr<JpegContent> mJpegContent;
     QImage mImage;
     Cms::Profile::Ptr mCmsProfile;
+    bool mIsRawImage = false;
 
     /**
      * Determine kind of document and switch to an implementation if it is not
@@ -222,6 +223,8 @@ struct LoadingDocumentImplPrivate
 
             // need to fill mFormat so gwenview can tell the type when trying to \
save  mFormat = mFormatHint;
+
+            mIsRawImage = true;
         } else {
 #else
 {
@@ -318,7 +321,7 @@ struct LoadingDocumentImplPrivate
             return;
         }
 
-        if (mJpegContent.get() && GwenviewConfig::applyExifOrientation()) {
+        if (mJpegContent.get() && GwenviewConfig::applyExifOrientation() && \
                !mIsRawImage) {
             Gwenview::Orientation orientation = mJpegContent->orientation();
             QMatrix matrix = ImageUtils::transformMatrix(orientation);
             mImage = mImage.transformed(matrix);
diff --git a/lib/thumbnailprovider/thumbnailgenerator.cpp \
b/lib/thumbnailprovider/thumbnailgenerator.cpp index 54875f5..36d55e8 100644
--- a/lib/thumbnailprovider/thumbnailgenerator.cpp
+++ b/lib/thumbnailprovider/thumbnailgenerator.cpp
@@ -102,6 +102,7 @@ bool ThumbnailContext::load(const QString &pixPath, int \
pixelSize)  buffer.open(QIODevice::ReadOnly);
         reader.setDevice(&buffer);
         reader.setFormat(formatHint);
+        mIsRawImage = true;
     } else {
 #else
     {
@@ -121,7 +122,7 @@ bool ThumbnailContext::load(const QString &pixPath, int \
pixelSize)  // If applyExifOrientation is not set, don't use the
     // embedded thumbnail since it might be rotated differently
     // than the actual image
-    if (!content.rawData().isEmpty() && GwenviewConfig::applyExifOrientation()) {
+    if (!content.rawData().isEmpty() && GwenviewConfig::applyExifOrientation() && \
!mIsRawImage) {  QImage thumbnail = content.thumbnail();
         orientation = content.orientation();
 
diff --git a/lib/thumbnailprovider/thumbnailgenerator.h \
b/lib/thumbnailprovider/thumbnailgenerator.h index 4571832..16ed43e 100644
--- a/lib/thumbnailprovider/thumbnailgenerator.h
+++ b/lib/thumbnailprovider/thumbnailgenerator.h
@@ -41,6 +41,7 @@ struct ThumbnailContext {
     int mOriginalWidth;
     int mOriginalHeight;
     bool mNeedCaching;
+    bool mIsRawImage = false;
 
     bool load(const QString &pixPath, int pixelSize);
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic