and support obscured rects for clip-out if middle of bordered image set to
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 17 Feb 2009 04:53:03 +0000 (04:53 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 17 Feb 2009 04:53:03 +0000 (04:53 +0000)
solid. speedup.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@39051 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

12 files changed:
src/lib/canvas/evas_object_gradient.c
src/lib/canvas/evas_object_gradient2_linear.c
src/lib/canvas/evas_object_gradient2_radial.c
src/lib/canvas/evas_object_image.c
src/lib/canvas/evas_object_line.c
src/lib/canvas/evas_object_polygon.c
src/lib/canvas/evas_object_rectangle.c
src/lib/canvas/evas_object_smart.c
src/lib/canvas/evas_object_text.c
src/lib/canvas/evas_object_textblock.c
src/lib/canvas/evas_render.c
src/lib/include/evas_private.h

index 5c3d385..3957859 100644 (file)
@@ -75,6 +75,8 @@ static const Evas_Object_Func object_func =
      evas_object_gradient_was_opaque,
      NULL,
      NULL,
+     NULL,
+     NULL,
      NULL
 };
 
index b2e7a1d..72404c7 100644 (file)
@@ -61,6 +61,8 @@ static const Evas_Object_Func object_func =
      NULL,
      NULL,
      NULL,
+     NULL,
+     NULL,
      NULL
 };
 
index 282e262..6cc236b 100644 (file)
@@ -61,6 +61,8 @@ static const Evas_Object_Func rg_object_func =
      NULL,
      NULL,
      NULL,
+     NULL,
+     NULL,
      NULL
 };
 
index 5ee8a96..ae76da1 100644 (file)
@@ -80,6 +80,8 @@ static void *evas_object_image_engine_data_get(Evas_Object *obj);
 static int evas_object_image_is_opaque(Evas_Object *obj);
 static int evas_object_image_was_opaque(Evas_Object *obj);
 static int evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
+static int evas_object_image_has_opaque_rect(Evas_Object *obj);
+static int evas_object_image_get_opaque_rect(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
 
 static void *evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_Colorspace to_cspace);
 static void evas_object_image_filled_resize_listener(void *data, Evas *e, Evas_Object *obj, void *einfo);
@@ -104,7 +106,9 @@ static const Evas_Object_Func object_func =
      evas_object_image_is_inside,
      NULL,
      NULL,
-     NULL
+     NULL,
+     evas_object_image_has_opaque_rect,
+     evas_object_image_get_opaque_rect
 };
 
 /**
@@ -2687,6 +2691,38 @@ evas_object_image_is_inside(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
    return (a != 0);
 }
 
+static int
+evas_object_image_has_opaque_rect(Evas_Object *obj)
+{
+   Evas_Object_Image *o;
+   
+   o = (Evas_Object_Image *)(obj->object_data);
+   if (((o->cur.border.l | o->cur.border.r | o->cur.border.t | o->cur.border.b) != 0) &&
+       (o->cur.border.fill == EVAS_BORDER_FILL_SOLID) &&
+       (obj->cur.render_op == EVAS_RENDER_BLEND) &&
+       (obj->cur.cache.clip.a == 255) &&
+       (o->cur.fill.x == 0) && 
+       (o->cur.fill.y == 0) &&
+       (o->cur.fill.w == obj->cur.geometry.w) &&
+       (o->cur.fill.h == obj->cur.geometry.h)
+       ) return 1;
+   return 0;
+}
+
+static int
+evas_object_image_get_opaque_rect(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
+{
+   Evas_Object_Image *o;
+   
+   o = (Evas_Object_Image *)(obj->object_data);
+   *x = obj->cur.geometry.x + o->cur.border.l;
+   *y = obj->cur.geometry.y + o->cur.border.t;
+   *w = obj->cur.geometry.w - (o->cur.border.l + o->cur.border.r);
+   if (*w < 0) *w = 0;
+   *h = obj->cur.geometry.h - (o->cur.border.t + o->cur.border.b);
+   if (*h < 0) *h = 0;
+}
+
 static void *
 evas_object_image_data_convert_internal(Evas_Object_Image *o, void *data, Evas_Colorspace to_cspace)
 {
index 360d5cd..df40b91 100644 (file)
@@ -63,6 +63,8 @@ static const Evas_Object_Func object_func =
      evas_object_line_is_inside,
      evas_object_line_was_inside,
      evas_object_line_coords_recalc,
+     NULL,
+     NULL,
      NULL
 };
 
index 8b27e81..fc0f257 100644 (file)
@@ -60,6 +60,8 @@ static const Evas_Object_Func object_func =
      evas_object_polygon_is_inside,
      evas_object_polygon_was_inside,
      NULL,
+     NULL,
+     NULL,
      NULL
 };
 
index d4454d1..fb352a2 100644 (file)
@@ -57,6 +57,8 @@ static const Evas_Object_Func object_func =
      NULL,
      NULL,
      NULL,
+     NULL,
+     NULL,
      NULL
 };
 
index 96d1b52..716b82f 100644 (file)
@@ -57,6 +57,8 @@ static const Evas_Object_Func object_func =
      NULL,
      NULL,
      NULL,
+     NULL,
+     NULL,
      NULL
 };
 
index 6078ede..7d1eda9 100644 (file)
@@ -72,7 +72,9 @@ static const Evas_Object_Func object_func =
      NULL,
      NULL,
      NULL,
-     evas_object_text_scale_update
+     evas_object_text_scale_update,
+     NULL,
+     NULL
 };
 
 /* the actual api call to add a rect */
