forked from enlightenment/efl
Evas filters: Rename RGBA_Image::mask.data into image.data8
The structure should not be changed, despite the union modification. I am renaming for consistency with older branches that had a mask field in RGBA_Image. Also, the mask.data or data8 is really just a way to avoid casting between DATA8 and DATA32 (and it shows clearly what kind of data you are dealing with).
This commit is contained in:
parent
993bd965ed
commit
ac8140ccd1
|
@ -495,7 +495,7 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
|
|||
// FIXME: Font draw not optimized for Alpha targets! SLOW!
|
||||
// This is not pretty :)
|
||||
|
||||
DATA8 *dst8 = dst_image->mask.data + x + (y * dst_pitch);
|
||||
DATA8 *dst8 = dst_image->image.data8 + x + (y * dst_pitch);
|
||||
Alpha_Gfx_Func func;
|
||||
DATA8 *src8;
|
||||
int row;
|
||||
|
|
|
@ -36,8 +36,8 @@ evas_common_rgba_image_from_data(Image_Entry* ie_dst, int w, int h, DATA32 *imag
|
|||
case EVAS_COLORSPACE_GRY8:
|
||||
dst->cache_entry.w = w;
|
||||
dst->cache_entry.h = h;
|
||||
dst->mask.data = (DATA8 *) image_data;
|
||||
dst->mask.no_free = 1;
|
||||
dst->image.data8 = (DATA8 *) image_data;
|
||||
dst->image.no_free = 1;
|
||||
dst->cache_entry.flags.alpha = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -75,7 +75,7 @@ evas_common_rgba_image_from_copied_data(Image_Entry* ie_dst, int w, int h, DATA3
|
|||
case EVAS_COLORSPACE_GRY8:
|
||||
dst->cache_entry.flags.alpha = 1;
|
||||
if (image_data)
|
||||
memcpy(dst->mask.data, image_data, w * h * sizeof(DATA8));
|
||||
memcpy(dst->image.data8, image_data, w * h * sizeof(DATA8));
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
|
|
|
@ -1360,7 +1360,7 @@ _fill_cpu(Evas_Filter_Command *cmd)
|
|||
int step = fb->alpha_only ? sizeof(DATA8) : sizeof(DATA32);
|
||||
int x = MAX(0, cmd->draw.clip.x);
|
||||
int y = MAX(0, cmd->draw.clip.y);
|
||||
DATA8 *ptr = ((RGBA_Image *) fb->backing)->mask.data;
|
||||
DATA8 *ptr = ((RGBA_Image *) fb->backing)->image.data8;
|
||||
int w, h, k, j;
|
||||
|
||||
if (!cmd->draw.clip_mode_lrtb)
|
||||
|
|
|
@ -44,8 +44,8 @@ _image_draw_cpu_alpha2alpha(void *data EINA_UNUSED, void *context,
|
|||
struct Alpha_Blend_Draw_Context *dc = context;
|
||||
RGBA_Image *src = image;
|
||||
RGBA_Image *dst = surface;
|
||||
DATA8* srcdata = src->mask.data;
|
||||
DATA8* dstdata = dst->mask.data;
|
||||
DATA8* srcdata = src->image.data8;
|
||||
DATA8* dstdata = dst->image.data8;
|
||||
Alpha_Gfx_Func func;
|
||||
int y, sw, dw;
|
||||
|
||||
|
@ -80,7 +80,7 @@ _image_draw_cpu_alpha2rgba(void *data EINA_UNUSED, void *context,
|
|||
struct Alpha_Blend_Draw_Context *dc = context;
|
||||
RGBA_Image *src = image;
|
||||
RGBA_Image *dst = surface;
|
||||
DATA8* srcdata = src->mask.data;
|
||||
DATA8* srcdata = src->image.data8;
|
||||
DATA32* dstdata = dst->image.data;
|
||||
RGBA_Gfx_Func func;
|
||||
int y, sw, dw;
|
||||
|
@ -118,8 +118,8 @@ _filter_blend_cpu_generic_do(Evas_Filter_Command *cmd,
|
|||
out = cmd->output->backing;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->image.data8, EINA_FALSE);
|
||||
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
|
@ -178,7 +178,7 @@ _image_draw_cpu_rgba2alpha(void *data EINA_UNUSED, void *context EINA_UNUSED,
|
|||
RGBA_Image *src = image;
|
||||
RGBA_Image *dst = surface;
|
||||
DATA32* srcdata = src->image.data;
|
||||
DATA8* dstdata = dst->mask.data;
|
||||
DATA8* dstdata = dst->image.data8;
|
||||
int x, y, sw, dw;
|
||||
#if RGBA2ALPHA_WEIGHTED
|
||||
const int WR = 299;
|
||||
|
|
|
@ -313,11 +313,11 @@ _box_blur_horiz_apply_alpha(Evas_Filter_Command *cmd)
|
|||
in = cmd->input->backing;
|
||||
out = cmd->output->backing;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(out->cache_entry.w >= (2*r + 1), EINA_FALSE);
|
||||
|
||||
_box_blur_horiz_alpha(in->mask.data, out->mask.data, r,
|
||||
_box_blur_horiz_alpha(in->image.data8, out->image.data8, r,
|
||||
in->cache_entry.w, in->cache_entry.h);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -337,11 +337,11 @@ _box_blur_vert_apply_alpha(Evas_Filter_Command *cmd)
|
|||
in = cmd->input->backing;
|
||||
out = cmd->output->backing;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(out->cache_entry.h >= (2*r + 1), EINA_FALSE);
|
||||
|
||||
_box_blur_vert_alpha(in->mask.data, out->mask.data, r,
|
||||
_box_blur_vert_alpha(in->image.data8, out->image.data8, r,
|
||||
in->cache_entry.w, in->cache_entry.h);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -661,11 +661,11 @@ _gaussian_blur_horiz_apply_alpha(Evas_Filter_Command *cmd)
|
|||
in = cmd->input->backing;
|
||||
out = cmd->output->backing;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(out->cache_entry.w >= (2*r + 1), EINA_FALSE);
|
||||
|
||||
_gaussian_blur_horiz_alpha(in->mask.data, out->mask.data, r,
|
||||
_gaussian_blur_horiz_alpha(in->image.data8, out->image.data8, r,
|
||||
in->cache_entry.w, in->cache_entry.h);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
@ -685,11 +685,11 @@ _gaussian_blur_vert_apply_alpha(Evas_Filter_Command *cmd)
|
|||
in = cmd->input->backing;
|
||||
out = cmd->output->backing;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->mask.data, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out->image.data8, EINA_FALSE);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(out->cache_entry.h >= (2*r + 1), EINA_FALSE);
|
||||
|
||||
_gaussian_blur_vert_alpha(in->mask.data, out->mask.data, r,
|
||||
_gaussian_blur_vert_alpha(in->image.data8, out->image.data8, r,
|
||||
in->cache_entry.w, in->cache_entry.h);
|
||||
|
||||
return EINA_TRUE;
|
||||
|
|
|
@ -118,9 +118,9 @@ _bump_map_cpu_alpha_alpha(Evas_Filter_Command *cmd)
|
|||
h = cmd->input->h;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(w > 2 && h > 2, EINA_FALSE);
|
||||
|
||||
src = ((RGBA_Image *) cmd->input->backing)->mask.data;
|
||||
map = ((RGBA_Image *) cmd->mask->backing)->mask.data;
|
||||
dst = ((RGBA_Image *) cmd->output->backing)->mask.data;
|
||||
src = ((RGBA_Image *) cmd->input->backing)->image.data8;
|
||||
map = ((RGBA_Image *) cmd->mask->backing)->image.data8;
|
||||
dst = ((RGBA_Image *) cmd->output->backing)->image.data8;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(map, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
|
||||
|
@ -255,8 +255,8 @@ _bump_map_cpu_alpha_rgba(Evas_Filter_Command *cmd)
|
|||
h = cmd->input->h;
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(w > 2 && h > 2, EINA_FALSE);
|
||||
|
||||
src = ((RGBA_Image *) cmd->input->backing)->mask.data;
|
||||
map = ((RGBA_Image *) cmd->mask->backing)->mask.data;
|
||||
src = ((RGBA_Image *) cmd->input->backing)->image.data8;
|
||||
map = ((RGBA_Image *) cmd->mask->backing)->image.data8;
|
||||
dst = ((RGBA_Image *) cmd->output->backing)->image.data;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(map, EINA_FALSE);
|
||||
|
|
|
@ -97,8 +97,8 @@ _filter_curve_cpu_alpha(Evas_Filter_Command *cmd)
|
|||
out = cmd->output->backing;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(in, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(out, EINA_FALSE);
|
||||
src = in->mask.data;
|
||||
dst = out->mask.data;
|
||||
src = in->image.data8;
|
||||
dst = out->image.data8;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
|
||||
curve = cmd->curve.data;
|
||||
|
|
|
@ -206,9 +206,9 @@ _filter_displace_cpu_alpha(Evas_Filter_Command *cmd)
|
|||
EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->mask->backing, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(cmd->output->backing, EINA_FALSE);
|
||||
|
||||
src = ((RGBA_Image *) cmd->input->backing)->mask.data;
|
||||
src = ((RGBA_Image *) cmd->input->backing)->image.data8;
|
||||
map_start = ((RGBA_Image *) cmd->mask->backing)->image.data;
|
||||
dst = ((RGBA_Image *) cmd->output->backing)->mask.data;
|
||||
dst = ((RGBA_Image *) cmd->output->backing)->image.data8;
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(src, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(map_start, EINA_FALSE);
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(dst, EINA_FALSE);
|
||||
|
|
|
@ -79,8 +79,8 @@ _mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd)
|
|||
h = cmd->input->h;
|
||||
mw = cmd->mask->w;
|
||||
mh = cmd->mask->h;
|
||||
src = in->mask.data;
|
||||
dst = out->mask.data;
|
||||
src = in->image.data8;
|
||||
dst = out->image.data8;
|
||||
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL((w > 0) && (mw > 0), EINA_FALSE);
|
||||
|
||||
|
@ -106,7 +106,7 @@ _mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd)
|
|||
mask = fb->backing;
|
||||
}
|
||||
|
||||
msk = mask->mask.data;
|
||||
msk = mask->image.data8;
|
||||
|
||||
// First pass: copy to dest
|
||||
if (src != dst)
|
||||
|
@ -119,7 +119,7 @@ _mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd)
|
|||
if (my >= mh)
|
||||
{
|
||||
my = 0;
|
||||
msk = mask->mask.data;
|
||||
msk = mask->image.data8;
|
||||
}
|
||||
|
||||
for (step = 0; step < stepcount; step++, dst += stepsize)
|
||||
|
@ -189,7 +189,7 @@ _mask_cpu_alpha_rgba_rgba(Evas_Filter_Command *cmd)
|
|||
h = cmd->input->h;
|
||||
mw = cmd->mask->w;
|
||||
mh = cmd->mask->h;
|
||||
src = in->mask.data;
|
||||
src = in->image.data8;
|
||||
dst = out->image.data;
|
||||
|
||||
// Stretch if necessary.
|
||||
|
@ -286,7 +286,7 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
|
|||
h = cmd->input->h;
|
||||
mw = cmd->mask->w;
|
||||
mh = cmd->mask->h;
|
||||
src = in->mask.data;
|
||||
src = in->image.data8;
|
||||
dst = out->image.data;
|
||||
color = ARGB_JOIN(cmd->draw.A, cmd->draw.R, cmd->draw.G, cmd->draw.B);
|
||||
|
||||
|
@ -311,7 +311,7 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
|
|||
mask = fb->backing;
|
||||
}
|
||||
|
||||
msk = mask->mask.data;
|
||||
msk = mask->image.data8;
|
||||
stepsize = MIN(mw, w);
|
||||
stepcount = w / stepsize;
|
||||
span = malloc(stepsize * sizeof(DATA8));
|
||||
|
@ -324,7 +324,7 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
|
|||
if (my >= mh)
|
||||
{
|
||||
my = 0;
|
||||
msk = mask->mask.data;
|
||||
msk = mask->image.data8;
|
||||
}
|
||||
|
||||
for (step = 0; step < stepcount; step++, dst += stepsize, src += stepsize)
|
||||
|
|
|
@ -27,8 +27,8 @@ _vflip_cpu(Evas_Filter_Command *cmd)
|
|||
EINA_SAFETY_ON_FALSE_RETURN_VAL(cmd->output->h == h, EINA_FALSE);
|
||||
EINA_SAFETY_ON_FALSE_RETURN_VAL(cmd->output->alpha_only == cmd->input->alpha_only, EINA_FALSE);
|
||||
|
||||
in = ((RGBA_Image *) cmd->input->backing)->mask.data;
|
||||
out = ((RGBA_Image *) cmd->output->backing)->mask.data;
|
||||
in = ((RGBA_Image *) cmd->input->backing)->image.data8;
|
||||
out = ((RGBA_Image *) cmd->output->backing)->image.data8;
|
||||
datasize = cmd->input->alpha_only ? sizeof(DATA8) : sizeof(DATA32);
|
||||
stride = w * datasize;
|
||||
|
||||
|
|
|
@ -801,21 +801,15 @@ struct _RGBA_Image
|
|||
Eina_Bool dirty : 1;
|
||||
} cs;
|
||||
|
||||
union
|
||||
{
|
||||
/* RGBA stuff */
|
||||
struct {
|
||||
DATA32 *data;
|
||||
union {
|
||||
DATA32 *data; /* Normal image */
|
||||
DATA8 *data8; /* Alpha Mask stuff */
|
||||
};
|
||||
Eina_Bool no_free : 1;
|
||||
} image;
|
||||
|
||||
/* Alpha Mask stuff */
|
||||
struct {
|
||||
DATA8 *data;
|
||||
Eina_Bool no_free : 1;
|
||||
} mask;
|
||||
};
|
||||
|
||||
struct {
|
||||
SLK(lock);
|
||||
Eina_List *list;
|
||||
|
|
Loading…
Reference in New Issue