[evas_events.c] nicer do !! once.
authorChunEon Park <chuneon.park@samsung.com>
Mon, 4 Oct 2010 11:56:14 +0000 (20:56 +0900)
committerChunEon Park <chuneon.park@samsung.com>
Mon, 4 Oct 2010 11:56:14 +0000 (20:56 +0900)
[evas_map.c] 1 bug-- ... when maps got enabled and disabled you'd find in softwarre
that you'd get dirty areas that didnt re-rneder. fixed with nasty hack
- force a full update if anyone in the evas object tree changed maps
from on to off and vice-versa

[evas_object_main.c] !! once

[evas_render.c] fix nasty uncaught clip + map bug! fix fix fix!!!!!

[evas_font_draw.c] Do kerning correctly for word cache.
Technically this should speed it up a little. That's a nice change for a bug
fix ;-)

[Evas_Engine_DirectFB.h] Fix header include
The current way of including directfb.h makes it hard for people with multiple
versions of DirectFB installed.
This is the correct way to include that header, and it's the way
ecore_directfb does it.
Patch by: Eduardo Felipe <eduardofelipe87@>

src/lib/canvas/evas_events.c
src/lib/canvas/evas_map.c
src/lib/canvas/evas_object_main.c
src/lib/canvas/evas_render.c
src/lib/engines/common/evas_font_draw.c
src/modules/engines/directfb/Evas_Engine_DirectFB.h

index 76ce007..bd5e96d 100644 (file)
@@ -60,13 +60,9 @@ _evas_event_object_list_in_get(Evas *e, Eina_List *in,
                             if (!evas_map_coords_get(obj->cur.map, x, y,
                                                      &(obj->cur.map->mx),
                                                      &(obj->cur.map->my), 0))
-                              {
-                                 inside = 0;
-                              }
+                               inside = 0;
                             else
-                              {
-                                 parmap = 1;
-                              }
+                               parmap = 1;
                          }
                        else
                          inside = 0;
@@ -328,6 +324,8 @@ evas_event_feed_mouse_down(Evas *e, int b, Evas_Button_Flags flags, unsigned int
    copy = evas_event_list_copy(e->pointer.object.in);
    EINA_LIST_FOREACH(copy, l, obj)
      {
+        if (obj->delete_me) continue;
+        
         ev.canvas.x = e->pointer.x;
         ev.canvas.y = e->pointer.y;
         _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
@@ -408,8 +406,11 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t
                  obj->mouse_grabbed--;
                  e->pointer.mouse_grabbed--;
               }
-            if (e->events_frozen <= 0)
-              evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_UP, &ev);
+             if (!obj->delete_me)
+               {
+                  if (e->events_frozen <= 0)
+                     evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_UP, &ev);
+               }
             if (e->delete_me) break;
          }
        if (copy) copy = eina_list_free(copy);
@@ -450,7 +451,6 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t
                  if ((!eina_list_data_find(ins, obj)) ||
                      (!e->pointer.inside))
                    {
-
                       obj->mouse_in = 0;
                       if (e->events_frozen <= 0)
                         evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
@@ -485,7 +485,6 @@ evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int t
                   _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
                  if (!eina_list_data_find(e->pointer.object.in, obj))
                    {
-
                       obj->mouse_in = 1;
                       if (e->events_frozen <= 0)
                         evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
@@ -732,8 +731,11 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const
                        _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
                       e->pointer.object.in = eina_list_remove(e->pointer.object.in, obj);
                        obj->mouse_in = 0;
-                       if (e->events_frozen <= 0)
-                         evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
+                       if (!obj->delete_me)
+                         {
+                            if (e->events_frozen <= 0)
+                               evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
+                         }
                    }
               }
              _evas_post_event_callback_call(e);
@@ -842,7 +844,6 @@ evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const
             if (!eina_list_data_find(e->pointer.object.in, obj))
               {
                  obj->mouse_in = 1;
-
                  if (e->events_frozen <= 0)
                    evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev3);
               }
@@ -910,7 +911,6 @@ evas_event_feed_mouse_in(Evas *e, unsigned int timestamp, const void *data)
         _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
        if (!eina_list_data_find(e->pointer.object.in, obj))
          {
-
             obj->mouse_in = 1;
             if (e->events_frozen <= 0)
               evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_IN, &ev);
@@ -979,9 +979,11 @@ evas_event_feed_mouse_out(Evas *e, unsigned int timestamp, const void *data)
              ev.canvas.y = e->pointer.y;
              _evas_event_havemap_adjust(obj, &ev.canvas.x, &ev.canvas.y);
              obj->mouse_in = 0;
