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

List:       kde-commits
Subject:    [krita/rempt/impex-refactoring] libs/image: Fix saving of animation parameters
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2016-11-09 11:21:45
Message-ID: E1c4Qwr-00036d-Lu () code ! kde ! org
[Download RAW message or body]

Git commit b1c1f6403725ad4bac12e6f50d639ca8aef79675 by Dmitry Kazakov.
Committed on 09/11/2016 at 11:21.
Pushed by dkazakov into branch 'rempt/impex-refactoring'.

Fix saving of animation parameters

When cloning the image, these parameters should be saved as well.

BUG:372171

M  +10   -4    libs/image/kis_image.cc
M  +19   -0    libs/image/kis_image_animation_interface.cpp
M  +1    -0    libs/image/kis_image_animation_interface.h

http://commits.kde.org/krita/b1c1f6403725ad4bac12e6f50d639ca8aef79675

diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
index 20fd9d1..b2d0c2c 100644
--- a/libs/image/kis_image.cc
+++ b/libs/image/kis_image.cc
@@ -125,7 +125,10 @@ static KisImageSPStaticRegistrar __registrar;
 class KisImage::KisImagePrivate
 {
 public:
-    KisImagePrivate(KisImage *_q, qint32 w, qint32 h, const KoColorSpace *c, \
KisUndoStore *u) +    KisImagePrivate(KisImage *_q, qint32 w, qint32 h,
+                    const KoColorSpace *c,
+                    KisUndoStore *u,
+                    KisImageAnimationInterface *_animationInterface)
         : q(_q)
         , lockedForReadOnly(false)
         , width(w)
@@ -137,7 +140,7 @@ public:
         , postExecutionUndoAdapter(u, _q)
         , recorder(_q)
         , signalRouter(_q)
-        , animationInterface(new KisImageAnimationInterface(q))
+        , animationInterface(_animationInterface)
         , scheduler(_q)
         , axesCenter(QPointF(0.5, 0.5))
     {
@@ -238,7 +241,9 @@ KisImage::KisImage(KisUndoStore *undoStore, qint32 width, qint32 \
height, const K  } else {
         c = KoColorSpaceRegistry::instance()->rgb8();
     }
-    m_d = new KisImagePrivate(this, width, height, c, undoStore);
+    m_d = new KisImagePrivate(this, width, height,
+                              c, undoStore,
+                              new KisImageAnimationInterface(this));
 
     setRootLayer(new KisGroupLayer(this, "root", OPACITY_OPAQUE_U8));
 }
@@ -280,7 +285,8 @@ KisImage::KisImage(const KisImage& rhs, KisUndoStore *undoStore, \
bool exactCopy)  m_d(new KisImagePrivate(this,
                               rhs.width(), rhs.height(),
                               rhs.colorSpace(),
-                              undoStore ? undoStore : new KisDumbUndoStore()))
+                              undoStore ? undoStore : new KisDumbUndoStore(),
+                              new \
KisImageAnimationInterface(*rhs.animationInterface(), this)))  {
     setObjectName(rhs.objectName());
 
diff --git a/libs/image/kis_image_animation_interface.cpp \
b/libs/image/kis_image_animation_interface.cpp index 4223cdf..09cdc21 100644
--- a/libs/image/kis_image_animation_interface.cpp
+++ b/libs/image/kis_image_animation_interface.cpp
@@ -42,6 +42,19 @@ struct KisImageAnimationInterface::Private
     {
     }
 
+    Private(const Private &rhs, KisImage *newImage)
+        : image(newImage),
+          externalFrameActive(false),
+          frameInvalidationBlocked(false),
+          fullClipRange(rhs.fullClipRange),
+          playbackRange(rhs.playbackRange),
+          framerate(rhs.framerate),
+          cachedLastFrameValue(-1),
+          m_currentTime(rhs.m_currentTime),
+          m_currentUITime(rhs.m_currentUITime)
+    {
+    }
+
     KisImage *image;
     bool externalFrameActive;
     bool frameInvalidationBlocked;
@@ -84,6 +97,12 @@ KisImageAnimationInterface::KisImageAnimationInterface(KisImage \
                *image)
     connect(this, SIGNAL(sigInternalRequestTimeSwitch(int, bool)), \
SLOT(switchCurrentTimeAsync(int, bool)));  }
 
+KisImageAnimationInterface::KisImageAnimationInterface(const \
KisImageAnimationInterface &rhs, KisImage *newImage) +    : m_d(new Private(*rhs.m_d, \
newImage)) +{
+    connect(this, SIGNAL(sigInternalRequestTimeSwitch(int, bool)), \
SLOT(switchCurrentTimeAsync(int, bool))); +}
+
 KisImageAnimationInterface::~KisImageAnimationInterface()
 {
 }
diff --git a/libs/image/kis_image_animation_interface.h \
b/libs/image/kis_image_animation_interface.h index c077d87..b596c69 100644
--- a/libs/image/kis_image_animation_interface.h
+++ b/libs/image/kis_image_animation_interface.h
@@ -39,6 +39,7 @@ class KRITAIMAGE_EXPORT KisImageAnimationInterface : public QObject
 
 public:
     KisImageAnimationInterface(KisImage *image);
+    KisImageAnimationInterface(const KisImageAnimationInterface &rhs, KisImage \
*newImage);  ~KisImageAnimationInterface();
 
     /**


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

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