Enlightenment CVS committal Author : raster Project : e17 Module : libs/evas
Dir : e17/libs/evas/src/lib/engines/common Modified Files: evas_image_main.c evas_scale_smooth_scaler.c evas_scale_smooth_scaler_noscale.c Log Message: well it was an interesting experiment. but the blender code is already so optimal... we dont gain much at all. :( =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_image_main.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- evas_image_main.c 26 Jan 2005 07:49:56 -0000 1.14 +++ evas_image_main.c 26 Jan 2005 16:42:28 -0000 1.15 @@ -76,6 +76,100 @@ #endif } +/* alpha tiles! - asctually span lists - need to do it as span lists */ +void +evas_common_image_surface_alpha_tiles_calc(RGBA_Surface *is, int tsize) +{ + int x, y; + DATA32 *ptr; + +#if 1 + return; +#endif + /* hmm i only get about a 15% speedup on my "best cases". the complexity + * imho isn't worth the small gain, so i have disabled it here :( (this + * is best case scenario - average case will be much less gain) + * + * thought for now the only case is + */ + if (is->spans) return; + if (!(is->im->flags & RGBA_IMAGE_HAS_ALPHA)) return; + /* FIXME: dont handle alpha only images yet */ + if ((is->im->flags & RGBA_IMAGE_ALPHA_ONLY)) return; + if (tsize < 0) tsize = 0; + is->spans = calloc(1, sizeof(RGBA_Image_Span *) * is->h); + if (!is->spans) return; + ptr = is->data; + for (y = 0; y < is->h; y++) + { + RGBA_Image_Span *sp; + + sp = NULL; + for (x = 0; x < is->w; x++) + { + DATA8 a; + + a = A_VAL(ptr); + if (sp) + { + if (a == 0) + { + is->spans[y] = evas_object_list_append(is->spans[y], sp); + sp = NULL; + } + else + { + sp->w++; + if ((sp->v == 2) && (a != 255)) sp->v = 1; + } + } + else + { + if (a == 255) + { + sp = calloc(1, sizeof(RGBA_Image_Span)); + sp->x = x; + sp->w = 1; + sp->v = 2; + } + else if (a > 0) + { + sp = calloc(1, sizeof(RGBA_Image_Span)); + sp->x = x; + sp->w = 1; + sp->v = 1; + } + } + ptr++; + } + if (sp) + { + is->spans[y] = evas_object_list_append(is->spans[y], sp); + sp = NULL; + } + } +} + +void +evas_common_image_surface_alpha_tiles_free(RGBA_Surface *is) +{ + int i; + + if (!is->spans) return; + for (i = 0; i < is->h; i++) + { + while (is->spans[i]) + { + RGBA_Image_Span *sp; + + sp = is->spans[i]; + is->spans[i] = evas_object_list_remove(sp, sp); + free(sp); + } + } + free(is->spans); +} + RGBA_Surface * evas_common_image_surface_new(RGBA_Image *im) { @@ -125,6 +219,7 @@ free(is->data); is->data = NULL; } + evas_common_image_surface_alpha_tiles_free(is); } RGBA_Image * @@ -429,6 +524,7 @@ { int i; + if (im->image) evas_common_image_surface_alpha_tiles_free(im->image); evas_common_image_unstore(im); im->flags |= RGBA_IMAGE_IS_DIRTY; } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_scale_smooth_scaler.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- evas_scale_smooth_scaler.c 30 Jan 2004 05:46:57 -0000 1.7 +++ evas_scale_smooth_scaler.c 26 Jan 2005 16:42:30 -0000 1.8 @@ -209,6 +209,8 @@ * -:- * */ + /* 8x8 tiles - this will incurr about a < 2% memory overhead */ + evas_common_image_surface_alpha_tiles_calc(src->image, 8); /* if 1:1 scale */ if ((dst_region_w == src_region_w) && =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/engines/common/evas_scale_smooth_scaler_noscale.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- evas_scale_smooth_scaler_noscale.c 30 Jan 2004 05:46:57 -0000 1.1 +++ evas_scale_smooth_scaler_noscale.c 26 Jan 2005 16:42:30 -0000 1.2 @@ -1,7 +1,7 @@ { DATA32 *src_data; - src_data = src->image->data; + src_data = src->image->data; ptr = src_data + ((dst_clip_y - dst_region_y + src_region_y) * src_w) + (dst_clip_x - dst_region_x) + src_region_x; if (dc->mod.use) { @@ -32,11 +32,63 @@ Gfx_Func_Blend_Src_Dst func; func = evas_common_draw_func_blend_get(src, dst, dst_clip_w); - for (y = 0; y < dst_clip_h; y++) +#if 0 + /* part of the spans experiemnt. doesnt seem to help much on top of + * what we already have + */ + if (src->image->spans) { - func(ptr, dst_ptr, dst_clip_w); - ptr += src_w; - dst_ptr += dst_w; + int x2, y2; + int xoff, woff; + RGBA_Image_Flags pflags; + Gfx_Func_Blend_Src_Dst func_solid; + + pflags = src->flags; + src->flags &= ~RGBA_IMAGE_HAS_ALPHA; + func_solid = evas_common_draw_func_blend_get(src, dst, dst_clip_w); + src->flags = pflags; + + x2 = (dst_clip_x - dst_region_x) + src_region_x; + y2 = (dst_clip_y - dst_region_y) + src_region_y; + for (y = 0; y < dst_clip_h; y++, y2++) + { + Evas_Object_List *l; + + for (l = src->image->spans[y2]; l; l = l->next) + { + RGBA_Image_Span *sp; + + sp = l; + if ((sp->x + sp->w) > x2) + { + xoff = sp->x - x2; + woff = sp->w; + if (xoff < 0) + { + woff += xoff; + xoff = 0; + } + if ((xoff + woff) > (dst_clip_w)) + woff += (dst_clip_w) - (xoff + woff); + if (sp->v == 2) + func_solid(ptr + xoff, dst_ptr + xoff, woff); + else + func(ptr + xoff, dst_ptr + xoff, woff); + } + } + ptr += src_w; + dst_ptr += dst_w; + } + } + else +#endif + { + for (y = 0; y < dst_clip_h; y++) + { + func(ptr, dst_ptr, dst_clip_w); + ptr += src_w; + dst_ptr += dst_w; + } } } } ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs