forked from enlightenment/efl
check sparseness when doing eet loads.
SVN revision: 26300
This commit is contained in:
parent
3df80d676c
commit
42aa3066e9
|
@ -594,8 +594,6 @@ evas_common_image_alpha_line_buffer_free(void)
|
||||||
evas_alpha_line_buffer = NULL;
|
evas_alpha_line_buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ALPHA_SPARSE_INV_FRACTION 3
|
|
||||||
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_image_premul(RGBA_Image *im)
|
evas_common_image_premul(RGBA_Image *im)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,10 @@
|
||||||
# define DM_SHF(_b) (DM_BITS - (8 - _b))
|
# define DM_SHF(_b) (DM_BITS - (8 - _b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* if more than 1/ALPHA_SPARSE_INV_FRACTION is "alpha" (1-254) then sparse
|
||||||
|
* alpha flag gets set */
|
||||||
|
#define ALPHA_SPARSE_INV_FRACTION 3
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
@ -48,7 +48,6 @@ evas_image_load_file_head_eet(RGBA_Image *im, const char *file, const char *key)
|
||||||
im->image->w = w;
|
im->image->w = w;
|
||||||
im->image->h = h;
|
im->image->h = h;
|
||||||
eet_close(ef);
|
eet_close(ef);
|
||||||
evas_common_image_set_alpha_sparse(im);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,6 +58,7 @@ evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key)
|
||||||
int alpha, compression, quality, lossy;
|
int alpha, compression, quality, lossy;
|
||||||
Eet_File *ef;
|
Eet_File *ef;
|
||||||
DATA32 *body, *p, *end;
|
DATA32 *body, *p, *end;
|
||||||
|
DATA32 nas = 0;
|
||||||
|
|
||||||
if ((!file) || (!key)) return 0;
|
if ((!file) || (!key)) return 0;
|
||||||
if ((im->image) && (im->image->data)) return 1;
|
if ((im->image) && (im->image->data)) return 1;
|
||||||
|
@ -101,11 +101,14 @@ evas_image_load_file_data_eet(RGBA_Image *im, const char *file, const char *key)
|
||||||
r = R_VAL(p);
|
r = R_VAL(p);
|
||||||
g = G_VAL(p);
|
g = G_VAL(p);
|
||||||
b = B_VAL(p);
|
b = B_VAL(p);
|
||||||
|
if ((a == 0) || (a == 255)) nas++;
|
||||||
if (r > a) r = a;
|
if (r > a) r = a;
|
||||||
if (g > a) g = a;
|
if (g > a) g = a;
|
||||||
if (b > a) b = a;
|
if (b > a) b = a;
|
||||||
*p = ARGB_JOIN(a, r, g, b);
|
*p = ARGB_JOIN(a, r, g, b);
|
||||||
}
|
}
|
||||||
|
if ((ALPHA_SPARSE_INV_FRACTION * nas) >= (im->image->w * im->image->h))
|
||||||
|
im->flags |= RGBA_IMAGE_ALPHA_SPARSE;
|
||||||
}
|
}
|
||||||
// result is already premultiplied now if u compile with edje
|
// result is already premultiplied now if u compile with edje
|
||||||
// evas_common_image_premul(im);
|
// evas_common_image_premul(im);
|
||||||
|
|
Loading…
Reference in New Issue