[gimp/wip/animation: 339/373] plug-ins: save the animation display size in the parasite.



commit c45785953cea9e50b4709bb50a07453674800327
Author: Jehan <jehan girinstud io>
Date:   Sun Jun 25 22:44:15 2017 +0200

    plug-ins: save the animation display size in the parasite.

 plug-ins/animation-play/core/animation-animatic.c  |   26 ++++++++++++++++++-
 .../animation-play/core/animation-celanimation.c   |   25 +++++++++++++++++-
 2 files changed, 47 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-animatic.c 
b/plug-ins/animation-play/core/animation-animatic.c
index e2616df..d21d9a2 100644
--- a/plug-ins/animation-play/core/animation-animatic.c
+++ b/plug-ins/animation-play/core/animation-animatic.c
@@ -522,13 +522,17 @@ animation_animatic_serialize (Animation   *animation,
   AnimationAnimaticPrivate *priv = GET_PRIVATE (animation);
   gchar                    *text;
   gchar                    *tmp;
+  gint                      width;
+  gint                      height;
   gint                      i;
 
+  animation_get_size (animation, &width, &height);
   text = g_strdup_printf ("<animation type=\"animatic\" framerate=\"%f\" "
-                          " duration=\"%d\" width=\"\" height=\"\">"
+                          " duration=\"%d\" width=\"%d\" height=\"%d\">"
                           "%s<sequence>",
                           animation_get_framerate (animation),
-                          priv->n_panels, playback_xml);
+                          priv->n_panels, width, height,
+                          playback_xml);
   for (i = 0; i < priv->n_panels; i++)
     {
       gchar  *panel;
@@ -651,6 +655,24 @@ animation_animatic_start_element (GMarkupParseContext *context,
                   return;
                 }
             }
+          else if (strcmp (*names, "width") == 0 && **values)
+            {
+              gint width;
+              gint height;
+
+              animation_get_size (status->animation, &width, &height);
+              width = (gint) g_ascii_strtoull (*values, NULL, 10);
+              animation_set_size (status->animation, width, height);
+            }
+          else if (strcmp (*names, "height") == 0 && **values)
+            {
+              gint width;
+              gint height;
+
+              animation_get_size (status->animation, &width, &height);
+              height = (gint) g_ascii_strtoull (*values, NULL, 10);
+              animation_set_size (status->animation, width, height);
+            }
           else if (strcmp (*names, "framerate") == 0 && **values)
             {
               gdouble fps = g_strtod (*values, NULL);
diff --git a/plug-ins/animation-play/core/animation-celanimation.c 
b/plug-ins/animation-play/core/animation-celanimation.c
index cfdf25d..5b84261 100644
--- a/plug-ins/animation-play/core/animation-celanimation.c
+++ b/plug-ins/animation-play/core/animation-celanimation.c
@@ -753,16 +753,19 @@ animation_cel_animation_serialize (Animation   *animation,
   gchar                        *xml2;
   gchar                        *tmp;
   GList                        *iter;
+  gint                          width;
+  gint                          height;
   gint                          i;
 
   priv = ANIMATION_CEL_ANIMATION (animation)->priv;
 
+  animation_get_size (animation, &width, &height);
   xml = g_strdup_printf ("<animation type=\"cels\" framerate=\"%f\" "
                           " duration=\"%d\" onion-skins=\"%d\""
-                          " width=\"\" height=\"\">%s",
+                          " width=\"%d\" height=\"%d\">%s",
                           animation_get_framerate (animation),
                           priv->duration, priv->onion_skins,
-                          playback_xml);
+                          width, height, playback_xml);
 
   for (iter = priv->tracks; iter; iter = iter->next)
     {
@@ -1056,6 +1059,24 @@ animation_cel_animation_start_element (GMarkupParseContext  *context,
                   return;
                 }
             }
+          else if (strcmp (*names, "width") == 0 && **values)
+            {
+              gint width;
+              gint height;
+
+              animation_get_size (status->animation, &width, &height);
+              width = (gint) g_ascii_strtoull (*values, NULL, 10);
+              animation_set_size (status->animation, width, height);
+            }
+          else if (strcmp (*names, "height") == 0 && **values)
+            {
+              gint width;
+              gint height;
+
+              animation_get_size (status->animation, &width, &height);
+              height = (gint) g_ascii_strtoull (*values, NULL, 10);
+              animation_set_size (status->animation, width, height);
+            }
           else if (strcmp (*names, "framerate") == 0 && **values)
             {
               gdouble fps = g_strtod (*values, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]