diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/lib/engines/common/evas_font_draw.c | 135 |
1 files changed, 89 insertions, 46 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_font_draw.c b/libraries/evas/src/lib/engines/common/evas_font_draw.c index 94aa085..638cdfe 100644 --- a/libraries/evas/src/lib/engines/common/evas_font_draw.c +++ b/libraries/evas/src/lib/engines/common/evas_font_draw.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | static int max_cached_words = WORD_CACHE_NWORDS; | 23 | static int max_cached_words = WORD_CACHE_NWORDS; |
24 | 24 | ||
25 | struct prword | 25 | struct prword |
26 | { | 26 | { |
27 | EINA_INLIST; | 27 | EINA_INLIST; |
28 | struct cinfo *cinfo; | 28 | struct cinfo *cinfo; |
@@ -34,16 +34,16 @@ struct prword | |||
34 | int baseline; | 34 | int baseline; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct cinfo | 37 | struct cinfo |
38 | { | 38 | { |
39 | FT_UInt index; | 39 | FT_UInt index; |
40 | struct | 40 | struct |
41 | { | 41 | { |
42 | int x, y; | 42 | int x, y; |
43 | } pos; | 43 | } pos; |
44 | int posx; | 44 | int posx; |
45 | RGBA_Font_Glyph *fg; | 45 | RGBA_Font_Glyph *fg; |
46 | struct | 46 | struct |
47 | { | 47 | { |
48 | int w,h; | 48 | int w,h; |
49 | int rows; | 49 | int rows; |
@@ -77,11 +77,11 @@ evas_common_font_draw_init(void) | |||
77 | #ifdef EVAS_FRAME_QUEUING | 77 | #ifdef EVAS_FRAME_QUEUING |
78 | EAPI void | 78 | EAPI void |
79 | evas_common_font_draw_finish(void) | 79 | evas_common_font_draw_finish(void) |
80 | { | 80 | { |
81 | } | 81 | } |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * BiDi handling: We receive the shaped string + other props from text_props, | 85 | * BiDi handling: We receive the shaped string + other props from text_props, |
86 | * we need to reorder it so we'll have the visual string (the way we draw) | 86 | * we need to reorder it so we'll have the visual string (the way we draw) |
87 | * and then for kerning we have to switch the order of the kerning query (as the prev | 87 | * and then for kerning we have to switch the order of the kerning query (as the prev |
@@ -89,7 +89,7 @@ evas_common_font_draw_finish(void) | |||
89 | */ | 89 | */ |
90 | static void | 90 | static void |
91 | evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn __UNUSED__, int x, int y, | 91 | evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn __UNUSED__, int x, int y, |
92 | const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, | 92 | const Evas_Text_Props *text_props, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, |
93 | int ext_h, int im_w, int im_h __UNUSED__) | 93 | int ext_h, int im_w, int im_h __UNUSED__) |
94 | { | 94 | { |
95 | DATA32 *im; | 95 | DATA32 *im; |
@@ -136,7 +136,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
136 | { | 136 | { |
137 | xrun -= x + xrun - ext_x - ext_w; | 137 | xrun -= x + xrun - ext_x - ext_w; |
138 | } | 138 | } |
139 | if (x < ext_x) | 139 | if (x < ext_x) |
140 | { | 140 | { |
141 | int excess = ext_x - x; | 141 | int excess = ext_x - x; |
142 | xstart = excess - 1; | 142 | xstart = excess - 1; |
@@ -244,10 +244,29 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
244 | if (j < w) j = w; | 244 | if (j < w) j = w; |
245 | h = fg->glyph_out->bitmap.rows; | 245 | h = fg->glyph_out->bitmap.rows; |
246 | /* | 246 | /* |
247 | if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays) | 247 | if ((fg->glyph_out->bitmap.pixel_mode == ft_pixel_mode_grays) |
248 | && (fg->glyph_out->bitmap.num_grays == 256) | 248 | && (fg->glyph_out->bitmap.num_grays == 256) |
249 | ) | 249 | ) |
250 | */ | 250 | */ |
251 | |||
252 | #ifdef HAVE_PIXMAN | ||
253 | # ifdef PIXMAN_FONT | ||
254 | int index; | ||
255 | DATA32 *font_alpha_buffer; | ||
256 | pixman_image_t *font_mask_image; | ||
257 | |||
258 | font_alpha_buffer = alloca(w * h * sizeof(DATA32)); | ||
259 | for (index = 0; index < (w * h); index++) | ||
260 | font_alpha_buffer[index] = data[index] << 24; | ||
261 | |||
262 | font_mask_image = pixman_image_create_bits(PIXMAN_a8r8g8b8, w, h, | ||
263 | font_alpha_buffer, | ||
264 | w * sizeof(DATA32)); | ||
265 | |||
266 | if (!font_mask_image) return; | ||
267 | # endif | ||
268 | #endif | ||
269 | |||
251 | { | 270 | { |
252 | if ((j > 0) && (chr_x + w > ext_x)) | 271 | if ((j > 0) && (chr_x + w > ext_x)) |
253 | { | 272 | { |
@@ -255,44 +274,63 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
255 | { | 274 | { |
256 | /* ext glyph draw */ | 275 | /* ext glyph draw */ |
257 | dc->font_ext.func.gl_draw(dc->font_ext.data, | 276 | dc->font_ext.func.gl_draw(dc->font_ext.data, |
258 | (void *)dst, | 277 | (void *)dst, |
259 | dc, fg, chr_x, | 278 | dc, fg, chr_x, |
260 | y - (chr_y - y)); | 279 | y - (chr_y - y)); |
261 | } | 280 | } |
262 | else | 281 | else |
263 | { | 282 | { |
264 | if ((fg->glyph_out->bitmap.num_grays == 256) && | 283 | if ((fg->glyph_out->bitmap.num_grays == 256) && |
265 | (fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY)) | 284 | (fg->glyph_out->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY)) |
266 | { | 285 | { |
267 | for (i = 0; i < h; i++) | 286 | #ifdef HAVE_PIXMAN |
287 | # ifdef PIXMAN_FONT | ||
288 | if ((dst->pixman.im) && | ||
289 | (dc->col.pixman_color_image)) | ||
290 | pixman_image_composite(PIXMAN_OP_OVER, | ||
291 | dc->col.pixman_color_image, | ||
292 | font_mask_image, | ||
293 | dst->pixman.im, | ||
294 | chr_x, | ||
295 | y - (chr_y - y), | ||
296 | 0, 0, | ||
297 | chr_x, | ||
298 | y - (chr_y - y), | ||
299 | w, h); | ||
300 | else | ||
301 | # endif | ||
302 | #endif | ||
268 | { | 303 | { |
269 | int dx, dy; | 304 | for (i = 0; i < h; i++) |
270 | int in_x, in_w; | 305 | { |
271 | 306 | int dx, dy; | |
272 | in_x = 0; | 307 | int in_x, in_w; |
273 | in_w = 0; | 308 | |
274 | dx = chr_x; | 309 | in_x = 0; |
275 | dy = y - (chr_y - i - y); | 310 | in_w = 0; |
311 | dx = chr_x; | ||
312 | dy = y - (chr_y - i - y); | ||
276 | #ifdef EVAS_SLI | 313 | #ifdef EVAS_SLI |
277 | if (((dy) % dc->sli.h) == dc->sli.y) | 314 | if (((dy) % dc->sli.h) == dc->sli.y) |
278 | #endif | 315 | #endif |
279 | { | ||
280 | if ((dx < (ext_x + ext_w)) && | ||
281 | (dy >= (ext_y)) && | ||
282 | (dy < (ext_y + ext_h))) | ||
283 | { | 316 | { |
284 | if (dx + w > (ext_x + ext_w)) | 317 | if ((dx < (ext_x + ext_w)) && |
285 | in_w += (dx + w) - (ext_x + ext_w); | 318 | (dy >= (ext_y)) && |
286 | if (dx < ext_x) | 319 | (dy < (ext_y + ext_h))) |
287 | { | 320 | { |
288 | in_w += ext_x - dx; | 321 | if (dx + w > (ext_x + ext_w)) |
289 | in_x = ext_x - dx; | 322 | in_w += (dx + w) - (ext_x + ext_w); |
290 | dx = ext_x; | 323 | if (dx < ext_x) |
291 | } | 324 | { |
292 | if (in_w < w) | 325 | in_w += ext_x - dx; |
293 | { | 326 | in_x = ext_x - dx; |
294 | func(NULL, data + (i * j) + in_x, dc->col.col, | 327 | dx = ext_x; |
295 | im + (dy * im_w) + dx, w - in_w); | 328 | } |
329 | if (in_w < w) | ||
330 | { | ||
331 | func(NULL, data + (i * j) + in_x, dc->col.col, | ||
332 | im + (dy * im_w) + dx, w - in_w); | ||
333 | } | ||
296 | } | 334 | } |
297 | } | 335 | } |
298 | } | 336 | } |
@@ -309,7 +347,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
309 | { | 347 | { |
310 | int dx, dy; | 348 | int dx, dy; |
311 | int in_x, in_w, end; | 349 | int in_x, in_w, end; |
312 | 350 | ||
313 | in_x = 0; | 351 | in_x = 0; |
314 | in_w = 0; | 352 | in_w = 0; |
315 | dx = chr_x; | 353 | dx = chr_x; |
@@ -333,8 +371,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
333 | dp++; | 371 | dp++; |
334 | } | 372 | } |
335 | if ((dx < (ext_x + ext_w)) && | 373 | if ((dx < (ext_x + ext_w)) && |
336 | (dy >= (ext_y)) && | 374 | (dy >= (ext_y)) && |
337 | (dy < (ext_y + ext_h))) | 375 | (dy < (ext_y + ext_h))) |
338 | { | 376 | { |
339 | if (dx + w > (ext_x + ext_w)) | 377 | if (dx + w > (ext_x + ext_w)) |
340 | in_w += (dx + w) - (ext_x + ext_w); | 378 | in_w += (dx + w) - (ext_x + ext_w); |
@@ -347,7 +385,7 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
347 | if (in_w < w) | 385 | if (in_w < w) |
348 | { | 386 | { |
349 | func(NULL, tmpbuf + in_x, dc->col.col, | 387 | func(NULL, tmpbuf + in_x, dc->col.col, |
350 | im + (dy * im_w) + dx, w - in_w); | 388 | im + (dy * im_w) + dx, w - in_w); |
351 | } | 389 | } |
352 | } | 390 | } |
353 | } | 391 | } |
@@ -356,6 +394,11 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font | |||
356 | } | 394 | } |
357 | } | 395 | } |
358 | } | 396 | } |
397 | #ifdef HAVE_PIXMAN | ||
398 | # ifdef PIXMAN_FONT | ||
399 | pixman_image_unref(font_mask_image); | ||
400 | # endif | ||
401 | #endif | ||
359 | } | 402 | } |
360 | else | 403 | else |
361 | break; | 404 | break; |
@@ -573,7 +616,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Evas_Text_Props *text_prop | |||
573 | } | 616 | } |
574 | } | 617 | } |
575 | } | 618 | } |
576 | else | 619 | else |
577 | { | 620 | { |
578 | im = NULL; | 621 | im = NULL; |
579 | } | 622 | } |
@@ -599,7 +642,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Evas_Text_Props *text_prop | |||
599 | { | 642 | { |
600 | struct prword *last = (struct prword *)(words->last); | 643 | struct prword *last = (struct prword *)(words->last); |
601 | 644 | ||
602 | if (last) | 645 | if (last) |
603 | { | 646 | { |
604 | if (last->im) free(last->im); | 647 | if (last->im) free(last->im); |
605 | if (last->cinfo) free(last->cinfo); | 648 | if (last->cinfo) free(last->cinfo); |