index 2680d0b..09c67c1 100644 (file)
@@ -175,7 +175,9 @@ static const Evas_Object_Func object_func =
      NULL,
      NULL,
      evas_object_textblock_coords_recalc,
-     evas_object_textblock_scale_update
+     evas_object_textblock_scale_update,
+     NULL,
+     NULL
 };
 
 /* the actual api call to add a textblock */
index a986cb6..aac82b8 100644 (file)
@@ -400,7 +400,9 @@ evas_render_updates_internal(Evas *e, unsigned char make_updates, unsigned char
        Evas_Object *obj;
 
        obj = eina_array_data_get(&e->active_objects, i);
-       if (UNLIKELY(evas_object_is_opaque(obj) &&
+       if (UNLIKELY((evas_object_is_opaque(obj) ||
+                      ((obj->func->has_opaque_rect) &&
+                       (obj->func->has_opaque_rect(obj)))) &&
                      evas_object_is_visible(obj) &&
                      (!obj->clip.clipees) &&
                      (obj->cur.visible) &&
@@ -476,21 +478,6 @@ evas_render_updates_internal(Evas *e, unsigned char make_updates, unsigned char
                                          obj->cur.cache.clip.h);
                       if ((w > 0) && (h > 0))
                         {
-///                   printf("CLIP: %p | %i %i, %ix%i | %p %i %i %ix%i\n",
-///                          obj,
-///                          x, y, w, h,
-///                          obj->cur.clipper,
-///                          obj->cur.cache.clip.x + off_x,
-///                          obj->cur.cache.clip.y + off_y,
-///                          obj->cur.cache.clip.w,
-///                          obj->cur.cache.clip.h
-///                          );
-///                        if (((obj->cur.cache.clip.x + off_x) == 0) &&
-///                            ((obj->cur.cache.clip.w) == 960))
-///                          {
-///                             abort();
-///                          }
-
                            e->engine.func->context_clip_set(e->engine.data.output,
                                                             e->engine.data.context,
                                                             x, y, w, h);
@@ -500,12 +487,37 @@ evas_render_updates_internal(Evas *e, unsigned char make_updates, unsigned char
                                 Evas_Object *obj2;
 
                                 obj2 = (Evas_Object *) eina_array_data_get(&e->temporary_objects, j);
-                                e->engine.func->context_cutout_add(e->engine.data.output,
-                                                                   e->engine.data.context,
-                                                                   obj2->cur.cache.clip.x + off_x,
-                                                                   obj2->cur.cache.clip.y + off_y,
-                                                                   obj2->cur.cache.clip.w,
-                                                                   obj2->cur.cache.clip.h);
+                                 if (evas_object_is_opaque(obj2))
+                                   e->engine.func->context_cutout_add(e->engine.data.output,
+                                                                      e->engine.data.context,
+                                                                      obj2->cur.cache.clip.x + off_x,
+                                                                      obj2->cur.cache.clip.y + off_y,
+                                                                      obj2->cur.cache.clip.w,
+                                                                      obj2->cur.cache.clip.h);
+                                 else
+                                   {
+                                      if (obj2->func->get_opaque_rect)
+                                        {
+                                           Evas_Coord obx, oby, obw, obh;
+                                           
+                                           obj2->func->get_opaque_rect
+                                             (obj2, &obx, &oby, &obw, &obh);
+                                           if ((obw > 0) && (obh > 0))
+                                             {
+                                                obx += off_x;
+                                                oby += off_y;
+                                                RECTS_CLIP_TO_RECT(obx, oby, obw, obh,
+                                                                   obj2->cur.cache.clip.x + off_x,
+                                                                   obj2->cur.cache.clip.y + off_y,
+                                                                   obj2->cur.cache.clip.w,
+                                                                   obj2->cur.cache.clip.h);
+                                                e->engine.func->context_cutout_add(e->engine.data.output,
+                                                                                   e->engine.data.context,
+                                                                                   obx, oby,
+                                                                                   obw, obh);
+                                             }
+                                        }
+                                   }
                              }
 #endif
                            obj->func->render(obj,
index ee63a8b..cd871df 100644 (file)
@@ -531,6 +531,9 @@ struct _Evas_Object_Func
    void (*coords_recalc) (Evas_Object *obj);
    
    void (*scale_update) (Evas_Object *obj);
+
+   int (*has_opaque_rect) (Evas_Object *obj);
+   int (*get_opaque_rect) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
 };
 
 struct _Evas_Func