-           if (e->events_frozen <= 0)
-             evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
-
+             if (!obj->delete_me)
+               {
+                  if (e->events_frozen <= 0)
+                     evas_object_event_callback_call(obj, EVAS_CALLBACK_MOUSE_OUT, &ev);
+               }
            if (e->delete_me) break;
          }
        if (copy) copy = eina_list_free(copy);
@@ -1520,6 +1522,8 @@ evas_object_pass_events_set(Evas_Object *obj, Eina_Bool pass)
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    return;
    MAGIC_CHECK_END();
+   pass = !!pass;
+   if (obj->pass_events == pass) return;
    obj->pass_events = pass;
    evas_object_smart_member_cache_invalidate(obj);
    if (evas_object_is_in_output_rect(obj,
@@ -1568,6 +1572,8 @@ evas_object_repeat_events_set(Evas_Object *obj, Eina_Bool repeat)
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    return;
    MAGIC_CHECK_END();
+   repeat = !!repeat;
+   if (obj->repeat_events == repeat) return;
    obj->repeat_events = repeat;
    if (evas_object_is_in_output_rect(obj,
                                     obj->layer->evas->pointer.x,
index 666b2a5..9d9634a 100644 (file)
@@ -288,8 +288,9 @@ evas_object_map_enable_set(Evas_Object *obj, Eina_Bool enabled)
    MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
    return;
    MAGIC_CHECK_END();
-   if (obj->cur.usemap == !!enabled) return;
-   obj->cur.usemap = !!enabled;
+   enabled = !!enabled;
+   if (obj->cur.usemap == enabled) return;
+   obj->cur.usemap = enabled;
    if (enabled)
      {
         if (!obj->cur.map)
index a43d204..284a33f 100644 (file)
@@ -392,6 +392,7 @@ evas_object_del(Evas_Object *obj)
      }
    obj->layer->evas->pointer.mouse_grabbed -= obj->mouse_grabbed;
    obj->mouse_grabbed = 0;
+   obj->mouse_in = 0;
    evas_object_hide(obj);
    evas_object_grabs_cleanup(obj);
    while (obj->clip.clipees) evas_object_clip_unset(obj->clip.clipees->data);
@@ -1137,7 +1138,8 @@ evas_object_hide(Evas_Object *obj)
        evas_object_recalc_clippees(obj);
        if (!evas_event_passes_through(obj))
          {
-            if (!obj->smart.smart)
+            if ((!obj->smart.smart) ||
+                 ((obj->cur.map) && (obj->cur.map->count == 4) && (obj->cur.usemap)))
               {
                  if (evas_object_is_in_output_rect(obj,
                                                    obj->layer->evas->pointer.x,
@@ -1300,9 +1302,9 @@ evas_object_anti_alias_set(Evas_Object *obj, Eina_Bool anti_alias)
    return;
    MAGIC_CHECK_END();
    if (obj->delete_me) return;
-   if (obj->cur.anti_alias == !!anti_alias)
-     return;
-   obj->cur.anti_alias = !!anti_alias;
+   anti_alias = !!anti_alias;
+   if (obj->cur.anti_alias == anti_alias)return;
+   obj->cur.anti_alias = anti_alias;
    evas_object_change(obj);
 }
 
@@ -1337,8 +1339,7 @@ evas_object_scale_set(Evas_Object *obj, double scale)
    return;
    MAGIC_CHECK_END();
    if (obj->delete_me) return;
-   if (obj->cur.scale == scale)
-     return;
+   if (obj->cur.scale == scale) return;
    obj->cur.scale = scale;
    evas_object_change(obj);
    if (obj->func->scale_update) obj->func->scale_update(obj);
index 50037dd..3d3d398 100644 (file)
@@ -135,7 +135,7 @@ _evas_render_has_map(Evas_Object *obj)
 static Eina_Bool
 _evas_render_had_map(Evas_Object *obj)
 {
-   return ((!obj->cur.map) && (obj->prev.usemap));
+   return ((!obj->prev.map) && (obj->prev.usemap));
 }
 
 static Eina_Bool
@@ -232,7 +232,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
                                    Eina_Array *restack_objects,
                                    Eina_Array *delete_objects,
                                    Eina_Array *render_objects,
-                                   int restack, int map
+                                   int restack, int map,
+                                   int *redraw_all
 #ifdef REND_DGB
                                    , int level
 #endif
@@ -241,7 +242,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
    Eina_Bool clean_them = EINA_FALSE;
    Evas_Object *obj2;
    int is_active;
-
+   Eina_Bool hmap;
+   
    obj->rect_del = 0;
    obj->render_pre = 0;
 
@@ -274,7 +276,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
      }
 #endif
 
-   if (_evas_render_has_map(obj)) map = 1;
+   map = _evas_render_has_map(obj);
+   hmap = _evas_render_had_map(obj);
 
    if ((restack) && (!map))
      {
@@ -293,6 +296,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
         RD("      obj mapped\n");
         if (obj->changed)
           {
+             if (map != hmap)
+                *redraw_all = 1;
              evas_object_clip_recalc(obj);
              if ((obj->restack) &&
                  (is_active) && (!obj->clip.clipees) &&
@@ -320,10 +325,13 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
         RD("      had map - restack objs\n");
 //        eina_array_push(restack_objects, obj);
         _evas_render_prev_cur_clip_cache_add(e, obj);
+        if (obj->changed)
+          {   
+             if (map != hmap) *redraw_all = 1;
+          }
      }
 
    /* handle normal rendering. this object knows how to handle maps */
-
    if (obj->changed)
      {
        if (obj->smart.smart)
@@ -340,7 +348,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
                                                     delete_objects,
                                                     render_objects,
                                                     obj->restack,
-                                                     map
+                                                     map,
+                                                     redraw_all
 #ifdef REND_DGB
                                                      , level + 1
 #endif
@@ -393,7 +402,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
                                                          restack_objects,
                                                          delete_objects,
                                                          render_objects,
-                                                         restack, map
+                                                         restack, map,
+                                                          redraw_all
 #ifdef REND_DGB
                                                           , level + 1
 #endif
@@ -439,7 +449,8 @@ _evas_render_phase1_object_process(Evas *e, Evas_Object *obj,
                                                      restack_objects,
                                                      delete_objects,
                                                      render_objects,
-                                                     restack, map
+                                                     restack, map,
+                                                     redraw_all
 #ifdef REND_DGB
                                                      , level + 1
 #endif
@@ -459,7 +470,8 @@ _evas_render_phase1_process(Evas *e,
                             Eina_Array *active_objects,
                             Eina_Array *restack_objects,
                             Eina_Array *delete_objects,
-                            Eina_Array *render_objects)
+                            Eina_Array *render_objects,
+                            int *redraw_all)
 {
    Evas_Layer *lay;
    Eina_Bool clean_them = EINA_FALSE;
@@ -473,7 +485,7 @@ _evas_render_phase1_process(Evas *e,
          {
             clean_them |= _evas_render_phase1_object_process
                (e, obj, active_objects, restack_objects, delete_objects,
-                render_objects, 0, 0
+                render_objects, 0, 0, redraw_all
 #ifdef REND_DGB
                 , 1
 #endif
@@ -481,7 +493,6 @@ _evas_render_phase1_process(Evas *e,
          }
      }
    RD("  ---]\n");
-
    return clean_them;
 }
 
@@ -743,6 +754,11 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
                                      obj->cur.geometry.y + off_y,
                                      obj->cur.geometry.w,
                                      obj->cur.geometry.h);
+                  RECTS_CLIP_TO_RECT(x, y, w, h,
+                                     obj->cur.cache.clip.x + off_x,
+                                     obj->cur.cache.clip.y + off_y,
+                                     obj->cur.cache.clip.w,
+                                     obj->cur.cache.clip.h);
                   e->engine.func->context_clip_set(e->engine.data.output,
                                                    ctx, x, y, w, h);
                   obj->func->render(obj, e->engine.data.output, ctx,
@@ -792,8 +808,16 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
                     }
                }
              else
-               obj->func->render(obj, e->engine.data.output, ctx,
-                                 surface, off_x, off_y);
+               {
+                  e->engine.func->context_clip_set(e->engine.data.output,
+                                                   ctx,
+                                                   obj->cur.cache.clip.x + off_x,
+                                                   obj->cur.cache.clip.y + off_y, 
+                                                   obj->cur.cache.clip.w,
+                                                   obj->cur.cache.clip.h);
+                  obj->func->render(obj, e->engine.data.output, ctx,
+                                    surface, off_x, off_y);
+               }
              e->engine.func->context_free(e->engine.data.output, ctx);
           }
         else
@@ -825,6 +849,7 @@ evas_render_updates_internal(Evas *e,
    int cx, cy, cw, ch;
    unsigned int i, j;
    int haveup = 0;
+   int redraw_all = 0;
 
    MAGIC_CHECK(e, Evas, MAGIC_EVAS);
    return NULL;
@@ -841,7 +866,12 @@ evas_render_updates_internal(Evas *e,
 
    /* phase 1. add extra updates for changed objects */
    if (e->invalidate || e->render_objects.count <= 0)
-     clean_them = _evas_render_phase1_process(e, &e->active_objects, &e->restack_objects, &e->delete_objects, &e->render_objects);
+     clean_them = _evas_render_phase1_process(e, 
+                                              &e->active_objects, 
+                                              &e->restack_objects, 
+                                              &e->delete_objects, 
+                                              &e->render_objects,
+                                              &redraw_all);
 
    _evas_render_phase1_direct(e, &e->active_objects, &e->restack_objects, &e->delete_objects, &e->render_objects);
 
@@ -881,6 +911,12 @@ evas_render_updates_internal(Evas *e,
      {
        ERR("viewport size != output size!");
      }
+   if (redraw_all)
+     {
+        e->engine.func->output_redraws_rect_add(e->engine.data.output,
+                                                0, 0,
+                                                e->output.w, e->output.h);
+     }
    /* phase 5. add obscures */
    EINA_LIST_FOREACH(e->obscures, ll, r)
      {
index c1a801c..ca8fe68 100644 (file)
@@ -518,7 +518,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
 
        gl = *text;
 
-       if (gl == 0) break;
        index = evas_common_font_glyph_search(fn, &fi, gl);
        LKL(fi->ft_mutex);
         if (fi->src->current_size != fi->size)
@@ -529,7 +528,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
              fi->src->current_size = fi->size;
           }
        fg = evas_common_font_int_cache_glyph_get(fi, index);
-       if (!fg) 
+       if (!fg)
           {
              LKU(fi->ft_mutex);
              continue;
@@ -848,7 +847,6 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva
    for (char_index = 0, c = 0, chr = 0 ; *text ; text++, char_index ++){
        struct cinfo *ci = metrics + char_index;
        ci->gl = *text;
-       if (ci->gl == 0) break;
        ci->index = evas_common_font_glyph_search(fn, &fi, ci->gl);
        LKL(fi->ft_mutex);
        if (fi->src->current_size != fi->size)
@@ -859,38 +857,40 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva
              fi->src->current_size = fi->size;
           }
        ci->fg = evas_common_font_int_cache_glyph_get(fi, ci->index);
-       LKU(fi->ft_mutex);
-       if (!ci->fg) continue;
+       if (!ci->fg)
+        {
+            LKU(fi->ft_mutex);
+           continue;
+        }
 
-        /* hmmm kerning means i can't sanely do my own cached metric tables! */
-       /* grrr - this means font face sharing is kinda... not an option if */
-       /* you want performance */
        if ((use_kerning) && (prev_index) && (ci->index) &&
             (pface == fi->src->ft.face))
           {
               int kern = 0;
 # ifdef BIDI_SUPPORT
              /* if it's rtl, the kerning matching should be reversed, i.e prev
-              * index is now the index and the other way around. 
+              * index is now the index and the other way around.
                * There is a slight exception when there are compositing chars
                * involved.*/
-             if (intl_props && 
+             if (intl_props && intl_props->props &&
                   evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
                   ci->fg->glyph->advance.x >> 16 > 0)
                {
                   if (evas_common_font_query_kerning(fi, ci->index, prev_index, &kern))
-                     ci->pos.x += kern;
+                     pen_x += kern;
                }
              else
 # endif
               {
 
                   if (evas_common_font_query_kerning(fi, prev_index, ci->index, &kern))
-                     ci->pos.x += kern;
+                     pen_x += kern;
              }
            }
 
        pface = fi->src->ft.face;
+
+       LKU(fi->ft_mutex);
        if (gl){
            ci->fg->ext_dat =dc->font_ext.func.gl_new(dc->font_ext.data,ci->fg);
            ci->fg->ext_dat_free = dc->font_ext.func.gl_free;
index a2e9d3a..53352b7 100644 (file)
@@ -2,7 +2,7 @@
 #define _EVAS_ENGINE_DIRECTFB_H
 
 #include <Evas.h>
-#include <directfb/directfb.h>
+#include <directfb.h>
 
 typedef struct _Evas_Engine_Info_DirectFB Evas_Engine_Info_DirectFB;