From: raster Date: Mon, 12 Oct 2009 15:22:38 +0000 (+0000) Subject: mini-speedups! X-Git-Tag: 2.0_alpha~240^2~2273 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2f422d8ff5f2b494f7a5f77fd20426c5ed40f23;p=framework%2Fuifw%2Fevas.git mini-speedups! git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@43037 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/canvas/evas_object_image.c b/src/lib/canvas/evas_object_image.c index c822c77..e485e14 100644 --- a/src/lib/canvas/evas_object_image.c +++ b/src/lib/canvas/evas_object_image.c @@ -2769,10 +2769,22 @@ static int evas_object_image_is_opaque(Evas_Object *obj) { Evas_Object_Image *o; + int v; /* this returns 1 if the internal object data implies that the object is */ /* currently fully opaque over the entire rectangle it occupies */ o = (Evas_Object_Image *)(obj->object_data); + if (o->cur.has_alpha) return 0; + v = (!!!o->cur.fill.w) + (!!!o->cur.fill.h); + if (v) return 0; + if (!o->engine_data) return 0; + v = o->cur.border.l + o->cur.border.r + o->cur.border.t + o->cur.border.b; + v += !o->cur.border.fill; + if (v > 0) return 0; + if (obj->cur.render_op == EVAS_RENDER_COPY) return 1; + if (obj->cur.render_op != EVAS_RENDER_BLEND) return 0; + return 1; +/* if ((o->cur.fill.w < 1) || (o->cur.fill.h < 1)) return 0; if (((o->cur.border.l != 0) || @@ -2781,12 +2793,10 @@ evas_object_image_is_opaque(Evas_Object *obj) (o->cur.border.b != 0)) && (!o->cur.border.fill)) return 0; if (!o->engine_data) return 0; - if (obj->cur.render_op == EVAS_RENDER_COPY) - return 1; + if (obj->cur.render_op == EVAS_RENDER_COPY) return 1; if (o->cur.has_alpha) return 0; - if (obj->cur.render_op != EVAS_RENDER_BLEND) - return 0; return 1; + */ } static int diff --git a/src/lib/engines/common/evas_draw_main.c b/src/lib/engines/common/evas_draw_main.c index 3c2962b..2fbce2d 100644 --- a/src/lib/engines/common/evas_draw_main.c +++ b/src/lib/engines/common/evas_draw_main.c @@ -30,18 +30,17 @@ evas_common_draw_context_cutouts_add(Cutout_Rects* rects, { Cutout_Rect* rect; - if (rects->max < (rects->active + 1)) + rects->active++; + if (rects->max < rects->active) { - rects->max += 32; + rects->max += 1024; rects->rects = realloc(rects->rects, sizeof(Cutout_Rect) * rects->max); } - - rect = rects->rects + rects->active; + rect = rects->rects + rects->active - 1; rect->x = x; rect->y = y; rect->w = w; rect->h = h; - rects->active++; return rect; } @@ -187,8 +186,34 @@ evas_common_draw_context_add_cutout(RGBA_Draw_Context *dc, int x, int y, int w, { if (dc->clip.use) { +#if 1 // this is a bit faster + int xa1, xa2, xb1, xb2; + + xa1 = x; + xa2 = xa1 + w - 1; + xb1 = dc->clip.x; + if (xa2 < xb1) return; + xb2 = xb1 + dc->clip.w - 1; + if (xa1 >= xb2) return; + if (xa2 > xb2) xa2 = xb2; + if (xb1 > xa1) xa1 = xb1; + x = xa1; + w = xa2 - xa1 + 1; + + xa1 = y; + xa2 = xa1 + h - 1; + xb1 = dc->clip.y; + if (xa2 < xb1) return; + xb2 = xb1 + dc->clip.h - 1; + if (xa1 >= xb2) return; + if (xa2 > xb2) xa2 = xb2; + if (xb1 > xa1) xa1 = xb1; + y = xa1; + h = xa2 - xa1 + 1; +#else RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); +#endif if ((w < 1) || (h < 1)) return; } evas_common_draw_context_cutouts_add(&dc->cutout, x, y, w, h); diff --git a/src/lib/include/evas_macros.h b/src/lib/include/evas_macros.h index 56d8351..ba1ab6e 100644 --- a/src/lib/include/evas_macros.h +++ b/src/lib/include/evas_macros.h @@ -23,7 +23,6 @@ ((((x) & 0x00ff ) << 8) | \ (((x) & 0xff00 ) >> 8)) - #define SPANS_COMMON(x1, w1, x2, w2) \ (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1))))) diff --git a/src/modules/engines/gl_x11/evas_engine.c b/src/modules/engines/gl_x11/evas_engine.c index 1e99aa8..35715a7 100644 --- a/src/modules/engines/gl_x11/evas_engine.c +++ b/src/modules/engines/gl_x11/evas_engine.c @@ -139,9 +139,9 @@ eng_output_resize(void *data, int w, int h) static void eng_output_tile_size_set(void *data, int w __UNUSED__, int h __UNUSED__) { - Render_Engine *re; - - re = (Render_Engine *)data; +// Render_Engine *re; +// +// re = (Render_Engine *)data; } static void @@ -179,9 +179,9 @@ eng_output_redraws_rect_add(void *data, int x, int y, int w, int h) static void eng_output_redraws_rect_del(void *data, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) { - Render_Engine *re; - - re = (Render_Engine *)data; +// Render_Engine *re; +// +// re = (Render_Engine *)data; } static void @@ -304,28 +304,28 @@ eng_output_flush(void *data) static void eng_output_idle_flush(void *data) { - Render_Engine *re; - - re = (Render_Engine *)data; +// Render_Engine *re; +// +// re = (Render_Engine *)data; } static void eng_context_cutout_add(void *data, void *context, int x, int y, int w, int h) { - Render_Engine *re; - - re = (Render_Engine *)data; - re->win->gl_context->dc = context; +// Render_Engine *re; +// +// re = (Render_Engine *)data; +// re->win->gl_context->dc = context; evas_common_draw_context_add_cutout(context, x, y, w, h); } static void eng_context_cutout_clear(void *data, void *context) { - Render_Engine *re; - - re = (Render_Engine *)data; - re->win->gl_context->dc = context; +// Render_Engine *re; +// +// re = (Render_Engine *)data; +// re->win->gl_context->dc = context; evas_common_draw_context_clear_cutouts(context); } @@ -623,10 +623,10 @@ eng_gradient_draw(void *data, void *context, void *surface __UNUSED__, void *gra static int eng_image_alpha_get(void *data, void *image) { - Render_Engine *re; +// Render_Engine *re; Evas_GL_Image *im; - re = (Render_Engine *)data; +// re = (Render_Engine *)data; if (!image) return 1; im = image; /* FIXME: can move to gl_common */ @@ -643,10 +643,10 @@ eng_image_alpha_get(void *data, void *image) static int eng_image_colorspace_get(void *data, void *image) { - Render_Engine *re; +// Render_Engine *re; Evas_GL_Image *im; - re = (Render_Engine *)data; +// re = (Render_Engine *)data; if (!image) return EVAS_COLORSPACE_ARGB8888; im = image; return im->cs.space; @@ -686,27 +686,27 @@ eng_image_alpha_set(void *data, void *image, int has_alpha) static void * eng_image_border_set(void *data, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__) { - Render_Engine *re; - - re = (Render_Engine *)data; +// Render_Engine *re; +// +// re = (Render_Engine *)data; return image; } static void eng_image_border_get(void *data, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__) { - Render_Engine *re; - - re = (Render_Engine *)data; +// Render_Engine *re; +// +// re = (Render_Engine *)data; } static char * eng_image_comment_get(void *data, void *image, char *key __UNUSED__) { - Render_Engine *re; +// Render_Engine *re; Evas_GL_Image *im; - re = (Render_Engine *)data; +// re = (Render_Engine *)data; if (!image) return NULL; im = image; return im->im->info.comment; @@ -715,10 +715,10 @@ eng_image_comment_get(void *data, void *image, char *key __UNUSED__) static char * eng_image_format_get(void *data, void *image) { - Render_Engine *re; +// Render_Engine *re; Evas_GL_Image *im; - re = (Render_Engine *)data; +// re = (Render_Engine *)data; im = image; return NULL; } @@ -823,9 +823,9 @@ eng_image_free(void *data, void *image) static void eng_image_size_get(void *data, void *image, int *w, int *h) { - Render_Engine *re; - - re = (Render_Engine *)data; +// Render_Engine *re; +// +// re = (Render_Engine *)data; if (!image) { *w = 0;