Evas filters: Default mask fillmode should be repeat

Fillmode "NONE" has basically no practical use and shouldn't be
the default.
This commit is contained in:
Jean-Philippe Andre 2014-03-25 15:19:21 +09:00
parent 7e731ea10a
commit 27d97110cc
2 changed files with 20 additions and 3 deletions

View File

@ -350,6 +350,7 @@ static Eina_Bool
_mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
{
Evas_Filter_Command fake_cmd;
Evas_Filter_Fill_Mode fillmode;
Evas_Filter_Apply_Func blend;
Evas_Filter_Buffer *fb;
Eina_Bool ret;
@ -373,11 +374,25 @@ _mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE);
fb->locked = EINA_TRUE;
// Repeat mask if unspecified - NONE is not possible
fillmode = cmd->draw.fillmode;
if ((fillmode & (EVAS_FILTER_FILL_MODE_REPEAT_X | EVAS_FILTER_FILL_MODE_STRETCH_X)) == 0)
{
DBG("X fillmode not specified: defaults to repeat");
fillmode |= EVAS_FILTER_FILL_MODE_REPEAT_X;
}
if ((fillmode & (EVAS_FILTER_FILL_MODE_REPEAT_Y | EVAS_FILTER_FILL_MODE_STRETCH_Y)) == 0)
{
DBG("Y fillmode not specified: defaults to repeat");
fillmode |= EVAS_FILTER_FILL_MODE_REPEAT_Y;
}
// Mask --> Temp
fake_cmd.input = cmd->mask;
fake_cmd.mask = NULL;
fake_cmd.output = fb;
fake_cmd.draw.render_op = EVAS_RENDER_MUL;
fake_cmd.draw.fillmode = fillmode;
blend = evas_filter_blend_cpu_func_get(&fake_cmd);
EINA_SAFETY_ON_NULL_RETURN_VAL(blend, EINA_FALSE);
ret = blend(&fake_cmd);
@ -387,6 +402,7 @@ _mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
fake_cmd.draw.render_op = EVAS_RENDER_BLEND;
fake_cmd.input = fb;
fake_cmd.output = cmd->output;
fake_cmd.draw.fillmode = EVAS_FILTER_FILL_MODE_NONE;
blend = evas_filter_blend_cpu_func_get(&fake_cmd);
EINA_SAFETY_ON_NULL_RETURN_VAL(blend, EINA_FALSE);
ret = blend(&fake_cmd);

View File

@ -1520,7 +1520,7 @@ _grow_instruction_prepare(Evas_Filter_Instruction *instr)
Blend two input buffers into a third (target).
@code
mask (mask, src = input, dst = output, color = white, fillmode = none);
mask (mask, src = input, dst = output, color = white, fillmode = repeat);
@endcode
@param mask A mask or texture to blend with the input @a src into the target @a dst.
@ -1528,7 +1528,8 @@ _grow_instruction_prepare(Evas_Filter_Instruction *instr)
@param dst Destination buffer for blending. This must be of same size and colorspace as @a src.
@param color A color to use for alpha to RGBA conversion for the blend operations. White means no change.
See @ref evasfilters_color "colors". This will have no effect on RGBA sources.
@param fillmode Defines whether to stretch or repeat the @a mask if its size that of @src. Should be set when masking with external textures. Default is none. See @ref evasfilter_fillmode "fillmodes".
@param fillmode Defines whether to stretch or repeat the @a mask if its size that of @src.
Should be set when masking with external textures. Default is repeat. See @ref evasfilter_fillmode "fillmodes".
Note that @a src and @a mask are interchangeable, if they have the same dimensions.
@ -1556,7 +1557,7 @@ _mask_instruction_prepare(Evas_Filter_Instruction *instr)
_instruction_param_seq_add(instr, "src", VT_BUFFER, "input");
_instruction_param_seq_add(instr, "dst", VT_BUFFER, "output");
_instruction_param_name_add(instr, "color", VT_COLOR, 0xFFFFFFFF);
_instruction_param_name_add(instr, "fillmode", VT_STRING, "none");
_instruction_param_name_add(instr, "fillmode", VT_STRING, "repeat");
return EINA_TRUE;
}