Evas masking: Check fill properties to consider image as filled

Edje may not set the filled flag on an image even if its fill
properties make it fill the whole object. For masking, it can
then be considered as a filled image.
This commit is contained in:
Jean-Philippe Andre 2015-02-27 15:57:36 +09:00
parent 87aed21c05
commit ab89dc401c
3 changed files with 36 additions and 20 deletions

View File

@ -1824,24 +1824,39 @@ evas_render_mask_subrender(Evas_Public_Data *evas,
EINA_COW_WRITE_BEGIN(evas_object_mask_cow, mask->mask, Evas_Object_Mask_Data, mdata)
mdata->redraw = EINA_FALSE;
if (is_image && !prev_mask && mask->func->engine_data_get &&
ENFN->image_scaled_update && evas_object_image_filled_get(mask->object))
if (is_image)
{
/* Fast path (for GL) that avoids creating a map surface, render the
* scaled image in it, when the shaders can just scale on the fly. */
Eina_Bool smooth = evas_object_image_smooth_scale_get(mask->object);
void *original = mask->func->engine_data_get(mask->object);
void *scaled = ENFN->image_scaled_update
(ENDT, mdata->surface, original, w, h, smooth, EINA_TRUE, EVAS_COLORSPACE_GRY8);
if (scaled)
Eina_Bool filled = EINA_FALSE;
if (evas_object_image_filled_get(mask->object))
filled = EINA_TRUE;
else
{
done = EINA_TRUE;
if (mdata->surface && (mdata->surface != scaled))
ENFN->image_map_surface_free(ENDT, mdata->surface);
mdata->surface = scaled;
mdata->w = w;
mdata->h = h;
mdata->is_alpha = (ENFN->image_colorspace_get(ENDT, scaled) == EVAS_COLORSPACE_GRY8);
int fx, fy, fw, fh;
evas_object_image_fill_get(mask->object, &fx, &fy, &fw, &fh);
if ((fx == 0) && (fy == 0) && (fw == w) && (fh == h))
filled = EINA_TRUE;
}
if (filled & !prev_mask && mask->func->engine_data_get &&
ENFN->image_scaled_update)
{
/* Fast path (for GL) that avoids creating a map surface, render the
* scaled image in it, when the shaders can just scale on the fly. */
Eina_Bool smooth = evas_object_image_smooth_scale_get(mask->object);
void *original = mask->func->engine_data_get(mask->object);
void *scaled = ENFN->image_scaled_update
(ENDT, mdata->surface, original, w, h, smooth, EINA_TRUE, EVAS_COLORSPACE_GRY8);
if (scaled)
{
done = EINA_TRUE;
if (mdata->surface && (mdata->surface != scaled))
ENFN->image_map_surface_free(ENDT, mdata->surface);
mdata->surface = scaled;
mdata->w = w;
mdata->h = h;
mdata->is_alpha = (ENFN->image_colorspace_get(ENDT, scaled) == EVAS_COLORSPACE_GRY8);
}
}
}

View File

@ -3293,7 +3293,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
if (shared->info.anisotropic > 0.0)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic);
#endif
if (gc->pipe[i].array.mask_smooth) // (gc->pipe[i].shader.smooth)
if (gc->pipe[i].array.mask_smooth)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

View File

@ -691,7 +691,10 @@ evas_gl_common_image_free(Evas_GL_Image *im)
if (im->references > 0) return;
if (im->scaled.origin)
evas_gl_common_image_free(im->scaled.origin);
{
evas_gl_common_image_free(im->scaled.origin);
im->scaled.origin = NULL;
}
if (im->native.func.free)
im->native.func.free(im->native.func.data, im);
@ -931,8 +934,6 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
int r, g, b, a;
int c, cx, cy, cw, ch;
dc = gc->dc;
if (dc->mul.use)
{
a = (dc->mul.col >> 24) & 0xff;