cover up segv where somehow the alpha flag is set in the 16bit engine but the

alpha pixel pointer is NULL. couldn't see where that happens, but it's now
protected against it.


SVN revision: 34968
This commit is contained in:
Carsten Haitzler 2008-07-02 00:57:26 +00:00
parent fa688b14b1
commit 6f480338d4
2 changed files with 10 additions and 13 deletions

View File

@ -93,10 +93,11 @@ _soft16_image_draw_scaled_no_mul(Soft16_Image *src, Soft16_Image *dst,
int dst_offset, int w, int h, int dst_offset, int w, int h,
int *offset_x, int *offset_y) int *offset_x, int *offset_y)
{ {
if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) if ((src->cache_entry.flags.alpha && src->alpha) &&
(!dst->cache_entry.flags.alpha))
_soft16_image_draw_scaled_transp_solid _soft16_image_draw_scaled_transp_solid
(src, dst, dc, dst_offset, w, h, offset_x, offset_y); (src, dst, dc, dst_offset, w, h, offset_x, offset_y);
else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) else if (!dst->cache_entry.flags.alpha)
_soft16_image_draw_scaled_solid_solid _soft16_image_draw_scaled_solid_solid
(src, dst, dc, dst_offset, w, h, offset_x, offset_y); (src, dst, dc, dst_offset, w, h, offset_x, offset_y);
else else
@ -205,10 +206,11 @@ _soft16_image_draw_scaled_mul_alpha(Soft16_Image *src, Soft16_Image *dst,
int dst_offset, int w, int h, int dst_offset, int w, int h,
int *offset_x, int *offset_y, DATA8 a) int *offset_x, int *offset_y, DATA8 a)
{ {
if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) if ((src->cache_entry.flags.alpha && src->alpha) &&
(!dst->cache_entry.flags.alpha))
_soft16_image_draw_scaled_transp_solid_mul_alpha _soft16_image_draw_scaled_transp_solid_mul_alpha
(src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) else if (!dst->cache_entry.flags.alpha)
_soft16_image_draw_scaled_solid_solid_mul_alpha _soft16_image_draw_scaled_solid_solid_mul_alpha
(src, dst, dc, dst_offset, w, h, offset_x, offset_y, a); (src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
else else
@ -387,10 +389,11 @@ _soft16_image_draw_scaled_mul_color(Soft16_Image *src, Soft16_Image *dst,
int *offset_x, int *offset_y, int *offset_x, int *offset_y,
DATA8 r, DATA8 g, DATA8 b, DATA8 a) DATA8 r, DATA8 g, DATA8 b, DATA8 a)
{ {
if (src->cache_entry.flags.alpha && (!dst->cache_entry.flags.alpha)) if ((src->cache_entry.flags.alpha && src->alpha) &&
(!dst->cache_entry.flags.alpha))
_soft16_image_draw_scaled_transp_solid_mul_color _soft16_image_draw_scaled_transp_solid_mul_color
(src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a);
else if ((!src->cache_entry.flags.alpha) && (!dst->cache_entry.flags.alpha)) else if (!dst->cache_entry.flags.alpha)
_soft16_image_draw_scaled_solid_solid_mul_color _soft16_image_draw_scaled_solid_solid_mul_color
(src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a); (src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a);
else else

View File

@ -94,16 +94,10 @@ _evas_common_soft16_image_new(void)
{ {
Soft16_Image *im; Soft16_Image *im;
im = malloc(sizeof (Soft16_Image)); im = calloc(1, sizeof(Soft16_Image));
if (!im) return NULL; if (!im) return NULL;
im->stride = -1; im->stride = -1;
im->pixels = NULL;
im->alpha = NULL;
/* When is have_alpha set ? */
/* im->flags.have_alpha = 0; */
im->flags.free_pixels = 0;
im->flags.free_alpha = 0;
return (Image_Entry *) im; return (Image_Entry *) im;
} }