2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_common.h"
|
2009-09-21 09:08:51 -07:00
|
|
|
#include "evas_private.h"
|
2008-07-21 09:10:48 -07:00
|
|
|
#include "evas_blend_private.h"
|
2002-11-08 00:02:15 -08:00
|
|
|
|
2011-01-30 02:35:37 -08:00
|
|
|
#include "language/evas_bidi_utils.h" /*defines BIDI_SUPPORT if possible */
|
2010-05-21 00:10:45 -07:00
|
|
|
#include "evas_font_private.h" /* for Frame-Queuing support */
|
2009-04-11 06:11:10 -07:00
|
|
|
|
2011-01-30 02:36:39 -08:00
|
|
|
#include "evas_font_ot.h"
|
|
|
|
|
2012-05-17 19:16:54 -07:00
|
|
|
struct _Evas_Glyph
|
|
|
|
{
|
|
|
|
RGBA_Font_Glyph *fg;
|
|
|
|
void *data;
|
|
|
|
Eina_Rectangle coord;
|
|
|
|
FT_UInt idx;
|
|
|
|
int j;
|
|
|
|
};
|
2010-06-13 22:59:23 -07:00
|
|
|
|
2010-05-21 00:10:45 -07:00
|
|
|
EAPI void
|
|
|
|
evas_common_font_draw_init(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-12-23 03:50:29 -08:00
|
|
|
/*
|
2011-02-01 04:17:52 -08:00
|
|
|
* BiDi handling: We receive the shaped string + other props from text_props,
|
2010-07-28 05:00:41 -07:00
|
|
|
* we need to reorder it so we'll have the visual string (the way we draw)
|
|
|
|
* and then for kerning we have to switch the order of the kerning query (as the prev
|
|
|
|
* is on the right, and not on the left).
|
|
|
|
*/
|
2013-01-11 11:57:09 -08:00
|
|
|
EAPI Eina_Bool
|
2013-01-10 17:52:46 -08:00
|
|
|
evas_common_font_rgba_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
|
|
|
|
Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w,
|
|
|
|
int ext_h, int im_w, int im_h EINA_UNUSED)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
|
|
|
DATA32 *im;
|
2012-12-17 13:27:07 -08:00
|
|
|
Evas_Glyph *glyph;
|
2011-05-02 08:33:38 -07:00
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
if (!glyphs) return EINA_FALSE;
|
|
|
|
if (!glyphs->array) return EINA_FALSE;
|
2011-05-02 02:28:00 -07:00
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
im = dst->image.data;
|
2012-05-17 20:16:22 -07:00
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
EINA_INARRAY_FOREACH(glyphs->array, glyph)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2011-02-01 04:17:52 -08:00
|
|
|
RGBA_Font_Glyph *fg;
|
2011-11-08 23:30:34 -08:00
|
|
|
int chr_x, chr_y;
|
2011-05-26 18:44:10 -07:00
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
fg = glyph->fg;
|
2010-10-07 14:07:53 -07:00
|
|
|
|
2012-07-04 02:39:23 -07:00
|
|
|
/* FIXME: Why was that moved out of prepare ? This increase cache miss. */
|
2012-12-17 13:27:07 -08:00
|
|
|
glyph->coord.w = fg->glyph_out->bitmap.width;
|
|
|
|
glyph->coord.h = fg->glyph_out->bitmap.rows;
|
|
|
|
glyph->j = fg->glyph_out->bitmap.pitch;
|
|
|
|
glyph->data = fg->glyph_out->bitmap.buffer;
|
2012-06-22 13:31:31 -07:00
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
if (dc->font_ext.func.gl_new)
|
|
|
|
{
|
|
|
|
/* extension calls */
|
|
|
|
fg->ext_dat = dc->font_ext.func.gl_new(dc->font_ext.data, fg);
|
|
|
|
fg->ext_dat_free = dc->font_ext.func.gl_free;
|
|
|
|
}
|
2011-01-30 02:33:24 -08:00
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
chr_x = x + glyph->coord.x;
|
|
|
|
chr_y = y + glyph->coord.y;
|
2010-10-07 14:07:53 -07:00
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
if (chr_x < (ext_x + ext_w))
|
|
|
|
{
|
|
|
|
DATA8 *data;
|
|
|
|
int i, j, w, h;
|
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
data = glyph->data;
|
|
|
|
j = glyph->j;
|
|
|
|
w = glyph->coord.w;
|
2011-02-01 04:17:52 -08:00
|
|
|
if (j < w) j = w;
|
2012-12-17 13:27:07 -08:00
|
|
|
h = glyph->coord.h;
|
2011-12-23 03:50:29 -08:00
|
|
|
|
|
|
|
#ifdef HAVE_PIXMAN
|
|
|
|
# ifdef PIXMAN_FONT
|
|
|
|
int index;
|
|
|
|
DATA32 *font_alpha_buffer;
|
|
|
|
pixman_image_t *font_mask_image;
|
|
|
|
|
|
|
|
font_alpha_buffer = alloca(w * h * sizeof(DATA32));
|
|
|
|
for (index = 0; index < (w * h); index++)
|
|
|
|
font_alpha_buffer[index] = data[index] << 24;
|
|
|
|
|
|
|
|
font_mask_image = pixman_image_create_bits(PIXMAN_a8r8g8b8, w, h,
|
|
|
|
font_alpha_buffer,
|
|
|
|
w * sizeof(DATA32));
|
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
if (!font_mask_image) return EINA_FALSE;
|
2011-12-23 03:50:29 -08:00
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2010-10-07 14:07:53 -07:00
|
|
|
{
|
2011-02-01 04:17:52 -08:00
|
|
|
if ((j > 0) && (chr_x + w > ext_x))
|
2010-10-07 14:07:53 -07:00
|
|
|
{
|
2011-02-01 04:17:52 -08:00
|
|
|
if ((fg->ext_dat) && (dc->font_ext.func.gl_draw))
|
2011-01-30 05:55:04 -08:00
|
|
|
{
|
2011-02-01 04:17:52 -08:00
|
|
|
/* ext glyph draw */
|
|
|
|
dc->font_ext.func.gl_draw(dc->font_ext.data,
|
2011-12-23 03:50:29 -08:00
|
|
|
(void *)dst,
|
|
|
|
dc, fg, chr_x,
|
|
|
|
y - (chr_y - y));
|
2011-02-01 04:17:52 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((fg->glyph_out->bitmap.num_grays == 256) &&
|
2011-12-23 03:50:29 -08:00
|
|
|
(fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY))
|
2011-01-30 02:36:39 -08:00
|
|
|
{
|
2011-12-23 03:50:29 -08:00
|
|
|
#ifdef HAVE_PIXMAN
|
|
|
|
# ifdef PIXMAN_FONT
|
|
|
|
if ((dst->pixman.im) &&
|
|
|
|
(dc->col.pixman_color_image))
|
|
|
|
pixman_image_composite(PIXMAN_OP_OVER,
|
|
|
|
dc->col.pixman_color_image,
|
|
|
|
font_mask_image,
|
|
|
|
dst->pixman.im,
|
|
|
|
chr_x,
|
|
|
|
y - (chr_y - y),
|
|
|
|
0, 0,
|
|
|
|
chr_x,
|
|
|
|
y - (chr_y - y),
|
|
|
|
w, h);
|
|
|
|
else
|
|
|
|
# endif
|
|
|
|
#endif
|
2010-10-07 14:07:53 -07:00
|
|
|
{
|
2011-12-23 03:50:29 -08:00
|
|
|
for (i = 0; i < h; i++)
|
|
|
|
{
|
|
|
|
int dx, dy;
|
|
|
|
int in_x, in_w;
|
|
|
|
|
|
|
|
in_x = 0;
|
|
|
|
in_w = 0;
|
|
|
|
dx = chr_x;
|
|
|
|
dy = y - (chr_y - i - y);
|
2012-04-26 01:41:39 -07:00
|
|
|
|
|
|
|
if ((dx < (ext_x + ext_w)) &&
|
|
|
|
(dy >= (ext_y)) &&
|
|
|
|
(dy < (ext_y + ext_h)))
|
|
|
|
{
|
|
|
|
if (dx + w > (ext_x + ext_w))
|
|
|
|
in_w += (dx + w) - (ext_x + ext_w);
|
|
|
|
if (dx < ext_x)
|
|
|
|
{
|
|
|
|
in_w += ext_x - dx;
|
|
|
|
in_x = ext_x - dx;
|
|
|
|
dx = ext_x;
|
|
|
|
}
|
|
|
|
if (in_w < w)
|
|
|
|
{
|
|
|
|
func(NULL, data + (i * j) + in_x, dc->col.col,
|
|
|
|
im + (dy * im_w) + dx, w - in_w);
|
|
|
|
}
|
|
|
|
}
|
2010-10-07 14:07:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-02-01 04:17:52 -08:00
|
|
|
DATA8 *tmpbuf = NULL, *dp, *tp, bits;
|
|
|
|
int bi, bj;
|
|
|
|
const DATA8 bitrepl[2] = {0x0, 0xff};
|
|
|
|
|
|
|
|
tmpbuf = alloca(w);
|
|
|
|
for (i = 0; i < h; i++)
|
2010-10-07 14:07:53 -07:00
|
|
|
{
|
2011-02-01 04:17:52 -08:00
|
|
|
int dx, dy;
|
|
|
|
int in_x, in_w, end;
|
2011-12-23 03:50:29 -08:00
|
|
|
|
2011-02-01 04:17:52 -08:00
|
|
|
in_x = 0;
|
|
|
|
in_w = 0;
|
|
|
|
dx = chr_x;
|
|
|
|
dy = y - (chr_y - i - y);
|
2012-04-26 01:41:39 -07:00
|
|
|
|
|
|
|
tp = tmpbuf;
|
|
|
|
dp = data + (i * fg->glyph_out->bitmap.pitch);
|
|
|
|
for (bi = 0; bi < w; bi += 8)
|
|
|
|
{
|
|
|
|
bits = *dp;
|
|
|
|
if ((w - bi) < 8) end = w - bi;
|
|
|
|
else end = 8;
|
|
|
|
for (bj = 0; bj < end; bj++)
|
|
|
|
{
|
|
|
|
*tp = bitrepl[(bits >> (7 - bj)) & 0x1];
|
|
|
|
tp++;
|
|
|
|
}
|
|
|
|
dp++;
|
|
|
|
}
|
|
|
|
if ((dx < (ext_x + ext_w)) &&
|
|
|
|
(dy >= (ext_y)) &&
|
|
|
|
(dy < (ext_y + ext_h)))
|
|
|
|
{
|
|
|
|
if (dx + w > (ext_x + ext_w))
|
|
|
|
in_w += (dx + w) - (ext_x + ext_w);
|
|
|
|
if (dx < ext_x)
|
|
|
|
{
|
|
|
|
in_w += ext_x - dx;
|
|
|
|
in_x = ext_x - dx;
|
|
|
|
dx = ext_x;
|
|
|
|
}
|
|
|
|
if (in_w < w)
|
|
|
|
{
|
|
|
|
func(NULL, tmpbuf + in_x, dc->col.col,
|
|
|
|
im + (dy * im_w) + dx, w - in_w);
|
|
|
|
}
|
2010-10-07 14:07:53 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-12-23 03:50:29 -08:00
|
|
|
#ifdef HAVE_PIXMAN
|
|
|
|
# ifdef PIXMAN_FONT
|
|
|
|
pixman_image_unref(font_mask_image);
|
|
|
|
# endif
|
|
|
|
#endif
|
2010-10-07 14:07:53 -07:00
|
|
|
}
|
2011-02-01 04:17:52 -08:00
|
|
|
else
|
|
|
|
break;
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2013-01-11 11:57:09 -08:00
|
|
|
|
|
|
|
return EINA_TRUE;
|
2009-02-20 19:13:49 -08:00
|
|
|
}
|
|
|
|
|
2012-12-17 13:27:07 -08:00
|
|
|
void
|
|
|
|
evas_common_font_glyphs_ref(Evas_Glyph_Array *array)
|
|
|
|
{
|
|
|
|
array->refcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_common_font_glyphs_unref(Evas_Glyph_Array *array)
|
|
|
|
{
|
2013-01-11 11:48:28 -08:00
|
|
|
if (--array->refcount) return;
|
2012-12-17 13:27:07 -08:00
|
|
|
|
|
|
|
eina_inarray_free(array->array);
|
2013-06-14 03:55:53 -07:00
|
|
|
evas_common_font_int_unref(array->fi);
|
2012-12-17 13:27:07 -08:00
|
|
|
free(array);
|
|
|
|
}
|
|
|
|
|
2013-01-15 09:35:11 -08:00
|
|
|
void
|
|
|
|
evas_common_font_fonts_ref(Evas_Font_Array *array)
|
|
|
|
{
|
|
|
|
array->refcount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_common_font_fonts_unref(Evas_Font_Array *array)
|
|
|
|
{
|
|
|
|
if (--array->refcount) return;
|
|
|
|
|
|
|
|
eina_inarray_free(array->array);
|
|
|
|
free(array);
|
|
|
|
}
|
|
|
|
|
2012-04-26 01:18:51 -07:00
|
|
|
EAPI void
|
2012-05-10 18:50:40 -07:00
|
|
|
evas_common_font_draw_prepare(Evas_Text_Props *text_props)
|
2012-04-26 01:18:51 -07:00
|
|
|
{
|
|
|
|
RGBA_Font_Int *fi;
|
2012-06-22 13:31:31 -07:00
|
|
|
RGBA_Font_Glyph *fg;
|
2012-12-17 13:27:07 -08:00
|
|
|
Eina_Inarray *glyphs;
|
2012-12-23 03:02:50 -08:00
|
|
|
size_t unit = 32;
|
2013-01-11 11:49:15 -08:00
|
|
|
Eina_Bool reused_glyphs;
|
2012-04-26 01:18:51 -07:00
|
|
|
EVAS_FONT_WALK_TEXT_INIT();
|
|
|
|
|
|
|
|
fi = text_props->font_instance;
|
|
|
|
if (!fi) return;
|
|
|
|
|
2012-07-04 02:39:23 -07:00
|
|
|
if (!text_props->changed && text_props->generation == fi->generation && text_props->glyphs)
|
2012-12-17 13:27:07 -08:00
|
|
|
return;
|
2012-05-17 19:16:54 -07:00
|
|
|
|
2012-12-23 03:02:50 -08:00
|
|
|
if (text_props->len < unit) unit = text_props->len;
|
2013-01-11 11:49:15 -08:00
|
|
|
if (text_props->glyphs && text_props->glyphs->refcount == 1)
|
|
|
|
{
|
|
|
|
glyphs = text_props->glyphs->array;
|
|
|
|
glyphs->len = 0;
|
|
|
|
reused_glyphs = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glyphs = eina_inarray_new(sizeof(Evas_Glyph), unit);
|
|
|
|
reused_glyphs = EINA_FALSE;
|
|
|
|
}
|
2012-04-26 01:18:51 -07:00
|
|
|
evas_common_font_int_reload(fi);
|
|
|
|
|
2012-05-30 01:29:29 -07:00
|
|
|
if (fi->src->current_size != fi->size)
|
2012-04-26 01:18:51 -07:00
|
|
|
{
|
2012-05-17 19:16:54 -07:00
|
|
|
evas_common_font_source_reload(fi->src);
|
2012-04-26 01:18:51 -07:00
|
|
|
FTLOCK();
|
|
|
|
FT_Activate_Size(fi->ft.size);
|
|
|
|
FTUNLOCK();
|
|
|
|
fi->src->current_size = fi->size;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVAS_FONT_WALK_TEXT_START()
|
|
|
|
{
|
2013-01-15 22:31:32 -08:00
|
|
|
Evas_Glyph *glyph;
|
2012-05-17 19:16:54 -07:00
|
|
|
FT_UInt idx;
|
2012-04-26 01:18:51 -07:00
|
|
|
|
|
|
|
if (!EVAS_FONT_WALK_IS_VISIBLE) continue;
|
|
|
|
idx = EVAS_FONT_WALK_INDEX;
|
|
|
|
|
|
|
|
fg = evas_common_font_int_cache_glyph_get(fi, idx);
|
2012-05-15 14:15:08 -07:00
|
|
|
if (!fg) continue;
|
|
|
|
if (!fg->glyph_out) evas_common_font_int_cache_glyph_render(fg);
|
2013-01-15 22:31:32 -08:00
|
|
|
|
|
|
|
glyph = eina_inarray_grow(glyphs, 1);
|
|
|
|
if (!glyph) goto error;
|
|
|
|
|
|
|
|
glyph->fg = fg;
|
|
|
|
glyph->idx = idx;
|
|
|
|
glyph->coord.x = EVAS_FONT_WALK_PEN_X + EVAS_FONT_WALK_X_OFF + EVAS_FONT_WALK_X_BEAR;
|
|
|
|
glyph->coord.y = EVAS_FONT_WALK_PEN_Y + EVAS_FONT_WALK_Y_OFF + EVAS_FONT_WALK_Y_BEAR;
|
2012-04-26 01:18:51 -07:00
|
|
|
}
|
|
|
|
EVAS_FONT_WALK_TEXT_END();
|
2012-05-10 18:50:40 -07:00
|
|
|
|
2013-01-11 11:49:15 -08:00
|
|
|
if (!reused_glyphs)
|
|
|
|
{
|
2013-01-11 11:56:49 -08:00
|
|
|
if (text_props->glyphs) evas_common_font_glyphs_unref(text_props->glyphs);
|
2013-01-11 11:49:15 -08:00
|
|
|
|
|
|
|
text_props->glyphs = malloc(sizeof(*text_props->glyphs));
|
|
|
|
if (!text_props->glyphs) goto error;
|
|
|
|
text_props->glyphs->refcount = 1;
|
|
|
|
text_props->glyphs->array = glyphs;
|
2013-06-14 03:55:53 -07:00
|
|
|
text_props->glyphs->fi = fi;
|
|
|
|
fi->references++;
|
2013-01-11 11:49:15 -08:00
|
|
|
}
|
2012-12-17 13:27:07 -08:00
|
|
|
|
2012-06-22 13:31:31 -07:00
|
|
|
/* check if there's a request queue in fi, if so ask cserve2 to render
|
|
|
|
* those glyphs
|
|
|
|
*/
|
|
|
|
|
2012-05-10 18:50:40 -07:00
|
|
|
text_props->generation = fi->generation;
|
2013-01-17 02:28:18 -08:00
|
|
|
text_props->changed = EINA_FALSE;
|
2012-12-17 13:27:07 -08:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
error:
|
|
|
|
eina_inarray_free(glyphs);
|
2012-04-26 01:18:51 -07:00
|
|
|
}
|
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
EAPI Eina_Bool
|
2012-12-17 13:27:07 -08:00
|
|
|
evas_common_font_draw_cb(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, Evas_Common_Font_Draw_Cb cb)
|
2009-02-20 19:13:49 -08:00
|
|
|
{
|
2012-07-04 02:39:23 -07:00
|
|
|
static Cutout_Rects *rects = NULL;
|
2009-02-20 19:13:49 -08:00
|
|
|
int ext_x, ext_y, ext_w, ext_h;
|
|
|
|
int im_w, im_h;
|
2009-04-23 21:35:52 -07:00
|
|
|
RGBA_Gfx_Func func;
|
2009-02-20 19:13:49 -08:00
|
|
|
Cutout_Rect *r;
|
2010-10-07 14:07:53 -07:00
|
|
|
int c, cx, cy, cw, ch;
|
|
|
|
int i;
|
2009-04-23 21:35:52 -07:00
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
if (!glyphs) return EINA_FALSE;
|
2013-01-11 11:56:32 -08:00
|
|
|
|
2009-02-20 19:13:49 -08:00
|
|
|
im_w = dst->cache_entry.w;
|
|
|
|
im_h = dst->cache_entry.h;
|
|
|
|
|
2010-02-03 03:18:00 -08:00
|
|
|
// evas_common_font_size_use(fn);
|
2009-02-20 19:13:49 -08:00
|
|
|
func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst, 1, dc->render_op);
|
|
|
|
|
|
|
|
if (!dc->cutout.rects)
|
|
|
|
{
|
2013-01-10 21:21:54 -08:00
|
|
|
ext_x = 0; ext_y = 0; ext_w = im_w; ext_h = im_h;
|
|
|
|
if (dc->clip.use)
|
|
|
|
{
|
|
|
|
ext_x = dc->clip.x;
|
|
|
|
ext_y = dc->clip.y;
|
|
|
|
ext_w = dc->clip.w;
|
|
|
|
ext_h = dc->clip.h;
|
|
|
|
if (ext_x < 0)
|
|
|
|
{
|
|
|
|
ext_w += ext_x;
|
|
|
|
ext_x = 0;
|
|
|
|
}
|
|
|
|
if (ext_y < 0)
|
|
|
|
{
|
|
|
|
ext_h += ext_y;
|
|
|
|
ext_y = 0;
|
|
|
|
}
|
|
|
|
if ((ext_x + ext_w) > im_w)
|
|
|
|
ext_w = im_w - ext_x;
|
|
|
|
if ((ext_y + ext_h) > im_h)
|
|
|
|
ext_h = im_h - ext_y;
|
|
|
|
}
|
2013-01-11 11:57:09 -08:00
|
|
|
if (ext_w <= 0) return EINA_FALSE;
|
|
|
|
if (ext_h <= 0) return EINA_FALSE;
|
2013-01-10 21:21:54 -08:00
|
|
|
|
2013-01-11 11:57:09 -08:00
|
|
|
return cb(dst, dc, x, y, glyphs,
|
|
|
|
func, ext_x, ext_y, ext_w, ext_h,
|
|
|
|
im_w, im_h);
|
2009-02-20 19:13:49 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-01-11 11:57:09 -08:00
|
|
|
Eina_Bool ret = EINA_FALSE;
|
2009-02-22 23:20:21 -08:00
|
|
|
c = dc->clip.use; cx = dc->clip.x; cy = dc->clip.y; cw = dc->clip.w; ch = dc->clip.h;
|
2009-02-20 19:13:49 -08:00
|
|
|
evas_common_draw_context_clip_clip(dc, 0, 0, dst->cache_entry.w, dst->cache_entry.h);
|
|
|
|
/* our clip is 0 size.. abort */
|
|
|
|
if ((dc->clip.w > 0) && (dc->clip.h > 0))
|
|
|
|
{
|
2012-07-04 02:39:23 -07:00
|
|
|
rects = evas_common_draw_context_apply_cutouts(dc, rects);
|
2009-02-20 19:13:49 -08:00
|
|
|
for (i = 0; i < rects->active; ++i)
|
|
|
|
{
|
|
|
|
r = rects->rects + i;
|
|
|
|
evas_common_draw_context_set_clip(dc, r->x, r->y, r->w, r->h);
|
2013-01-11 11:57:09 -08:00
|
|
|
ret |= cb(dst, dc, x, y, glyphs,
|
|
|
|
func, r->x, r->y, r->w, r->h,
|
|
|
|
im_w, im_h);
|
2009-02-20 19:13:49 -08:00
|
|
|
}
|
|
|
|
}
|
2009-02-22 23:20:21 -08:00
|
|
|
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
|
2013-01-11 11:57:09 -08:00
|
|
|
|
|
|
|
return ret;
|
2009-02-20 19:13:49 -08:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
2012-07-04 02:39:23 -07:00
|
|
|
|
2012-11-29 12:47:12 -08:00
|
|
|
EAPI void
|
2012-12-17 13:27:07 -08:00
|
|
|
evas_common_font_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs)
|
2012-11-29 12:47:12 -08:00
|
|
|
{
|
2012-12-17 13:27:07 -08:00
|
|
|
evas_common_font_draw_cb(dst, dc, x, y, glyphs,
|
2013-01-10 17:52:46 -08:00
|
|
|
evas_common_font_rgba_draw);
|
2012-11-29 12:47:12 -08:00
|
|
|
}
|
|
|
|
|
2012-07-04 02:39:23 -07:00
|
|
|
EAPI void
|
|
|
|
evas_common_font_draw_do(const Cutout_Rects *reuse, const Eina_Rectangle *clip, RGBA_Gfx_Func func,
|
|
|
|
RGBA_Image *dst, RGBA_Draw_Context *dc,
|
|
|
|
int x, int y, const Evas_Text_Props *text_props)
|
|
|
|
{
|
|
|
|
Eina_Rectangle area;
|
|
|
|
Cutout_Rect *r;
|
|
|
|
int i;
|
|
|
|
int im_w, im_h;
|
|
|
|
|
|
|
|
im_w = dst->cache_entry.w;
|
|
|
|
im_h = dst->cache_entry.h;
|
|
|
|
|
|
|
|
if (!reuse)
|
|
|
|
{
|
2012-07-04 20:11:47 -07:00
|
|
|
evas_common_draw_context_clip_clip(dc,
|
|
|
|
clip->x, clip->y,
|
|
|
|
clip->w, clip->h);
|
2013-01-10 17:52:46 -08:00
|
|
|
evas_common_font_rgba_draw(dst, dc, x, y, text_props->glyphs,
|
|
|
|
func,
|
|
|
|
dc->clip.x, dc->clip.y,
|
|
|
|
dc->clip.w, dc->clip.h,
|
|
|
|
im_w, im_h);
|
2012-07-04 02:39:23 -07:00
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < reuse->active; ++i)
|
|
|
|
{
|
|
|
|
r = reuse->rects + i;
|
|
|
|
|
2012-07-04 20:11:47 -07:00
|
|
|
EINA_RECTANGLE_SET(&area, r->x, r->y, r->w - 1, r->h - 1);
|
2012-07-04 02:39:23 -07:00
|
|
|
if (!eina_rectangle_intersection(&area, clip)) continue ;
|
|
|
|
evas_common_draw_context_set_clip(dc, area.x, area.y, area.w, area.h);
|
2013-01-10 17:52:46 -08:00
|
|
|
evas_common_font_rgba_draw(dst, dc, x, y, text_props->glyphs,
|
|
|
|
func, area.x, area.y, area.w, area.h,
|
|
|
|
im_w, im_h);
|
2012-07-04 02:39:23 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
evas_common_font_draw_prepare_cutout(Cutout_Rects *reuse, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Gfx_Func *func)
|
|
|
|
{
|
|
|
|
int im_w, im_h;
|
|
|
|
|
|
|
|
im_w = dst->cache_entry.w;
|
|
|
|
im_h = dst->cache_entry.h;
|
|
|
|
|
|
|
|
*func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst, 1, dc->render_op);
|
|
|
|
|
2012-07-04 20:11:47 -07:00
|
|
|
evas_common_draw_context_clip_clip(dc, 0, 0, im_w, im_h);
|
|
|
|
if (dc->clip.w <= 0) return EINA_FALSE;
|
|
|
|
if (dc->clip.h <= 0) return EINA_FALSE;
|
2012-07-04 02:39:23 -07:00
|
|
|
|
|
|
|
if (dc->cutout.rects)
|
|
|
|
{
|
2012-07-04 20:11:47 -07:00
|
|
|
reuse = evas_common_draw_context_apply_cutouts(dc, reuse);
|
2012-07-04 02:39:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|