[gimp/wip/animation: 147/197] plug-ins: fix fit-to-display on first render.



commit 3b91ef052f139f37e5adae5f68e4d8a1abf25452
Author: Jehan <jehan girinstud io>
Date:   Mon May 29 10:35:10 2017 +0200

    plug-ins: fix fit-to-display on first render.
    
    It was broken since GUI expose event was now happening faster than
    actual image rendering (thanks to multi-threading), hence using the
    wrong dimension information to fit the image to display.

 plug-ins/animation-play/widgets/animation-dialog.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/animation-play/widgets/animation-dialog.c 
b/plug-ins/animation-play/widgets/animation-dialog.c
index db4889f..517a3e7 100755
--- a/plug-ins/animation-play/widgets/animation-dialog.c
+++ b/plug-ins/animation-play/widgets/animation-dialog.c
@@ -67,6 +67,7 @@ struct _AnimationDialogPrivate
   Animation         *animation;
   AnimationPlayback *playback;
   gdouble            zoom;
+  gboolean           rendered_once;
 
   /* GUI */
   GtkWidget         *play_bar;
@@ -331,6 +332,7 @@ animation_dialog_init (AnimationDialog *dialog)
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
 
   priv->playback = animation_playback_new ();
+  priv->rendered_once = FALSE;
 }
 
 /**** Public Functions ****/
@@ -1452,10 +1454,6 @@ on_dialog_expose (GtkWidget *dialog,
                                         animation);
   animation_load (animation);
 
-  /* Fit to display. */
-  update_scale (ANIMATION_DIALOG (dialog),
-                get_zoom (ANIMATION_DIALOG (dialog), 0));
-
   return FALSE;
 }
 
@@ -2469,7 +2467,7 @@ render_on_realize (GtkWidget       *drawing_area,
                    AnimationDialog *dialog)
 {
   AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
-  GeglBuffer *buffer;
+  GeglBuffer             *buffer;
 
   buffer = animation_playback_get_buffer (priv->playback,
                                           animation_playback_get_position (priv->playback));
@@ -2511,6 +2509,14 @@ render_frame (AnimationDialog *dialog,
       ! gtk_widget_get_realized (priv->drawing_area))
     return;
 
+  if (!priv->rendered_once)
+    {
+      /* Fit to display on first render. */
+      update_scale (ANIMATION_DIALOG (dialog),
+                    get_zoom (ANIMATION_DIALOG (dialog), 0));
+    }
+  priv->rendered_once = TRUE;
+
   if (is_detached (dialog))
     {
       da = priv->shape_drawing_area;


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