This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efm2.

View the commit online.

commit 2b5d21afceca1e598c5bdec126e230de30d72dcf
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Mon Jun 26 10:41:23 2023 +0100

    really fix blank/black icons - it's skip head...
---
 src/efm/efm_icon.c | 44 ++++++++++++++++----------------------------
 src/efm/efm_icon.h |  1 +
 2 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/src/efm/efm_icon.c b/src/efm/efm_icon.c
index 91e1f8c..05a88ec 100644
--- a/src/efm/efm_icon.c
+++ b/src/efm/efm_icon.c
@@ -1,8 +1,6 @@
 #include "efm_icon.h"
 #include <Emotion.h>
 
-// XXX: support animated files (anim gif etc.)
-// XXX: support video files (mp4 etc.)
 // XXX: support edj files ???
 // XXX: url's ?
 
@@ -21,11 +19,11 @@ struct _Smart_Data
 
    Ecore_Timer          *settle_timer; // time to figure out when 
    Ecore_Job            *wakeup; // a job to wake up the loop
+   Eina_Stringshare     *orig; // orig file for debug
    Eina_Stringshare     *file; // file path or...
    Eina_Stringshare     *thumb; // thumb path
    Eina_Stringshare     *video; // video path
    Ecore_Timer          *anim_timer; // timer for animation frame flipping
-   Ecore_Job            *preload_job; // defer handling of preload a bit
 
    int                   load_size; // the sie we want to load now
    int                   orig_w, orig_h; // the sie of the img we loaded
@@ -69,17 +67,13 @@ _image_add(Smart_Data *sd)
 { // add a new hidden image object (image2) that will be busy loading
    Evas_Object *o;
 
-   if (sd->preload_job)
-     {
-        ecore_job_del(sd->preload_job);
-        sd->preload_job = NULL;
-     }
    if (sd->o_image2) evas_object_del(sd->o_image2);
    sd->o_image2 = o = evas_object_image_filled_add
      (evas_object_evas_get(sd->o_smart));
    evas_object_image_scale_hint_set(o, EVAS_IMAGE_SCALE_HINT_STATIC);
    evas_object_smart_member_add(o, sd->o_smart); // this is a member
-   evas_object_image_load_head_skip_set(o, EINA_TRUE); // fileset no load head
+// XXX: this sometimes leads to blank/black icons...
+//   evas_object_image_load_head_skip_set(o, EINA_TRUE); // set no load head
    // when the image is fully loaded then call this callback so its all
    // ready and no more i/o is happening (this happens in a thread)
    evas_object_event_callback_add(o, EVAS_CALLBACK_IMAGE_PRELOADED,
@@ -113,6 +107,7 @@ static void
 _cb_wakeup(void *data)
 { // we woke up - mark obj as changed....
    Smart_Data *sd = data;
+
    sd->wakeup = NULL;
    evas_object_smart_changed(sd->o_smart);
 }
@@ -359,7 +354,6 @@ _cb_anim_timer(void *data)
    sd->anim_timer = NULL;
    sd->frame++;
    fr = _frame_num_get(sd);
-   printf("T: %1.3f %i / %i\n", ecore_time_get(), fr, sd->frame_count);
    evas_object_image_animated_frame_set(sd->o_image, fr);
    _handle_frame(sd);
    return EINA_FALSE;
@@ -377,19 +371,9 @@ _handle_frame(Smart_Data *sd)
    sd->anim_timer = ecore_timer_add(t, _cb_anim_timer, sd);
 }
 
-static void
-_cb_imae_preload_show_delay(void *data)
-{
-   Smart_Data *sd = data;
-
-   sd->preload_job = NULL;
-   evas_object_show(sd->o_image);
-   if (sd->animated) _handle_frame(sd);
-}
-
 static void
 _cb_image_preload(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
-{ // whenb an image that was being loaded in the background has now finished
+{ // when an image that was being loaded in the background has now finished
    Smart_Data *sd = data;
 
    if (sd->o_image) evas_object_del(sd->o_image);
@@ -411,8 +395,8 @@ _cb_image_preload(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
         if (sd->frame_count < 3) sd->loop_type = EVAS_IMAGE_ANIMATED_HINT_LOOP;
         else if (sd->frame_count < 2) sd->animated = EINA_FALSE;
      }
-   if (sd->preload_job) ecore_job_del(sd->preload_job);
-   sd->preload_job = ecore_job_add(_cb_imae_preload_show_delay, sd);
+   if (sd->animated) _handle_frame(sd);
+   evas_object_show(sd->o_image);
 }
 
 // gui code
@@ -465,11 +449,7 @@ _smart_del(Evas_Object *obj)
         ecore_timer_del(sd->anim_timer);
         sd->anim_timer = NULL;
      }
-   if (sd->preload_job)
-     {
-        ecore_job_del(sd->preload_job);
-        sd->preload_job = NULL;
-     }
+   eina_stringshare_replace(&(sd->orig), NULL);
    eina_stringshare_replace(&(sd->thumb), NULL);
    eina_stringshare_replace(&(sd->file), NULL);
    eina_stringshare_replace(&(sd->video), NULL);
@@ -541,6 +521,14 @@ efm_icon_add(Evas_Object *parent)
    return evas_object_smart_add(evas_object_evas_get(parent), _smart);
 }
 
+void
+efm_icon_orig_set(Evas_Object *obj, const char *orig)
+{ // set orig file path for icon for debug
+   ENTRY;
+
+   eina_stringshare_replace(&(sd->orig), orig);
+}
+
 void
 efm_icon_file_set(Evas_Object *obj, const char *file)
 { // set a regular file as the icon
diff --git a/src/efm/efm_icon.h b/src/efm/efm_icon.h
index 0fdce30..e54b9da 100644
--- a/src/efm/efm_icon.h
+++ b/src/efm/efm_icon.h
@@ -4,6 +4,7 @@
 # include <Elementary.h>
 
 Evas_Object *efm_icon_add(Evas_Object *parent);
+void         efm_icon_orig_set(Evas_Object *obj, const char *orig);
 void         efm_icon_file_set(Evas_Object *obj, const char *file);
 void         efm_icon_thumb_set(Evas_Object *obj, const char *thumb);
 void         efm_icon_video_set(Evas_Object *obj, const char *video);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to