emotion: advertise only on frame size change.

SVN revision: 60665
This commit is contained in:
Cedric BAIL 2011-06-24 14:11:24 +00:00
parent 923bff4e1c
commit 1724785989
2 changed files with 15 additions and 11 deletions

View File

@ -1162,25 +1162,30 @@ _emotion_frame_resize(Evas_Object *obj, int w, int h, double ratio)
{ {
Smart_Data *sd; Smart_Data *sd;
int iw, ih; int iw, ih;
double tmp;
int changed = 0; int changed = 0;
E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME); E_SMART_OBJ_GET(sd, obj, E_OBJ_NAME);
evas_object_image_size_get(sd->obj, &iw, &ih); evas_object_image_size_get(sd->obj, &iw, &ih);
if ((w != iw) || (h != 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); evas_object_image_size_set(sd->obj, w, h);
_emotion_image_data_zero(sd->obj); _emotion_image_data_zero(sd->obj);
changed = 1; 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; changed = 1;
} }
if (changed) evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL); if (changed)
evas_object_size_hint_request_set(obj, w, h); {
evas_object_size_hint_request_set(obj, w, h);
evas_object_smart_callback_call(obj, SIG_FRAME_RESIZE, NULL);
}
} }
EAPI void EAPI void

View File

@ -36,7 +36,6 @@ struct _EvasVideoSinkPrivate {
int width; int width;
int height; int height;
gboolean update_size;
GstVideoFormat format; GstVideoFormat format;
GMutex* buffer_mutex; GMutex* buffer_mutex;
@ -52,6 +51,7 @@ struct _EvasVideoSinkPrivate {
// Protected by the buffer mutex // Protected by the buffer mutex
Eina_Bool unlocked : 1; Eina_Bool unlocked : 1;
Eina_Bool preroll : 1; Eina_Bool preroll : 1;
Eina_Bool update_size : 1;
}; };
#define _do_init(bla) \ #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->p = ecore_pipe_add(evas_video_sink_render_handler, sink);
priv->width = 0; priv->width = 0;
priv->height = 0; priv->height = 0;
priv->update_size = TRUE;
priv->format = GST_VIDEO_FORMAT_UNKNOWN; priv->format = GST_VIDEO_FORMAT_UNKNOWN;
priv->data_cond = g_cond_new(); priv->data_cond = g_cond_new();
priv->buffer_mutex = g_mutex_new(); priv->buffer_mutex = g_mutex_new();
priv->preroll = EINA_FALSE; priv->preroll = EINA_FALSE;
priv->unlocked = 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->width = width;
priv->height = height; priv->height = height;
priv->update_size = TRUE; priv->update_size = EINA_TRUE;
} }
printf("format :"); printf("format :");
@ -382,8 +382,7 @@ static void evas_video_sink_render_handler(void *data,
if (priv->update_size) if (priv->update_size)
{ {
evas_object_image_size_set(priv->o, priv->width, priv->height); evas_object_image_size_set(priv->o, priv->width, priv->height);
evas_object_image_fill_set(priv->o, 0, 0, priv->width, priv->height); if (!priv->preroll) priv->update_size = FALSE;
priv->update_size = FALSE;
} }
evas_data = (unsigned char *)evas_object_image_data_get(priv->o, 1); evas_data = (unsigned char *)evas_object_image_data_get(priv->o, 1);