forked from enlightenment/efl
evas now uses
EVAS_DEBUG_SHOW EVAS_DEBUG_ABORT environment variables to disctate if: 1. it displays any error output if it encorunters wrong object types, NULLs etc. 2. if it should call abort() on such an error so it can be easily caught with gdb as a segv. if these enironment variables exists it will do both.. if they dont it will not perform the appropriate action. (so now by default evas remains quiet and marches on) SVN revision: 6915
This commit is contained in:
parent
9e87031686
commit
72c06b259b
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 *
|
||||
|
|
Loading…
Reference in New Issue