[graphics/krita/krita/4.3] libs: Fix first redo() after paint device color space conversion
Dmitry Kazakov
null at kde.org
Mon Aug 10 23:55:47 BST 2020
Git commit 88aa1a2bd9d04dbb3e6cc3468de8ba81f5024427 by Dmitry Kazakov.
Committed on 10/08/2020 at 22:48.
Pushed by dkazakov into branch 'krita/4.3'.
Fix first redo() after paint device color space conversion
There is a bug in all versions of Krita since November, 5th 2019.
BUG
===
1) Change image color space from RGBA to GrayA.
2) Undo with Ctrl+Z
3) Redo with Ctrl+Shift+Z
The image looks as if the color space has changed back to GrayA,
but it is not so. Only the color space of the projection has changed
to GrayA, the layers are still in RGBA. It can be seen by the state
of Advanced Color Selector (it shows colors instead of shades of gray)
and in layers' properties.
WORKAROUND
==========
1) Press Undo (Ctrl+Z) and Redo (Ctrl+Shift+Z) again.
The image will enter the correct state. All further undo/redo
operations for this particular action will be executed correctly.
TECHNICAL DETAILS
=================
The bug was called by commit e39e6379564b5f6c4c72960a6e1ee3ca7716d5bd,
which caused DeviceChangeColorSpaceCommand to skip the first redo of
the operation, which was not in its design.
The bug has been caught by KisColorizeMaskTest.
BUG:416584
CC:kimageshop at kde.org
M +1 -1 libs/command/kis_command_utils.cpp
M +15 -15 libs/image/kis_paint_device_data.h
https://invent.kde.org/graphics/krita/commit/88aa1a2bd9d04dbb3e6cc3468de8ba81f5024427
diff --git a/libs/command/kis_command_utils.cpp b/libs/command/kis_command_utils.cpp
index d6224a87e5..57ac48efb3 100644
--- a/libs/command/kis_command_utils.cpp
+++ b/libs/command/kis_command_utils.cpp
@@ -198,10 +198,10 @@ namespace KisCommandUtils
}
void CompositeCommand::undo() {
- KUndo2Command::undo();
for (auto it = m_commands.rbegin(); it != m_commands.rend(); ++it) {
(*it)->undo();
}
+ KUndo2Command::undo();
}
}
diff --git a/libs/image/kis_paint_device_data.h b/libs/image/kis_paint_device_data.h
index aa6624dc31..7949200a9f 100644
--- a/libs/image/kis_paint_device_data.h
+++ b/libs/image/kis_paint_device_data.h
@@ -94,19 +94,11 @@ public:
{
}
- virtual void forcedRedo() {
- m_data->m_colorSpace = m_newCs;
- m_data->m_cache.setupCache();
- }
-
void redo() override {
- if (m_firstRun) {
- m_firstRun = false;
- return;
- }
-
KUndo2Command::redo();
- forcedRedo();
+
+ m_data->m_colorSpace = m_newCs;
+ m_data->m_cache.setupCache();
}
void undo() override {
@@ -138,9 +130,9 @@ public:
{
}
- void forcedRedo() override {
+ void redo() override {
+ ChangeProfileCommand::redo();
m_data->m_dataManager = m_newDm;
- ChangeProfileCommand::forcedRedo();
}
void undo() override {
@@ -162,7 +154,11 @@ public:
new ChangeProfileCommand(this,
m_colorSpace, dstColorSpace,
parentCommand);
- cmd->forcedRedo();
+
+ // NOTE: first redo is skipped on a higher level,
+ // at DeviceChangeColorSpaceCommand
+ cmd->redo();
+
if (!parentCommand) {
delete cmd;
}
@@ -216,7 +212,11 @@ public:
m_dataManager, dstDataManager,
m_colorSpace, dstColorSpace,
parentCommand);
- cmd->forcedRedo();
+
+ // NOTE: first redo is skipped on a higher level,
+ // at DeviceChangeColorSpaceCommand
+ cmd->redo();
+
if (!parentCommand) {
delete cmd;
}
More information about the kimageshop
mailing list