emotion: advertise only on frame size change.
authorcedric <cedric>
Fri, 24 Jun 2011 14:11:24 +0000 (14:11 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Fri, 24 Jun 2011 14:11:24 +0000 (14:11 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/emotion@60665 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/emotion_smart.c
src/modules/gstreamer/emotion_sink.c

index f67ec10..7cfe946 100644 (file)
@@ -1162,25 +1162,30 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
 {
    Smart_Data *sd;
    int iw, ih;
+   double tmp;
    int changed = 0;
 
    E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
    evas_object_image_size_get(sd->obj, &iw, &ih);
    if ((w != iw) || (h != ih))
      {
-       if (h > 0) sd->ratio  = (double)w / (double)h;
-       else sd->ratio = 1.0;
        evas_object_image_size_set(sd->obj, w, h);
         _emotion_image_data_zero(sd->obj);
        changed = 1;
      }
-   if (ratio != sd->ratio)
+   if (h > 0) tmp  = (double)w / (double)h;
+   else tmp = 1.0;
+   if (ratio != tmp) tmp = ratio;
+   if (tmp != sd->ratio)
      {
-       sd->ratio = ratio;
+       sd->ratio = tmp;
        changed = 1;
      }
-   if (changed) evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL);
-   evas_object_size_hint_request_set(obj, w, h);
+   if (changed)
+     {
+       evas_object_size_hint_request_set(obj, w, h);
+       evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL);
+     }
 }
 
 EAPI void
index 54c3a66..65b8138 100644 (file)
@@ -36,7 +36,6 @@ struct _EvasVideoSinkPrivate {
 
    int width;
    int height;
-   gboolean update_size;
    GstVideoFormat format;
 
    GMutex* buffer_mutex;
@@ -52,6 +51,7 @@ struct _EvasVideoSinkPrivate {
    // Protected by the buffer mutex
    Eina_Bool unlocked : 1;
    Eina_Bool preroll : 1;
+   Eina_Bool update_size : 1;
 };
 
 #define _do_init(bla)                                   \
@@ -93,12 +93,12 @@ evas_video_sink_init(EvasVideoSink* sink, EvasVideoSinkClass* klass __UNUSED__)
    priv->p = ecore_pipe_add(evas_video_sink_render_handler, sink);
    priv->width = 0;
    priv->height = 0;
-   priv->update_size = TRUE;
    priv->format = GST_VIDEO_FORMAT_UNKNOWN;
    priv->data_cond = g_cond_new();
    priv->buffer_mutex = g_mutex_new();
    priv->preroll = EINA_FALSE;
    priv->unlocked = EINA_FALSE;
+   priv->update_size = EINA_TRUE;
 }
 
 
@@ -206,7 +206,7 @@ gboolean evas_video_sink_set_caps(GstBaseSink *bsink, GstCaps *caps)
      {
         priv->width = width;
         priv->height = height;
-        priv->update_size = TRUE;
+        priv->update_size = EINA_TRUE;
      }
 
    printf("format :");
@@ -382,8 +382,7 @@ static void evas_video_sink_render_handler(void *data,
    if (priv->update_size)
      {
         evas_object_image_size_set(priv->o, priv->width, priv->height);
-        evas_object_image_fill_set(priv->o, 0, 0, priv->width, priv->height);
-        priv->update_size = FALSE;
+        if (!priv->preroll) priv->update_size = FALSE;
      }
 
    evas_data = (unsigned char *)evas_object_image_data_get(priv->o, 1);