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

List:       kde-commits
Subject:    [digikam] imageplugins/color: Fix: levels tool settings not correctly restored for 16bit images
From:       Matthias Welwarsky <matze () welwarsky ! de>
Date:       2012-04-02 16:18:28
Message-ID: 20120402161828.D0F8EA60BB () git ! kde ! org
[Download RAW message or body]

Git commit 9efee613e1e4909d4bbdfb73cb8e067f1b723f71 by Matthias Welwarsky.
Committed on 01/02/2012 at 09:15.
Pushed by welwarsky into branch 'master'.

Fix: levels tool settings not correctly restored for 16bit images

The tool saves its settings in 8bit scale, which causes loss of precision
when 16bit image levels are divided down on save and scaled up on restore.
The fix is to always save settings in 16bit scale and scale down only
when an 8bit image is loaded.

Signed-off-by: Matthias Welwarsky <matze@welwarsky.de>

M  +8    -8    imageplugins/color/adjustlevelstool.cpp

http://commits.kde.org/digikam/9efee613e1e4909d4bbdfb73cb8e067f1b723f71

diff --git a/imageplugins/color/adjustlevelstool.cpp \
b/imageplugins/color/adjustlevelstool.cpp index e350703..94ec6c2 100644
--- a/imageplugins/color/adjustlevelstool.cpp
+++ b/imageplugins/color/adjustlevelstool.cpp
@@ -778,10 +778,10 @@ void AdjustLevelsTool::readSettings()
             highOutput = group.readEntry(d->configHighOutputChannelEntry.arg(i), \
max);  
             d->levels->setLevelGammaValue(i, gamma);
-            d->levels->setLevelLowInputValue(i, sb ? lowInput*255 : lowInput);
-            d->levels->setLevelHighInputValue(i, sb ? highInput*255 : highInput);
-            d->levels->setLevelLowOutputValue(i, sb ? lowOutput*255 : lowOutput);
-            d->levels->setLevelHighOutputValue(i, sb ? highOutput*255 : highOutput);
+            d->levels->setLevelLowInputValue(i, sb ? lowInput : lowInput / 256);
+            d->levels->setLevelHighInputValue(i, sb ? highInput : highInput / 256);
+            d->levels->setLevelLowOutputValue(i, sb ? lowOutput : lowOutput / 256);
+            d->levels->setLevelHighOutputValue(i, sb ? highOutput : highOutput / \
256);  }
     }
 
@@ -835,10 +835,10 @@ void AdjustLevelsTool::writeSettings()
             highOutput = d->levels->getLevelHighOutputValue(i);
 
             group.writeEntry(d->configGammaChannelEntry.arg(i), gamma);
-            group.writeEntry(d->configLowInputChannelEntry.arg(i),   sb ? \
                lowInput/255   : lowInput);
-            group.writeEntry(d->configLowOutputChannelEntry.arg(i),  sb ? \
                lowOutput/255  : lowOutput);
-            group.writeEntry(d->configHighInputChannelEntry.arg(i),  sb ? \
                highInput/255  : highInput);
-            group.writeEntry(d->configHighOutputChannelEntry.arg(i), sb ? \
highOutput/255 : highOutput); +            \
group.writeEntry(d->configLowInputChannelEntry.arg(i),   sb ? lowInput   : lowInput * \
256); +            group.writeEntry(d->configLowOutputChannelEntry.arg(i),  sb ? \
lowOutput  : lowOutput * 256); +            \
group.writeEntry(d->configHighInputChannelEntry.arg(i),  sb ? highInput  : highInput \
* 256); +            group.writeEntry(d->configHighOutputChannelEntry.arg(i), sb ? \
highOutput : highOutput * 256);  }
     }
 


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

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