diff --git a/legacy/evas/evas.c.in b/legacy/evas/evas.c.in index 65d7d96106..e9e6db4537 100644 --- a/legacy/evas/evas.c.in +++ b/legacy/evas/evas.c.in @@ -466,6 +466,7 @@ make CFLAGS="-O9 -I/opt/Embedix/tools/arm-linux/include" @todo (1.0) Document API +@todo (1.0) Guard against image fills that are too big to calculate @todo (1.0) Move callback processing to a queue and do it asynchronously @todo (1.0) Add button grabbing @todo (1.0) Add generic object method call system diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c index eb77c00b8f..ac6c22cd03 100644 --- a/legacy/evas/src/lib/engines/common/evas_scale_smooth.c +++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth.c @@ -14,6 +14,7 @@ scale_calc_y_points(DATA32 *src, int sw, int sh, int dh) int i, val, inc; p = malloc((dh + 1) * sizeof(DATA32 *)); +// if (!p) return NULL; val = 0; inc = (sh << 16) / dh; for (i = 0; i < dh; i++) @@ -32,6 +33,7 @@ scale_calc_x_points(int sw, int dw) int i, val, inc; p = malloc((dw + 1) * sizeof(int)); +// if (!p) return NULL; val = 0; inc = (sw << 16) / dw; for (i = 0; i < dw; i++) @@ -50,7 +52,7 @@ scale_calc_a_points(int s, int d) int i, val, inc; p = malloc(d * sizeof(int)); - +// if (!p) return NULL; if (d >= s) { val = 0; diff --git a/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler.c b/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler.c index b5d9ce0923..0a9b075a87 100644 --- a/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler.c +++ b/legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler.c @@ -18,12 +18,15 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, int dst_jump; int dst_clip_x, dst_clip_y, dst_clip_w, dst_clip_h; int src_w, src_h, dst_w, dst_h; + +// printf("in [0] dst_region_w %i\n", dst_region_w); if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 0, 0, dst->image->w, dst->image->h))) return; if (!(RECTS_INTERSECT(src_region_x, src_region_y, src_region_w, src_region_h, 0, 0, src->image->w, src->image->h))) return; +// printf("in [1] dst_region_w %i\n", dst_region_w); src_w = src->image->w; src_h = src->image->h; dst_w = dst->image->w; @@ -58,6 +61,7 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, dst_clip_w = dst_w; dst_clip_h = dst_h; } +// printf("in [2] dst_region_w %i\n", dst_region_w); if (dst_clip_x < dst_region_x) { @@ -78,6 +82,7 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, (dst_region_w <= 0) || (dst_region_h <= 0) || (dst_clip_w <= 0) || (dst_clip_h <= 0)) return; +// printf("in [3] dst_region_w %i\n", dst_region_w); /* sanitise x */ if (src_region_x < 0) @@ -87,12 +92,14 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, src_region_w += src_region_x; src_region_x = 0; } +// printf("in [4] dst_region_w %i\n", dst_region_w); if (src_region_x >= src_w) return; if ((src_region_x + src_region_w) > src_w) { dst_region_w = (dst_region_w * (src_w - src_region_x)) / (src_region_w); src_region_w = src_w - src_region_x; } +// printf("in [5] dst_region_w %i\n", dst_region_w); if (dst_region_w <= 0) return; if (src_region_w <= 0) return; if (dst_clip_x < 0) @@ -112,6 +119,7 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst, dst_clip_w = dst_w - dst_clip_x; } if (dst_clip_w <= 0) return; +// printf("in [6] dst_region_w %i\n", dst_region_w); /* sanitise y */ if (src_region_y < 0) diff --git a/legacy/evas/src/lib/main.c b/legacy/evas/src/lib/main.c index 922ec49ebe..c7619b9bc0 100644 --- a/legacy/evas/src/lib/main.c +++ b/legacy/evas/src/lib/main.c @@ -3,6 +3,9 @@ #include "Evas.h" int _evas_alloc_error = 0; +static int _evas_debug_init = 0; +static int _evas_debug_show = 0; +static int _evas_debug_abort = 0; /** * Return if any allocation errors have occured during the prior function @@ -92,33 +95,62 @@ evas_mem_calloc(int size) void evas_debug_error(void) { - fprintf(stderr, - "*** EVAS ERROR: Evas Magic Check Failed!!!\n"); + if (!_evas_debug_init) + { + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; + } + if (_evas_debug_show) + fprintf(stderr, + "*** EVAS ERROR: Evas Magic Check Failed!!!\n"); } void evas_debug_input_null(void) { - fprintf(stderr, - " Input object pointer is NULL!\n"); + if (!_evas_debug_init) + { + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; + } + if (_evas_debug_show) + fprintf(stderr, + " Input object pointer is NULL!\n"); } void evas_debug_magic_null(void) { - fprintf(stderr, - " Input object is zero'ed out (maybe a freed object or zero-filled RAM)!\n"); + if (!_evas_debug_init) + { + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; + } + if (_evas_debug_show) + fprintf(stderr, + " Input object is zero'ed out (maybe a freed object or zero-filled RAM)!\n"); } void evas_debug_magic_wrong(DATA32 expected, DATA32 supplied) { - fprintf(stderr, - " Input object is wrong type\n" - " Expected: %08x - %s\n" - " Supplied: %08x - %s\n", - expected, evas_debug_magic_string_get(expected), - supplied, evas_debug_magic_string_get(supplied)); + if (!_evas_debug_init) + { + if (getenv("EVAS_DEBUG_SHOW")) _evas_debug_show = 1; + if (getenv("EVAS_DEBUG_ABORT")) _evas_debug_abort = 1; + _evas_debug_init = 1; + } + if (_evas_debug_show) + fprintf(stderr, + " Input object is wrong type\n" + " Expected: %08x - %s\n" + " Supplied: %08x - %s\n", + expected, evas_debug_magic_string_get(expected), + supplied, evas_debug_magic_string_get(supplied)); + if (_evas_debug_abort) abort(); } char *