}
EINA_INLIST_FOREACH(EINA_INLIST_GET(o->items), it)
{
+ ENFN->context_multiplier_set(output, context, 0, 0, 0, 0);
/* Shadows */
if (haveshad)
{
}
/* normal text */
+ ENFN->context_multiplier_unset(output, context);
+ ENFN->context_multiplier_set(output, context,
+ obj->cur->clipper->cur->cache.clip.r,
+ obj->cur->clipper->cur->cache.clip.g,
+ obj->cur->clipper->cur->cache.clip.b,
+ obj->cur->clipper->cur->cache.clip.a);
COLOR_ONLY_SET(obj, cur->cache, clip);
DRAW_TEXT(0, 0);
+ ENFN->context_multiplier_unset(output, context);
}
}
};
/* render object to surface with context, and offxet by x,y */
- obj->layer->evas->engine.func->context_multiplier_unset(output,
- context);
+ ENFN->context_multiplier_unset(output, context);
+ ENFN->context_multiplier_set(output, context, 0, 0, 0, 0);
ENFN->context_render_op_set(output, context, obj->cur->render_op);
/* FIXME: This clipping is just until we fix inset handling correctly. */
ENFN->context_clip_clip(output, context,
evas_common_font_instance_underline_thickness_get(NULL);
int line_position =
evas_common_font_instance_underline_position_get(NULL);
+ ENFN->context_multiplier_unset(output, context);
+ ENFN->context_multiplier_set(output, context,
+ obj->cur->clipper->cur->cache.clip.r,
+ obj->cur->clipper->cur->cache.clip.g,
+ obj->cur->clipper->cur->cache.clip.b,
+ obj->cur->clipper->cur->cache.clip.a);
ITEM_WALK()
{
Evas_Object_Textblock_Text_Item *ti;
line_position, line_thickness);
}
ITEM_WALK_END();
+ ENFN->context_multiplier_unset(output, context);
}
static void
void *data,
void *(*gl_new) (void *data, RGBA_Font_Glyph *fg),
void (*gl_free) (void *ext_dat),
- void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y));
+ void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y),
+ void *(*gl_image_new_from_data) (void *gc, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace),
+ void (*gl_image_free) (void *image),
+ void (*gl_image_draw) (void *gc, void *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth));
EAPI void evas_common_draw_context_clip_clip (RGBA_Draw_Context *dc, int x, int y, int w, int h);
EAPI void evas_common_draw_context_set_clip (RGBA_Draw_Context *dc, int x, int y, int w, int h);
EAPI void evas_common_draw_context_unset_clip (RGBA_Draw_Context *dc);
EAPI void
evas_common_draw_context_font_ext_set(RGBA_Draw_Context *dc,
- void *data,
- void *(*gl_new) (void *data, RGBA_Font_Glyph *fg),
- void (*gl_free) (void *ext_dat),
- void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y))
+ void *data,
+ void *(*gl_new) (void *data, RGBA_Font_Glyph *fg),
+ void (*gl_free) (void *ext_dat),
+ void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y),
+ void *(*gl_image_new_from_data) (void *gc, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace),
+ void (*gl_image_free) (void *image),
+ void (*gl_image_draw) (void *gc, void *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth))
{
dc->font_ext.data = data;
dc->font_ext.func.gl_new = gl_new;
dc->font_ext.func.gl_free = gl_free;
dc->font_ext.func.gl_draw = gl_draw;
+ dc->font_ext.func.gl_image_new_from_data = gl_image_new_from_data;
+ dc->font_ext.func.gl_image_free = gl_image_free;
+ dc->font_ext.func.gl_image_draw = gl_image_draw;
}
EAPI void
{
}
+static void *
+_software_generic_image_new_from_data(int w, int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace)
+{
+#ifdef EVAS_CSERVE2
+ if (evas_cserve2_use_get())
+ {
+ Evas_Cache2 *cache = evas_common_image_cache2_get();
+ return evas_cache2_image_data(cache, w, h, image_data, alpha, cspace);
+ }
+#endif
+ return evas_cache_image_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace);
+}
+
+static void
+_software_generic_image_free(void *image)
+{
+#ifdef EVAS_CSERVE2
+ if (evas_cserve2_use_get() && evas_cache2_image_cached(image))
+ {
+ evas_cache2_image_close(image);
+ return;
+ }
+#endif
+ evas_cache_image_drop(image);
+}
+
+static void
+_software_generic_image_draw(void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
+{
+ RGBA_Image *im;
+
+ if (!image) return;
+ im = image;
+
+#ifdef BUILD_PIPE_RENDER
+ if ((eina_cpu_count() > 1))
+ {
+#ifdef EVAS_CSERVE2
+ if (evas_cserve2_use_get())
+ evas_cache2_image_load_data(&im->cache_entry);
+#endif
+ evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
+ surface, context, smooth,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);
+
+ evas_common_pipe_image_draw(im, surface, context, smooth,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);
+ }
+ else
+#endif
+ {
+ evas_common_rgba_image_scalecache_prepare
+ (&im->cache_entry, surface, context, smooth,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);
+ evas_common_rgba_image_scalecache_do
+ (&im->cache_entry, surface, context, smooth,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);
+
+ evas_common_cpu_end_opt();
+ }
+}
+
/*
* BiDi handling: We receive the shaped string + other props from text_props,
* we need to reorder it so we'll have the visual string (the way we draw)
EINA_INARRAY_FOREACH(glyphs->array, glyph)
{
RGBA_Font_Glyph *fg;
- int chr_x, chr_y, w;
+ int chr_x, chr_y, w, h;
fg = glyph->fg;
+ w = fg->glyph_out->bitmap.width;
+ h = fg->glyph_out->bitmap.rows;
+
if ((!fg->ext_dat) && (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;
}
- w = fg->glyph_out->bitmap.width;
+
+ if ((!fg->ext_dat) && FT_HAS_COLOR(fg->fi->src->ft.face))
+ {
+ if (dc->font_ext.func.gl_image_new_from_data)
+ {
+ /* extension calls */
+ fg->ext_dat = dc->font_ext.func.gl_image_new_from_data(dc->font_ext.data,
+ (unsigned int)w, (unsigned int)h,
+ (DATA32 *)fg->glyph_out->bitmap.buffer,
+ EINA_TRUE,
+ EVAS_COLORSPACE_ARGB8888);
+ fg->ext_dat_free = dc->font_ext.func.gl_image_free;
+ }
+ else
+ {
+ fg->ext_dat = _software_generic_image_new_from_data(w, h,
+ (DATA32 *)fg->glyph_out->bitmap.buffer,
+ EINA_TRUE,
+ EVAS_COLORSPACE_ARGB8888);
+ fg->ext_dat_free = _software_generic_image_free;
+ }
+ }
+
chr_x = x + glyph->x;
chr_y = y + glyph->y;
if (chr_x < (ext_x + ext_w))
{
if ((w > 0) && ((chr_x + w) > ext_x))
{
- if ((fg->ext_dat) && (dc->font_ext.func.gl_draw))
- dc->font_ext.func.gl_draw(dc->font_ext.data, (void *)dst,
- dc, fg, chr_x, y - (chr_y - y));
- else if (fg->glyph_out->rle)
- evas_common_font_glyph_draw(fg, dc, dst, im_w,
- chr_x, y - (chr_y - y),
- ext_x, ext_y, ext_w, ext_h);
+ if (fg->glyph_out->rle)
+ {
+ if ((fg->ext_dat) && (dc->font_ext.func.gl_draw))
+ {
+ dc->font_ext.func.gl_draw(dc->font_ext.data, (void *)dst,
+ dc, fg, chr_x, y - (chr_y - y));
+ }
+ else
+ {
+ evas_common_font_glyph_draw(fg, dc, dst, im_w,
+ chr_x, y - (chr_y - y),
+ ext_x, ext_y, ext_w, ext_h);
+ }
+ }
+ else if ((fg->ext_dat) && FT_HAS_COLOR(fg->fi->src->ft.face))
+ {
+ if (dc->font_ext.func.gl_image_draw)
+ {
+ dc->font_ext.func.gl_image_draw(dc->font_ext.data,
+ fg->ext_dat,
+ 0, 0, w, h,
+ chr_x, y - (chr_y - y), w, h,
+ EINA_TRUE);
+ }
+ else
+ {
+ _software_generic_image_draw(dc, dst,
+ fg->ext_dat,
+ 0, 0, w, h,
+ chr_x, y - (chr_y - y), w, h,
+ EINA_TRUE);
+ }
+ }
}
}
else
int i, maxd = 0x7fffffff;
int chosen_size = 0;
int chosen_size2 = 0;
+ FT_Int strike_index = 0;
for (i = 0; i < fi->src->ft.face->num_fixed_sizes; i++)
{
maxd = cd;
chosen_size = s;
chosen_size2 = fi->src->ft.face->available_sizes[i].y_ppem;
+ strike_index = (FT_Int)i;
if (maxd == 0) break;
}
}
fi->real_size = chosen_size;
FTLOCK();
- error = FT_Set_Pixel_Sizes(fi->src->ft.face, 0, fi->real_size);
+
+ if (FT_HAS_FIXED_SIZES(fi->src->ft.face))
+ error = FT_Select_Size(fi->src->ft.face, strike_index);
+ else
+ error = FT_Set_Pixel_Sizes(fi->src->ft.face, 0, fi->real_size);
+
FTUNLOCK();
if (error)
{
if (fg->glyph_out)
{
+ if ((!fg->glyph_out->rle) && (!fg->glyph_out->bitmap.rle_alloc))
+ {
+ FT_BitmapGlyph fbg = (FT_BitmapGlyph)fg->glyph;
+ FT_Bitmap_Done(evas_ft_lib, &(fbg->bitmap));
+ }
+
if ((fg->glyph_out->rle) && (fg->glyph_out->bitmap.rle_alloc))
free(fg->glyph_out->rle);
fg->glyph_out->rle = NULL;
evas_common_font_int_reload(fi);
FTLOCK();
error = FT_Load_Glyph(fi->src->ft.face, idx,
- FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP |
- hintflags[fi->hinting]);
+ (FT_HAS_COLOR(fi->src->ft.face) ?
+ (FT_LOAD_COLOR | hintflags[fi->hinting]) :
+ (FT_LOAD_DEFAULT | FT_LOAD_NO_BITMAP | hintflags[fi->hinting])));
+
FTUNLOCK();
if (error)
{
fi->usage += size;
if (fi->inuse) evas_common_font_int_use_increase(size);
- fg->glyph_out->rle = evas_common_font_glyph_compress
- (fbg->bitmap.buffer, fbg->bitmap.num_grays, fbg->bitmap.pixel_mode,
- fbg->bitmap.pitch, fbg->bitmap.width, fbg->bitmap.rows,
- &(fg->glyph_out->rle_size));
+ if (!FT_HAS_COLOR(fi->src->ft.face))
+ {
+ fg->glyph_out->rle = evas_common_font_glyph_compress
+ (fbg->bitmap.buffer, fbg->bitmap.num_grays, fbg->bitmap.pixel_mode,
+ fbg->bitmap.pitch, fbg->bitmap.width, fbg->bitmap.rows,
+ &(fg->glyph_out->rle_size));
+ fg->glyph_out->bitmap.rle_alloc = EINA_TRUE;
- fg->glyph_out->bitmap.buffer = NULL;
+ fg->glyph_out->bitmap.buffer = NULL;
- // this may be technically incorrect as we go and free a bitmap buffer
- // behind the ftglyph's back...
- FT_Bitmap_Done(evas_ft_lib, &(fbg->bitmap));
+ // this may be technically incorrect as we go and free a bitmap buffer
+ // behind the ftglyph's back...
+ FT_Bitmap_Done(evas_ft_lib, &(fbg->bitmap));
+ }
+ else
+ {
+ fg->glyph_out->rle = NULL;
+ fg->glyph_out->bitmap.rle_alloc = EINA_FALSE;
+ }
return EINA_TRUE;
}
#include FT_SIZES_H
#include FT_MODULE_H
+#ifndef FT_HAS_COLOR
+# define FT_HAS_COLOR(face) 0
+#endif
+
#ifdef __GNUC__
# if __GNUC__ >= 4
// BROKEN in gcc 4 on amd64
Cutout_Rects cutout;
struct {
struct {
- void *(*gl_new) (void *data, RGBA_Font_Glyph *fg);
- void (*gl_free) (void *ext_dat);
- void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y);
+ void *(*gl_new) (void *data, RGBA_Font_Glyph *fg);
+ void (*gl_free) (void *ext_dat);
+ void (*gl_draw) (void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y);
+ void *(*gl_image_new_from_data) (void *gc, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace);
+ void (*gl_image_free) (void *image);
+ void (*gl_image_draw) (void *gc, void *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
} func;
void *data;
} font_ext;
void *evas_gl_font_texture_new(void *gc, RGBA_Font_Glyph *fg);
void evas_gl_font_texture_free(void *);
void evas_gl_font_texture_draw(void *gc, void *surface, void *dc, RGBA_Font_Glyph *fg, int x, int y);
+void *evas_gl_image_new_from_data(void *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, Evas_Colorspace cspace);
+void evas_gl_image_free(void *im);
+void evas_gl_image_draw(void *gc, void *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth);
Evas_GL_Polygon *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, int y);
Evas_GL_Polygon *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly);
/* restore clip info */
gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch;
}
+
+void *
+evas_gl_image_new_from_data(void *gc, unsigned int w, unsigned int h, DATA32 *data, int alpha, Evas_Colorspace cspace)
+{
+ return (void *)evas_gl_common_image_new_from_data((Evas_Engine_GL_Context *)gc,
+ w, h,
+ data,
+ alpha,
+ cspace);
+}
+
+void
+evas_gl_image_free(void *im)
+{
+ evas_gl_common_image_free((Evas_GL_Image *)im);
+}
+
+void
+evas_gl_image_draw(void *gc, void *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth)
+{
+ evas_gl_common_image_draw((Evas_Engine_GL_Context *)gc,
+ (Evas_GL_Image *)im,
+ sx, sy, sw, sh,
+ dx, dy, dw, dh,
+ smooth);
+}
gl_context,
evas_gl_font_texture_new,
evas_gl_font_texture_free,
- evas_gl_font_texture_draw);
+ evas_gl_font_texture_draw,
+ evas_gl_image_new_from_data,
+ evas_gl_image_free,
+ evas_gl_image_draw);
evas_common_font_draw_prepare(intl_props);
evas_common_font_draw(im, context, x, y, intl_props->glyphs);
evas_common_draw_context_font_ext_set(context,
NULL,
NULL,
NULL,
+ NULL,
+ NULL,
+ NULL,
NULL);
}
void *gl_draw;
void *font_ext_data;
DATA32 col;
+ DATA32 mul_col;
Eina_Rectangle clip_rect, ext;
int im_w, im_h;
void *mask;
dc.font_ext.func.gl_free = font->gl_free;
dc.font_ext.func.gl_draw = font->gl_draw;
dc.col.col = font->col;
+ dc.mul.col = font->mul_col;
+ dc.mul.use = (font->mul_col == 0xffffffff) ? 0 : 1;
dc.clip.use = font->clip_use;
dc.clip.x = font->clip_rect.x;
dc.clip.y = font->clip_rect.y;
cf->gl_draw = dc->font_ext.func.gl_draw;
cf->font_ext_data = dc->font_ext.data;
cf->col = dc->col.col;
+ cf->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
cf->clip_use = dc->clip.use;
EINA_RECTANGLE_SET(&cf->clip_rect,
dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h);