summaryrefslogtreecommitdiff
path: root/legacy/evas/src
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-11-04 11:51:42 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-11-04 11:51:42 +0000
commitc15e9c6575c3b5f39ded167dda5259de3de96151 (patch)
tree5115d7ae3620af24c2bc094cd062575af7adeda9 /legacy/evas/src
parenta5ac6a987caec5a7f7596a25d0a065b9cc94c50c (diff)
merge: and now Evas
I've tested make -j 3 install and it works nicely I've tested expedite with software and opengl xlib, and it works. Not tested other engines, so please report any problems (engines or other) on the ML. TODO: examples and tests, I'll add them later ISSUE: Eina_Unicode size check. It indirectly depends on eina_config.h, which is created at the end of the configure script. So its size is always 0. I don't know how that size is used, so I can't do a lot, for now. SVN revision: 78895
Diffstat (limited to 'legacy/evas/src')
-rw-r--r--legacy/evas/src/bin/dummy_slave.c207
-rw-r--r--legacy/evas/src/bin/evas_cserve2.h311
-rw-r--r--legacy/evas/src/bin/evas_cserve2_cache.c2342
-rw-r--r--legacy/evas/src/bin/evas_cserve2_client.c434
-rw-r--r--legacy/evas/src/bin/evas_cserve2_debug.c451
-rw-r--r--legacy/evas/src/bin/evas_cserve2_fonts.c636
-rw-r--r--legacy/evas/src/bin/evas_cserve2_main.c367
-rw-r--r--legacy/evas/src/bin/evas_cserve2_main_loop_linux.c805
-rw-r--r--legacy/evas/src/bin/evas_cserve2_messages.c193
-rw-r--r--legacy/evas/src/bin/evas_cserve2_requests.c560
-rw-r--r--legacy/evas/src/bin/evas_cserve2_shm.c195
-rw-r--r--legacy/evas/src/bin/evas_cserve2_slave.c480
-rw-r--r--legacy/evas/src/bin/evas_cserve2_slave.h86
-rw-r--r--legacy/evas/src/bin/evas_cserve2_slaves.c642
-rw-r--r--legacy/evas/src/bin/evas_cserve2_usage.c247
-rw-r--r--legacy/evas/src/bin/evas_cserve2_utils.c58
-rw-r--r--legacy/evas/src/bin/loaders/bmp/evas_image_load_bmp.c1479
-rw-r--r--legacy/evas/src/bin/loaders/eet/evas_image_load_eet.c158
-rw-r--r--legacy/evas/src/bin/loaders/ico/evas_image_load_ico.c789
-rw-r--r--legacy/evas/src/bin/loaders/jpeg/evas_image_load_jpeg.c1118
-rw-r--r--legacy/evas/src/bin/loaders/pmaps/evas_image_load_pmaps.c573
-rw-r--r--legacy/evas/src/bin/loaders/png/evas_image_load_png.c310
-rw-r--r--legacy/evas/src/bin/loaders/psd/evas_image_load_psd.c981
-rw-r--r--legacy/evas/src/bin/loaders/tga/evas_image_load_tga.c574
-rw-r--r--legacy/evas/src/bin/loaders/tiff/evas_image_load_tiff.c282
-rw-r--r--legacy/evas/src/bin/loaders/wbmp/evas_image_load_wbmp.c189
-rw-r--r--legacy/evas/src/bin/loaders/webp/evas_image_load_webp.c141
-rw-r--r--legacy/evas/src/bin/loaders/xpm/evas_image_load_xpm.c688
-rw-r--r--legacy/evas/src/lib/Evas.h19001
-rw-r--r--legacy/evas/src/lib/Evas_GL.h1531
-rw-r--r--legacy/evas/src/lib/cache/evas_cache.h172
-rw-r--r--legacy/evas/src/lib/cache/evas_cache_engine_image.c703
-rw-r--r--legacy/evas/src/lib/cache/evas_cache_image.c1194
-rw-r--r--legacy/evas/src/lib/cache/evas_preload.c234
-rw-r--r--legacy/evas/src/lib/cache2/evas_cache2.c958
-rw-r--r--legacy/evas/src/lib/cache2/evas_cache2.h87
-rw-r--r--legacy/evas/src/lib/canvas/common_interfaces.c271
-rw-r--r--legacy/evas/src/lib/canvas/evas_async_events.c170
-rw-r--r--legacy/evas/src/lib/canvas/evas_callbacks.c675
-rw-r--r--legacy/evas/src/lib/canvas/evas_clip.c421
-rw-r--r--legacy/evas/src/lib/canvas/evas_common_interface.c24
-rw-r--r--legacy/evas/src/lib/canvas/evas_data.c34
-rw-r--r--legacy/evas/src/lib/canvas/evas_device.c259
-rw-r--r--legacy/evas/src/lib/canvas/evas_events.c3220
-rw-r--r--legacy/evas/src/lib/canvas/evas_filter.c1428
-rw-r--r--legacy/evas/src/lib/canvas/evas_focus.c92
-rw-r--r--legacy/evas/src/lib/canvas/evas_font_dir.c1459
-rw-r--r--legacy/evas/src/lib/canvas/evas_gl.c289
-rw-r--r--legacy/evas/src/lib/canvas/evas_key.c354
-rw-r--r--legacy/evas/src/lib/canvas/evas_key_grab.c208
-rw-r--r--legacy/evas/src/lib/canvas/evas_layer.c252
-rw-r--r--legacy/evas/src/lib/canvas/evas_main.c1178
-rw-r--r--legacy/evas/src/lib/canvas/evas_map.c1220
-rw-r--r--legacy/evas/src/lib/canvas/evas_name.c112
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_box.c2400
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_grid.c677
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_image.c4631
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_inform.c95
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_intercept.c622
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_line.c482
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_main.c2486
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_polygon.c579
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_rectangle.c392
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_smart.c1513
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_smart_clipped.c336
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_table.c1624
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_text.c2166
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_textblock.c10379
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_textgrid.c1597
-rw-r--r--legacy/evas/src/lib/canvas/evas_rectangle.c98
-rw-r--r--legacy/evas/src/lib/canvas/evas_render.c1970
-rw-r--r--legacy/evas/src/lib/canvas/evas_smart.c332
-rw-r--r--legacy/evas/src/lib/canvas/evas_stack.c495
-rw-r--r--legacy/evas/src/lib/canvas/evas_stats.c49
-rw-r--r--legacy/evas/src/lib/canvas/evas_touch_point.c155
-rw-r--r--legacy/evas/src/lib/cserve2/evas_cs2.h298
-rw-r--r--legacy/evas/src/lib/cserve2/evas_cs2_client.c1309
-rw-r--r--legacy/evas/src/lib/cserve2/evas_cs2_image_data.c23
-rw-r--r--legacy/evas/src/lib/cserve2/evas_cs2_private.h42
-rw-r--r--legacy/evas/src/lib/cserve2/evas_cs2_utils.c121
-rw-r--r--legacy/evas/src/lib/cserve2/evas_cs2_utils.h13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend.h8
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_main.c325
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blend_private.h31
-rw-r--r--legacy/evas/src/lib/engines/common/evas_blit_main.c614
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_color.c246
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_color.h16
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_colorspace.c186
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_colorspace.h12
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_gry_1.h9
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_gry_8.c68
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_gry_8.h12
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_grypal_6.c21
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_grypal_6.h6
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_main.c478
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_main.h9
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_16.c1927
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_16.h50
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_24.c85
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_24.h10
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_32.c555
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_32.h24
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_8.c240
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_rgb_8.h14
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_yuv.c1215
-rw-r--r--legacy/evas/src/lib/engines/common/evas_convert_yuv.h9
-rw-r--r--legacy/evas/src/lib/engines/common/evas_cpu.c273
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw.h36
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c703
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font.h78
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_default_walk.x145
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_draw.c430
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_load.c909
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_main.c722
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_ot.c344
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_ot.h45
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_private.h53
-rw-r--r--legacy/evas/src/lib/engines/common/evas_font_query.c802
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image.h68
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_data.c149
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_load.c391
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_main.c929
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_private.h15
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_save.c49
-rw-r--r--legacy/evas/src/lib/engines/common/evas_image_scalecache.c837
-rw-r--r--legacy/evas/src/lib/engines/common/evas_line.h11
-rw-r--r--legacy/evas/src/lib/engines/common/evas_line_main.c1003
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image.c764
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image.h23
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image_core.c226
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image_internal.c180
-rw-r--r--legacy/evas/src/lib/engines/common/evas_map_image_loop.c116
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_color_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_color_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_mask_color_.c26
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_mask_color_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_pixel_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_pixel_color_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_pixel_color_i386.c29
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_pixel_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_pixel_mask_.c29
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add/op_add_pixel_mask_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_add_main_.c529
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_color_.c101
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_color_i386.c138
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_color_neon.c223
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_color_sse3.c167
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_mask_color_.c177
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_mask_color_i386.c251
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_mask_color_neon.c562
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_mask_color_sse3.c321
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_master_sse3.c77
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_.c154
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_color_.c276
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_color_i386.c221
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_color_neon.c570
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_color_sse3.c543
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_i386.c217
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_mask_.c181
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_mask_i386.c157
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_mask_neon.c129
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_mask_sse3.c300
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_neon.c530
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend/op_blend_pixel_sse3.c315
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_blend_main_.c659
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_color_.c131
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_color_i386.c150
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_color_neon.c212
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_mask_color_.c162
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_mask_color_i386.c193
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_mask_color_neon.c170
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_.c109
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_color_.c228
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_color_i386.c255
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_color_neon.c238
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_i386.c131
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_mask_.c142
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_mask_i386.c176
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_mask_neon.c151
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy/op_copy_pixel_neon.c158
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_copy_main_.c663
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_color_.c46
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_color_i386.c58
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_mask_color_.c59
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_mask_color_i386.c13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_pixel_.c44
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_pixel_color_.c96
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_pixel_color_i386.c13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_pixel_i386.c58
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_pixel_mask_.c58
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask/op_mask_pixel_mask_i386.c13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mask_main_.c303
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_color_.c60
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_color_i386.c66
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_mask_color_.c68
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_mask_color_i386.c92
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_.c52
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_color_.c118
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_color_i386.c120
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_i386.c66
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_mask_.c114
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul/op_mul_pixel_mask_i386.c63
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_mul_main_.c302
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_color_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_color_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_mask_color_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_mask_color_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_pixel_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_pixel_color_.c25
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_pixel_color_i386.c29
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_pixel_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_pixel_mask_.c29
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub/op_sub_pixel_mask_i386.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_op_sub_main_.c530
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.c895
-rw-r--r--legacy/evas/src/lib/engines/common/evas_pipe.h27
-rw-r--r--legacy/evas/src/lib/engines/common/evas_polygon.h13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_polygon_main.c320
-rw-r--r--legacy/evas/src/lib/engines/common/evas_rectangle.h13
-rw-r--r--legacy/evas/src/lib/engines/common/evas_rectangle_main.c137
-rw-r--r--legacy/evas/src/lib/engines/common/evas_regionbuf.c357
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_main.c33
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_main.h18
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_sample.c408
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth.c243
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth.h7
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler.c211
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_down.c43
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx.c234
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_downx_downy.c363
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_downy.c236
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_noscale.c44
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_smooth_scaler_up.c235
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_span.c653
-rw-r--r--legacy/evas/src/lib/engines/common/evas_scale_span.h14
-rw-r--r--legacy/evas/src/lib/engines/common/evas_text_utils.c521
-rw-r--r--legacy/evas/src/lib/engines/common/evas_text_utils.h101
-rw-r--r--legacy/evas/src/lib/engines/common/evas_tiler.c1439
-rw-r--r--legacy/evas/src/lib/engines/common/language/evas_bidi_utils.c645
-rw-r--r--legacy/evas/src/lib/engines/common/language/evas_bidi_utils.h157
-rw-r--r--legacy/evas/src/lib/engines/common/language/evas_language_utils.c152
-rw-r--r--legacy/evas/src/lib/engines/common/language/evas_language_utils.h132
-rw-r--r--legacy/evas/src/lib/engines/common/language/evas_script_table.h3087
-rw-r--r--legacy/evas/src/lib/file/evas_module.c607
-rw-r--r--legacy/evas/src/lib/file/evas_module.h94
-rw-r--r--legacy/evas/src/lib/file/evas_path.c152
-rw-r--r--legacy/evas/src/lib/file/evas_path.h15
-rw-r--r--legacy/evas/src/lib/include/evas_blend_ops.h378
-rw-r--r--legacy/evas/src/lib/include/evas_common.h1276
-rw-r--r--legacy/evas/src/lib/include/evas_inline.x300
-rw-r--r--legacy/evas/src/lib/include/evas_macros.h217
-rw-r--r--legacy/evas/src/lib/include/evas_mmx.h735
-rw-r--r--legacy/evas/src/lib/include/evas_options.h6
-rw-r--r--legacy/evas/src/lib/include/evas_private.h1335
-rw-r--r--legacy/evas/src/lib/main.c160
-rw-r--r--legacy/evas/src/modules/engines/buffer/Evas_Engine_Buffer.h43
-rw-r--r--legacy/evas/src/modules/engines/buffer/evas_engine.c445
-rw-r--r--legacy/evas/src/modules/engines/buffer/evas_engine.h91
-rw-r--r--legacy/evas/src/modules/engines/buffer/evas_outbuf.c418
-rw-r--r--legacy/evas/src/modules/engines/direct3d/Evas_Engine_Direct3D.h36
-rw-r--r--legacy/evas/src/modules/engines/direct3d/array.h305
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_buffer.c0
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_context.cpp8
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_context.h22
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_device.cpp393
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_device.h87
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.cpp436
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_image_cache.h108
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_main.cpp774
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object.cpp12
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object.h35
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_font.cpp231
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_font.h113
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_image.cpp320
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_image.h127
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_line.cpp60
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_line.h37
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.cpp65
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_object_rect.h37
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_scene.cpp33
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_scene.h63
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.cpp344
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_shader_pack.h75
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.cpp154
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_direct3d_vertex_buffer_cache.h60
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_engine.c505
-rw-r--r--legacy/evas/src/modules/engines/direct3d/evas_engine.h125
-rw-r--r--legacy/evas/src/modules/engines/direct3d/ref.h210
-rw-r--r--legacy/evas/src/modules/engines/directfb/Evas_Engine_DirectFB.h25
-rw-r--r--legacy/evas/src/modules/engines/directfb/evas_engine.c1755
-rw-r--r--legacy/evas/src/modules/engines/directfb/evas_engine.h71
-rw-r--r--legacy/evas/src/modules/engines/directfb/polygon.c269
-rw-r--r--legacy/evas/src/modules/engines/fb/Evas_Engine_FB.h25
-rw-r--r--legacy/evas/src/modules/engines/fb/evas_engine.c311
-rw-r--r--legacy/evas/src/modules/engines/fb/evas_engine.h85
-rw-r--r--legacy/evas/src/modules/engines/fb/evas_fb.h93
-rw-r--r--legacy/evas/src/modules/engines/fb/evas_fb_main.c600
-rw-r--r--legacy/evas/src/modules/engines/fb/evas_outbuf.c402
-rw-r--r--legacy/evas/src/modules/engines/gl_cocoa/Evas_Engine_GL_Cocoa.h20
-rw-r--r--legacy/evas/src/modules/engines/gl_cocoa/evas_engine.c1474
-rw-r--r--legacy/evas/src/modules/engines/gl_cocoa/evas_engine.h69
-rw-r--r--legacy/evas/src/modules/engines/gl_cocoa/evas_gl_cocoa_main.m134
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api.c2925
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.c286
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext.h70
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api_ext_def.h632
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_common.h670
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_context.c2847
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core.c1568
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core.h39
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h250
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_filter.c181
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_font.c205
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_image.c974
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_line.c48
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_polygon.c306
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_private.h32
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_rectangle.c53
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_shader.c956
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_texture.c1680
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/.gitignore1
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/shader/compile.sh48
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur.h24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur.shd24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_bgra.h24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_bgra.shd24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_bgra_nomul.h24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_bgra_nomul.shd24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_nomul.h24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_nomul.shd24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_vert.h29
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_blur_vert.shd29
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale_bgra.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale_bgra.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale_bgra_nomul.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale_bgra_nomul.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale_nomul.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_greyscale_nomul.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert_bgra.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert_bgra.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert_bgra_nomul.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert_bgra_nomul.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert_nomul.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_invert_nomul.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia.h20
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia.shd20
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia_bgra.h20
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia_bgra.shd20
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia_bgra_nomul.h18
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia_bgra_nomul.shd18
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia_nomul.h18
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/filter_sepia_nomul.shd18
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/font_frag.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/font_frag.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/font_vert.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/font_vert.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_frag.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_frag.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.h13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_nomul_frag.shd13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.h12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_nomul_vert.shd12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_vert.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_bgra_vert.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_frag.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_frag.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_mask_frag.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_mask_frag.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_mask_vert.h16
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_mask_vert.shd16
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_nomul_frag.h13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_nomul_frag.shd13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_nomul_vert.h12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_nomul_vert.shd12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_vert.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/img_vert.shd15
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/shader/make-c-str.sh3
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_frag.h31
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_frag.shd31
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_nomul_frag.h31
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_nomul_frag.shd31
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_nomul_vert.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_nomul_vert.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_vert.h16
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/nv12_vert.shd16
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/rect_frag.h13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/rect_frag.shd13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/rect_vert.h12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/rect_vert.shd12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_frag.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_frag.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_nomul_frag.h13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_nomul_frag.shd13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_nomul_vert.h12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_nomul_vert.shd12
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_vert.h15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/tex_vert.shd15
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_frag.h24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_frag.shd24
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_nomul_frag.h23
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_nomul_frag.shd23
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_nomul_vert.h14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_nomul_vert.shd14
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_vert.h17
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuv_vert.shd17
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_frag.h30
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_frag.shd30
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_nomul_frag.h30
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_nomul_frag.shd30
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_nomul_vert.h13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_nomul_vert.shd13
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_vert.h16
-rw-r--r--legacy/evas/src/modules/engines/gl_common/shader/yuy2_vert.shd16
-rw-r--r--legacy/evas/src/modules/engines/gl_sdl/Evas_Engine_GL_SDL.h24
-rw-r--r--legacy/evas/src/modules/engines/gl_sdl/evas_engine.c1141
-rw-r--r--legacy/evas/src/modules/engines/gl_sdl/evas_engine.h73
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/Evas_Engine_GL_X11.h59
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.c2996
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.h114
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_x_main.c886
-rw-r--r--legacy/evas/src/modules/engines/psl1ght/Evas_Engine_PSL1GHT.h16
-rw-r--r--legacy/evas/src/modules/engines/psl1ght/evas_engine.c512
-rw-r--r--legacy/evas/src/modules/engines/psl1ght/evas_engine.h30
-rw-r--r--legacy/evas/src/modules/engines/psl1ght/rsxutil.c275
-rw-r--r--legacy/evas/src/modules/engines/psl1ght/rsxutil.h43
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/Evas_Engine_Software_DDraw.h30
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/evas_ddraw_buffer.c92
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/evas_ddraw_main.cpp248
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/evas_engine.c380
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/evas_engine.h220
-rw-r--r--legacy/evas/src/modules/engines/software_ddraw/evas_outbuf.c460
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/Evas_Engine_Software_Gdi.h32
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/evas_engine.c388
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/evas_engine.h209
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/evas_gdi_buffer.c88
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/evas_gdi_main.c100
-rw-r--r--legacy/evas/src/modules/engines/software_gdi/evas_outbuf.c656
-rw-r--r--legacy/evas/src/modules/engines/software_generic/evas_engine.c2925
-rw-r--r--legacy/evas/src/modules/engines/software_x11/Evas_Engine_Software_X11.h52
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_engine.c776
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_engine.h132
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_x_egl.c281
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_x_egl.h23
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_buffer.c498
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_buffer.h30
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_color.c424
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_color.h10
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_main.c8
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.c1170
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_outbuf.h26
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_xdefaults.c108
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xcb_xdefaults.h11
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_buffer.c428
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_buffer.h45
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_color.c368
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_color.h16
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_main.c7
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_outbuf.c1209
-rw-r--r--legacy/evas/src/modules/engines/software_x11/evas_xlib_outbuf.h87
-rw-r--r--legacy/evas/src/modules/engines/wayland_egl/Evas_Engine_Wayland_Egl.h49
-rw-r--r--legacy/evas/src/modules/engines/wayland_egl/evas_engine.c3828
-rw-r--r--legacy/evas/src/modules/engines/wayland_egl/evas_engine.h87
-rw-r--r--legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c287
-rw-r--r--legacy/evas/src/modules/engines/wayland_shm/Evas_Engine_Wayland_Shm.h27
-rw-r--r--legacy/evas/src/modules/engines/wayland_shm/evas_engine.c372
-rw-r--r--legacy/evas/src/modules/engines/wayland_shm/evas_engine.h63
-rw-r--r--legacy/evas/src/modules/engines/wayland_shm/evas_outbuf.c162
-rw-r--r--legacy/evas/src/modules/loaders/bmp/evas_image_load_bmp.c1498
-rw-r--r--legacy/evas/src/modules/loaders/eet/evas_image_load_eet.c183
-rw-r--r--legacy/evas/src/modules/loaders/generic/evas_image_load_generic.c434
-rw-r--r--legacy/evas/src/modules/loaders/gif/evas_image_load_gif.c1099
-rw-r--r--legacy/evas/src/modules/loaders/ico/evas_image_load_ico.c808
-rw-r--r--legacy/evas/src/modules/loaders/jpeg/evas_image_load_jpeg.c1337
-rw-r--r--legacy/evas/src/modules/loaders/pmaps/evas_image_load_pmaps.c590
-rw-r--r--legacy/evas/src/modules/loaders/png/evas_image_load_png.c329
-rw-r--r--legacy/evas/src/modules/loaders/psd/evas_image_load_psd.c1002
-rw-r--r--legacy/evas/src/modules/loaders/svg/evas_image_load_esvg.c308
-rw-r--r--legacy/evas/src/modules/loaders/tga/evas_image_load_tga.c593
-rw-r--r--legacy/evas/src/modules/loaders/tiff/evas_image_load_tiff.c325
-rw-r--r--legacy/evas/src/modules/loaders/wbmp/evas_image_load_wbmp.c209
-rw-r--r--legacy/evas/src/modules/loaders/webp/evas_image_load_webp.c170
-rw-r--r--legacy/evas/src/modules/loaders/xpm/evas_image_load_xpm.c734
-rw-r--r--legacy/evas/src/modules/savers/eet/evas_image_save_eet.c83
-rw-r--r--legacy/evas/src/modules/savers/jpeg/evas_image_save_jpeg.c157
-rw-r--r--legacy/evas/src/modules/savers/png/evas_image_save_png.c193
-rw-r--r--legacy/evas/src/modules/savers/tiff/evas_image_save_tiff.c139
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/AUTHORS8
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/ChangeLog397
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/LICENCE18
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/LineBreak1.sed1
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/LineBreak2.sed2
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/NEWS37
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/README86
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/filter_dup.c48
-rwxr-xr-xlegacy/evas/src/static_deps/liblinebreak/gen_linebreak_data.sh11
-rwxr-xr-xlegacy/evas/src/static_deps/liblinebreak/gen_wordbreak_data.sh25
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreak.c737
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreak.h87
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreakdata.c1868
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreakdata1.tmpl1
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreakdata2.tmpl7
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreakdata3.tmpl2
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreakdef.c139
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/linebreakdef.h149
-rwxr-xr-xlegacy/evas/src/static_deps/liblinebreak/sort_numeric_hex.py6
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/wordbreak.c435
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/wordbreak.h72
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/wordbreakdata.x858
-rw-r--r--legacy/evas/src/static_deps/liblinebreak/wordbreakdef.h80
513 files changed, 0 insertions, 194639 deletions
diff --git a/legacy/evas/src/bin/dummy_slave.c b/legacy/evas/src/bin/dummy_slave.c
deleted file mode 100644
index 398d86eceb..0000000000
--- a/legacy/evas/src/bin/dummy_slave.c
+++ /dev/null
@@ -1,207 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <errno.h>
6#include <stdio.h>
7#include <stdlib.h>
8#include <time.h>
9#include <sys/mman.h>
10#include <fcntl.h>
11#include <unistd.h>
12
13#include "evas_cserve2.h"
14
15static Eina_Bool
16command_read(int fd, Slave_Command *cmd, void **params)
17{
18 ssize_t ret;
19 int ints[2], size, got = 0;
20 char *buf;
21
22 ret = read(fd, ints, sizeof(int) * 2);
23 if (ret < (int)sizeof(int) * 2)
24 return EINA_FALSE;
25
26 size = ints[0];
27 buf = malloc(size);
28 if (!buf) return EINA_FALSE;
29
30 do {
31 ret = read(fd, buf + got, size - got);
32 if (ret < 0)
33 {
34 /* EINTR means we were interrupted by a signal before anything
35 * was sent, and if we are back here it means that signal was
36 * not meant for us to die. Any other error here is fatal and
37 * should result in the slave terminating.
38 */
39 if (errno == EINTR)
40 continue;
41 free(buf);
42 return EINA_FALSE;
43 }
44 got += ret;
45 } while (got < size);
46
47 *cmd = ints[1];
48 *params = buf;
49
50 return EINA_TRUE;
51}
52
53static Eina_Bool
54response_send(int fd, Slave_Command cmd, void *resp, int size)
55{
56 int sent = 0, ints[2];
57 const char *data = resp;
58 ssize_t ret;
59
60 ints[0] = size;
61 ints[1] = cmd;
62 ret = write(fd, ints, sizeof(int) * 2);
63 if (ret < 0)
64 return EINA_FALSE;
65 if (!size)
66 return EINA_TRUE;
67 do {
68 ret = write(fd, data + sent, size - sent);
69 if (ret < 0)
70 {
71 /* EINTR means we were interrupted by a signal before anything
72 * was sent, and if we are back here it means that signal was
73 * not meant for us to die. Any other error here is fatal and
74 * should result in the slave terminating.
75 */
76 if (errno == EINTR)
77 continue;
78 return EINA_FALSE;
79 }
80 sent += ret;
81 } while (sent < size);
82
83 return EINA_TRUE;
84}
85
86static Eina_Bool
87error_send(int fd, Error_Type err)
88{
89 return response_send(fd, ERROR, &err, sizeof(Error_Type));
90}
91
92static void *
93_cserve2_shm_map(const char *name, size_t length, off_t offset)
94{
95 void *map;
96 int fd;
97
98 fd = shm_open(name, O_RDWR, 0);
99 if (fd == -1)
100 return MAP_FAILED;
101
102 map = mmap(NULL, length, PROT_WRITE, MAP_SHARED, fd, offset);
103
104 close(fd);
105
106 return map;
107}
108
109/*
110static void
111_cserve2_shm_unmap(void *map, size_t length)
112{
113 munmap(map, length);
114}
115*/
116
117static Error_Type
118image_open(const char *file __UNUSED__, const char *key __UNUSED__, Slave_Msg_Image_Opened *result)
119{
120 memset(result, 0, sizeof(*result));
121 result->w = 32;
122 result->h = 32;
123 result->frame_count = 1;
124 result->loop_count = 0;
125 result->loop_hint = 0;
126 result->alpha = EINA_TRUE;
127 return CSERVE2_NONE;
128}
129
130static Error_Type
131image_load(const char *shmfile, Slave_Msg_Image_Load *params)
132{
133 char *map = _cserve2_shm_map(shmfile, params->shm.mmap_size,
134 params->shm.mmap_offset);
135 if (map == MAP_FAILED)
136 return CSERVE2_RESOURCE_ALLOCATION_FAILED;
137
138 memset(map + params->shm.image_offset, 'A', params->shm.image_size);
139
140 return CSERVE2_NONE;
141}
142
143int main(int c, char **v)
144{
145 int wfd, rfd;
146 Slave_Command cmd;
147 void *params = NULL;;
148 Eina_Bool quit = EINA_FALSE;
149
150 if (c < 3)
151 return 1;
152
153 wfd = atoi(v[1]);
154 rfd = atoi(v[2]);
155
156 while (!quit)
157 {
158 if (!command_read(rfd, &cmd, &params))
159 {
160 error_send(wfd, CSERVE2_INVALID_COMMAND);
161 continue;
162 }
163
164 switch (cmd)
165 {
166 case IMAGE_OPEN:
167 {
168 Slave_Msg_Image_Opened result;
169 Slave_Msg_Image_Open *p;
170 Error_Type err;
171 const char *file, *key;
172 p = params;
173 file = (const char *)(p + sizeof(*p));
174 key = file + strlen(file) + 1;
175 if ((err = image_open(file, key, &result)) != CSERVE2_NONE)
176 error_send(wfd, err);
177 else
178 response_send(wfd, IMAGE_OPEN, &result,
179 sizeof(Slave_Msg_Image_Opened));
180 break;
181 }
182 case IMAGE_LOAD:
183 {
184 Slave_Msg_Image_Load *load_args = params;
185 Error_Type err;
186 const char *shmfile = ((const char *)params) +
187 sizeof(Slave_Msg_Image_Load);
188 if ((err = image_load(shmfile, load_args)) != CSERVE2_NONE)
189 error_send(wfd, err);
190 else
191 response_send(wfd, IMAGE_LOAD, NULL, 0);
192 break;
193 }
194 case SLAVE_QUIT:
195 {
196 quit = EINA_TRUE;
197 break;
198 }
199
200 default:
201 error_send(wfd, CSERVE2_INVALID_COMMAND);
202 }
203 free(params);
204 }
205
206 return 0;
207}
diff --git a/legacy/evas/src/bin/evas_cserve2.h b/legacy/evas/src/bin/evas_cserve2.h
deleted file mode 100644
index 35603873be..0000000000
--- a/legacy/evas/src/bin/evas_cserve2.h
+++ /dev/null
@@ -1,311 +0,0 @@
1#ifndef _EVAS_CSERVE2_H
2#define _EVAS_CSERVE2_H
3
4#include <Eina.h>
5#include "evas_cs2.h"
6
7#ifdef ERR
8#undef ERR
9#endif
10#define ERR(...) EINA_LOG_DOM_ERR(_evas_cserve2_bin_log_dom, __VA_ARGS__)
11#ifdef DBG
12#undef DBG
13#endif
14#define DBG(...) EINA_LOG_DOM_DBG(_evas_cserve2_bin_log_dom, __VA_ARGS__)
15#ifdef WRN
16#undef WRN
17#endif
18#define WRN(...) EINA_LOG_DOM_WARN(_evas_cserve2_bin_log_dom, __VA_ARGS__)
19#ifdef INF
20#undef INF
21#endif
22#define INF(...) EINA_LOG_DOM_INFO(_evas_cserve2_bin_log_dom, __VA_ARGS__)
23
24#define DEBUG_LOAD_TIME 1
25
26extern int _evas_cserve2_bin_log_dom;
27
28typedef struct _Slave Slave;
29typedef struct _Slave_Thread_Data Slave_Thread_Data;
30typedef struct _Shm_Handle Shm_Handle;
31
32typedef enum {
33 FD_READ = 1,
34 FD_WRITE = 2,
35 FD_ERROR = 4
36} Fd_Flags;
37
38struct _Client {
39 unsigned int id;
40 int socket;
41 struct {
42 Eina_Bool reading;
43 char *buf; // buffer of data being read
44 int done, size;
45 Eina_Binbuf *pending; // pending data to send
46 } msg;
47 struct {
48 Eina_Hash *referencing; // indexed by client file id
49 } files;
50 struct {
51 Eina_Hash *referencing; // indexed by client image id
52 } images;
53 struct {
54 Eina_List *referencing;
55 } fonts;
56};
57
58typedef struct _Client Client;
59
60struct _Image_Load_Opts {
61 unsigned int w, h;
62 unsigned int rx, ry, rw, rh;
63 unsigned int scale_down_by;
64 double dpi;
65 Eina_Bool orientation;
66};
67
68typedef struct _Image_Load_Opts Image_Load_Opts;
69
70typedef enum {
71 IMAGE_OPEN,
72 IMAGE_LOAD,
73 FONT_LOAD,
74 FONT_GLYPHS_LOAD,
75 SLAVE_QUIT,
76 ERROR
77} Slave_Command;
78
79struct _Slave_Msg_Image_Open {
80 Eina_Bool has_opts : 1;
81 Eina_Bool has_loader_data : 1;
82};
83
84struct _Slave_Msg_Image_Opened {
85 int w, h;
86 int degree;
87 int scale; /* used by jpeg when loading in smaller sizes */
88 int frame_count;
89 int loop_count;
90 int loop_hint; /* include Evas.h? Copy the enum around? */
91 Eina_Bool alpha : 1;
92 Eina_Bool animated : 1;
93 Eina_Bool rotated : 1;
94
95 Eina_Bool has_loader_data : 1;
96};
97
98struct _Slave_Msg_Image_Load {
99 int w, h;
100 Image_Load_Opts opts;
101 struct {
102 int mmap_offset;
103 int image_offset;
104 int mmap_size;
105 int image_size;
106 } shm;
107 Eina_Bool alpha : 1;
108 Eina_Bool has_loader_data : 1;
109};
110
111struct _Slave_Msg_Image_Loaded {
112 Eina_Bool alpha_sparse : 1;
113};
114
115typedef struct _Slave_Msg_Image_Open Slave_Msg_Image_Open;
116typedef struct _Slave_Msg_Image_Opened Slave_Msg_Image_Opened;
117typedef struct _Slave_Msg_Image_Load Slave_Msg_Image_Load;
118typedef struct _Slave_Msg_Image_Loaded Slave_Msg_Image_Loaded;
119
120struct _Slave_Msg_Font_Load {
121 void *ftdata1; // Freetype file source info comes here
122 void *ftdata2; // Freetype font info comes here
123 unsigned int rend_flags;
124 unsigned int size;
125 unsigned int dpi;
126 const char *name;
127 const char *file;
128 void *data;
129 int datasize;
130};
131
132struct _Slave_Msg_Font_Loaded {
133 void *ftdata1;
134 void *ftdata2;
135};
136
137struct _Slave_Msg_Font_Glyphs_Load {
138 struct {
139 void *ftdata1;
140 void *ftdata2;
141 unsigned int rend_flags;
142 unsigned int hint;
143 } font;
144 struct {
145 unsigned int nglyphs;
146 unsigned int *glyphs;
147 } glyphs;
148 struct {
149 Shm_Handle *shm;
150 unsigned int usage;
151 unsigned int nglyphs;
152 } cache;
153};
154
155struct _Slave_Msg_Glyph {
156 unsigned int index;
157 unsigned int offset;
158 unsigned int size;
159 unsigned int rows;
160 unsigned int width;
161 unsigned int pitch;
162 unsigned int num_grays;
163 unsigned int pixel_mode;
164};
165
166typedef struct _Slave_Msg_Glyph Slave_Msg_Glyph;
167
168struct _Slave_Msg_Font_Cache {
169 unsigned int nglyphs;
170 Slave_Msg_Glyph *glyphs;
171 Shm_Handle *shm;
172 unsigned int usage;
173};
174
175typedef struct _Slave_Msg_Font_Cache Slave_Msg_Font_Cache;
176
177struct _Slave_Msg_Font_Glyphs_Loaded {
178 unsigned int ncaches;
179 unsigned int gl_load_time;
180 unsigned int gl_render_time;
181 unsigned int gl_slave_time;
182 Slave_Msg_Font_Cache **caches;
183};
184
185typedef struct _Slave_Msg_Font_Load Slave_Msg_Font_Load;
186typedef struct _Slave_Msg_Font_Loaded Slave_Msg_Font_Loaded;
187typedef struct _Slave_Msg_Font_Glyphs_Load Slave_Msg_Font_Glyphs_Load;
188typedef struct _Slave_Msg_Font_Glyphs_Loaded Slave_Msg_Font_Glyphs_Loaded;
189
190typedef void *(*Slave_Request_Msg_Create)(void *data, int *size);
191typedef void (*Slave_Request_Msg_Free)(void *msg, void *data);
192typedef Msg_Base *(*Slave_Request_Response)(void *data, void *resp, int *size);
193typedef void (*Slave_Request_Error)(void *data, Error_Type error);
194
195struct _Slave_Request_Funcs {
196 Slave_Request_Msg_Create msg_create;
197 Slave_Request_Msg_Free msg_free;
198 Slave_Request_Response response;
199 Slave_Request_Error error;
200};
201
202typedef struct _Slave_Request Slave_Request;
203typedef struct _Slave_Request_Funcs Slave_Request_Funcs;
204
205typedef enum {
206 FONT_REND_REGULAR = 1,
207 FONT_REND_SLANT = 1 << 1,
208 FONT_REND_WEIGHT = 1 << 2
209} Font_Rend_Flags;
210
211typedef enum {
212 CSERVE2_REQ_IMAGE_OPEN = 0,
213 CSERVE2_REQ_IMAGE_LOAD,
214 CSERVE2_REQ_IMAGE_SPEC_LOAD,
215 CSERVE2_REQ_FONT_LOAD,
216 CSERVE2_REQ_FONT_GLYPHS_LOAD,
217 CSERVE2_REQ_LAST
218} Slave_Request_Type;
219
220typedef struct _Glyph_Entry Glyph_Entry;
221
222typedef void (*Fd_Watch_Cb)(int fd, Fd_Flags flags, void *data);
223typedef void (*Timeout_Cb)(void); /* void* for compat? */
224typedef void (*Main_Loop_Child_Dead_Cb)(int pid, int status); /* void* for compat? */
225typedef void (*Slave_Dead_Cb)(Slave *slave, void *data);
226typedef void (*Slave_Read_Cb)(Slave *slave, Slave_Command cmd, void *msg, void *data);
227typedef void *(*Slave_Thread_Cb)(Slave_Thread_Data *sd, Slave_Command *cmd, const void *cmddata, void *userdata);
228typedef void (*File_Change_Cb)(const char *path, Eina_Bool deleted, void *data);
229
230void cserve2_client_accept(int fd);
231ssize_t cserve2_client_read(Client *client, void *buf, size_t len);
232ssize_t cserve2_client_write(Client *client, const void *buf, size_t len);
233void cserve2_client_del(Client *client);
234void cserve2_client_deliver(Client *client);
235void cserve2_client_error_send(Client *client, unsigned int rid, int error_code);
236ssize_t cserve2_client_send(Client *client, const void *data, size_t size);
237
238Eina_Bool cserve2_fd_watch_add(int fd, Fd_Flags flags, Fd_Watch_Cb cb, const void *data);
239Eina_Bool cserve2_fd_watch_del(int fd);
240Eina_Bool cserve2_fd_watch_flags_set(int fd, Fd_Flags flags);
241Eina_Bool cserve2_fd_watch_flags_get(int fd, Fd_Flags *flags);
242
243Eina_Bool cserve2_file_change_watch_add(const char *path, File_Change_Cb cb, const void *data);
244Eina_Bool cserve2_file_change_watch_del(const char *path);
245
246void cserve2_on_child_dead_set(Main_Loop_Child_Dead_Cb cb);
247
248void cserve2_timeout_cb_set(int t, Timeout_Cb cb);
249
250Eina_Bool cserve2_main_loop_setup(void);
251void cserve2_main_loop_run(void);
252void cserve2_main_loop_finish(void);
253
254Eina_Bool cserve2_slaves_init(void);
255void cserve2_slaves_shutdown(void);
256int cserve2_slave_available_get(void);
257Eina_Bool cserve2_slave_cmd_dispatch(void *data, Slave_Command cmd, const void *msg, int size);
258Slave *cserve2_slave_run(const char *exe, Slave_Read_Cb read_cb, Slave_Dead_Cb dead_cb, const void *data);
259Slave *cserve2_slave_thread_run(Slave_Thread_Cb thread_cb, void *thread_data, Slave_Read_Cb read_cb, Slave_Dead_Cb dead_cb, const void *data);
260void cserve2_slave_send(Slave *s, Slave_Command cmd, const char *data, size_t size);
261void cserve2_slave_kill(Slave *s);
262
263void cserve2_message_handler(int fd, Fd_Flags flags, void *data);
264
265Shm_Handle *cserve2_shm_request(size_t size);
266void cserve2_shm_unref(Shm_Handle *shm);
267const char *cserve2_shm_name_get(const Shm_Handle *shm);
268off_t cserve2_shm_map_offset_get(const Shm_Handle *shm);
269off_t cserve2_shm_offset_get(const Shm_Handle *shm);
270size_t cserve2_shm_map_size_get(const Shm_Handle *shm);
271size_t cserve2_shm_size_get(const Shm_Handle *shm);
272void *cserve2_shm_map(Shm_Handle *shm);
273void cserve2_shm_unmap(Shm_Handle *shm);
274size_t cserve2_shm_size_normalize(size_t size);
275
276void cserve2_command_run(Client *client, Message_Type type);
277
278void cserve2_cache_init(void);
279void cserve2_cache_shutdown(void);
280void cserve2_cache_client_new(Client *client);
281void cserve2_cache_client_del(Client *client);
282int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid);
283void cserve2_cache_file_close(Client *client, unsigned int client_file_id);
284int cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg);
285void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid);
286void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid);
287void cserve2_cache_image_unload(Client *client, unsigned int client_image_id);
288
289int cserve2_cache_font_load(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int rid);
290int cserve2_cache_font_unload(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int rid);
291int cserve2_cache_font_glyphs_load(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int rend_flags, unsigned int hint, unsigned int size, unsigned int dpi, unsigned int *glyphs, unsigned int nglyphs, unsigned int rid);
292int cserve2_cache_font_glyphs_used(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int hint, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int *glyphs, unsigned int nglyphs, unsigned int rid);
293void cserve2_cache_stats_get(Client *client, unsigned int rid);
294void cserve2_cache_font_debug(Client *client, unsigned int rid);
295
296
297Slave_Request *cserve2_request_add(Slave_Request_Type type, unsigned int rid, Client *client, Slave_Request *dep, Slave_Request_Funcs *funcs, void *data);
298void cserve2_request_waiter_add(Slave_Request *req, unsigned int rid, Client *client);
299void cserve2_request_type_set(Slave_Request *req, Slave_Request_Type type);
300void cserve2_request_cancel(Slave_Request *req, Client *client, Error_Type err);
301void cserve2_request_cancel_all(Slave_Request *req, Error_Type err);
302void cserve2_requests_init(void);
303void cserve2_requests_shutdown(void);
304
305void cserve2_font_init(void);
306void cserve2_font_shutdown(void);
307void *cserve2_font_slave_cb(Slave_Thread_Data *sd, Slave_Command *cmd, const void *cmddata, void *data);
308void cserve2_font_source_ft_free(void *fontsource);
309void cserve2_font_ft_free(void *fontinfo);
310
311#endif /* _EVAS_CSERVE2_H */
diff --git a/legacy/evas/src/bin/evas_cserve2_cache.c b/legacy/evas/src/bin/evas_cserve2_cache.c
deleted file mode 100644
index 5e7783b583..0000000000
--- a/legacy/evas/src/bin/evas_cserve2_cache.c
+++ /dev/null
@@ -1,2342 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <string.h>
6
7#ifdef DEBUG_LOAD_TIME
8 #include <sys/time.h>
9#endif
10
11#include "evas_cserve2.h"
12#include "evas_cs2_utils.h"
13
14typedef struct _Entry Entry;
15typedef struct _Reference Reference;
16typedef struct _File_Data File_Data;
17typedef struct _Image_Data Image_Data;
18typedef struct _File_Watch File_Watch;
19
20typedef struct _Font_Source Font_Source;
21typedef struct _Font_Entry Font_Entry;
22typedef struct _Font_Cache Font_Cache;
23
24typedef enum {
25 CSERVE2_IMAGE_FILE,
26 CSERVE2_IMAGE_DATA,
27 CSERVE2_FONT_ENTRY
28} Entry_Type;
29
30struct _Entry {
31 unsigned int id;
32 Eina_List *references;
33 Slave_Request *request;
34 Entry_Type type;
35#ifdef DEBUG_LOAD_TIME
36 struct timeval load_start;
37 struct timeval load_finish;
38 int load_time;
39 int saved_time;
40#endif
41};
42
43struct _File_Data {
44 Entry base;
45 char *path;
46 char *key;
47 int w, h;
48 int frame_count;
49 int loop_count;
50 int loop_hint;
51 const char *loader_data;
52 File_Watch *watcher;
53 Eina_List *images;
54 Eina_Bool alpha : 1;
55 Eina_Bool invalid : 1;
56};
57
58// Default values for load options commented below
59struct _Image_Data {
60 Entry base;
61 unsigned int file_id;
62 File_Data *file;
63 struct {
64 double dpi; // dpi < -1
65 int w, h; // w and h < -1
66 int scale_down; // scale_down < -1
67 int rx, ry, rw, rh; // rx, ry, rw, rh < -1
68 Eina_Bool orientation; // orientation == 0
69 } opts;
70 Shm_Handle *shm;
71 Eina_Bool alpha_sparse : 1;
72 Eina_Bool unused : 1;
73 Eina_Bool doload : 1;
74};
75
76struct _Font_Source {
77 const char *key;
78 const char *name;
79 const char *file;
80 int references;
81 void *ft;
82};
83
84struct _Font_Entry {
85 Entry base;
86 unsigned int rend_flags;
87 unsigned int size;
88 unsigned int dpi;
89 Font_Source *src;
90 void *ft;
91 Fash_Glyph2 *glyphs;
92 unsigned int nglyphs;
93 Eina_Inlist *caches;
94 Font_Cache *last_cache;
95 Eina_Bool unused : 1;
96#ifdef DEBUG_LOAD_TIME
97 struct timeval rstart; // start of the glyphs load request
98 struct timeval rfinish; // finish of the glyphs load request
99 int gl_request_time; // time spent to process glyph requests
100 int gl_load_time;
101 int gl_render_time;
102 int gl_slave_time;
103 int gl_saved_time;
104#endif
105};
106
107struct _Font_Cache {
108 EINA_INLIST;
109 Font_Entry *fe;
110 Shm_Handle *shm;
111 unsigned int usage;
112 int inuse;
113 Eina_Inlist *glyphs;
114 unsigned int nglyphs;
115};
116
117struct _Glyph_Entry {
118 EINA_INLIST;
119 Font_Entry *fe;
120 Font_Cache *fc;
121 unsigned int index;
122 unsigned int offset;
123 unsigned int size;
124 unsigned int rows;
125 unsigned int width;
126 unsigned int pitch;
127 unsigned int num_grays;
128 unsigned int pixel_mode;
129};
130
131struct _Glyphs_Request {
132 Client *client;
133 Font_Entry *fe;
134 unsigned int current;
135 unsigned int nglyphs;
136 unsigned int *glyphs;
137 unsigned int nrender;
138 unsigned int *render;
139 unsigned int nanswer;
140 Glyph_Entry **answer;
141 unsigned int hint;
142};
143
144typedef struct _Glyphs_Request Glyphs_Request;
145
146struct _Glyphs_Group {
147 Font_Cache *fc;
148 Eina_List *glyphs;
149};
150
151typedef struct _Glyphs_Group Glyphs_Group;
152
153struct _Reference {
154 Client *client;
155 Entry *entry;
156 unsigned int client_entry_id; // for reverse lookup
157 int count;
158};
159
160struct _File_Watch {
161 const char *path;
162 Eina_List *entries;
163};
164
165static unsigned int _file_id = 0; // id unique number
166static unsigned int _image_id = 0; // id unique number
167static Eina_Hash *file_ids = NULL; // maps path + key --> file_id
168static Eina_Hash *file_entries = NULL; // maps file_id --> entry
169
170static Eina_Hash *image_ids = NULL; // maps file id + load opts --> image id
171static Eina_Hash *image_entries = NULL; // maps image_id --> entry
172
173static Eina_Hash *font_sources = NULL; // font path --> font source
174static Eina_Hash *font_entries = NULL; // maps font path + options --> entry
175
176static Eina_Hash *file_watch = NULL;
177
178static Eina_List *image_entries_lru = NULL;
179
180static Eina_List *font_shm_lru = NULL;
181
182static int max_unused_mem_usage = 5 * 1024; /* in kbytes */
183static int unused_mem_usage = 0;
184static int max_font_usage = 10 * 4 * 1024; /* in kbytes */
185static int font_mem_usage = 0;
186
187#ifdef DEBUG_LOAD_TIME
188static int
189_timeval_sub(const struct timeval *tv2, const struct timeval *tv1)
190{
191 int t1, t2;
192
193 t1 = tv1->tv_usec + tv1->tv_sec * 1000000;
194 t2 = tv2->tv_usec + tv2->tv_sec * 1000000;
195
196 // Make sure that we don't add negative values. Some images may have
197 // been not loaded yet, so it would mess with the stats.
198 if (t2 > t1)
199 return t2 - t1;
200
201 return 0;
202}
203#endif
204
205static inline void
206_entry_load_start(Entry *e)
207{
208#ifdef DEBUG_LOAD_TIME
209 gettimeofday(&e->load_start, NULL);
210#endif
211}
212
213static inline void
214_entry_load_finish(Entry *e)
215{
216#ifdef DEBUG_LOAD_TIME
217 gettimeofday(&e->load_finish, NULL);
218 e->load_time = _timeval_sub(&e->load_finish, &e->load_start);
219#endif
220}
221
222static inline void
223_entry_load_reused(Entry *e)
224{
225#ifdef DEBUG_LOAD_TIME
226 e->saved_time += e->load_time;
227#endif
228}
229
230static Msg_Opened *
231_image_opened_msg_create(File_Data *entry, int *size)
232{
233 Msg_Opened *msg;
234
235 msg = calloc(1, sizeof(*msg));
236 msg->base.type = CSERVE2_OPENED;
237 msg->image.w = entry->w;
238 msg->image.h = entry->h;
239 msg->image.frame_count = entry->frame_count;
240 msg->image.loop_count = entry->loop_count;
241 msg->image.loop_hint = entry->loop_hint;
242 msg->image.alpha = entry->alpha;
243
244 *size = sizeof(*msg);
245
246 return msg;
247}
248
249static void
250_image_opened_send(Client *client, File_Data *entry, unsigned int rid)
251{
252 int size;
253 Msg_Opened *msg;
254
255 DBG("Sending OPENED reply for entry: %d and RID: %d.", entry->base.id, rid);
256 // clear the struct with possible paddings, since it is not aligned.
257
258 msg = _image_opened_msg_create(entry, &size);
259 msg->base.rid = rid;
260
261 cserve2_client_send(client, &size, sizeof(size));
262 cserve2_client_send(client, msg, size);
263
264 free(msg);
265}
266
267static Msg_Loaded *
268_image_loaded_msg_create(Image_Data *entry, int *size)
269{
270 Msg_Loaded *msg;
271 const char *shmpath = cserve2_shm_name_get(entry->shm);
272 int path_len;
273 char *buf;
274
275 path_len = strlen(shmpath) + 1;
276
277 *size = sizeof(*msg) + path_len;
278 msg = calloc(1, *size);
279 msg->base.type = CSERVE2_LOADED;
280
281 msg->shm.mmap_offset = cserve2_shm_map_offset_get(entry->shm);
282 msg->shm.use_offset = cserve2_shm_offset_get(entry->shm);
283 msg->shm.mmap_size = cserve2_shm_map_size_get(entry->shm);
284 msg->shm.image_size = cserve2_shm_size_get(entry->shm);
285 msg->alpha_sparse = entry->alpha_sparse;
286
287 buf = (char *)msg + sizeof(*msg);
288 memcpy(buf, shmpath, path_len);
289
290 return msg;
291}
292
293static void
294_image_loaded_send(Client *client, Image_Data *entry, unsigned int rid)
295{
296 int size;
297 Msg_Loaded *msg;
298
299 DBG("Sending LOADED reply for entry %d and RID: %d.", entry->base.id, rid);
300
301 msg = _image_loaded_msg_create(entry, &size);
302 msg->base.rid = rid;
303
304 cserve2_client_send(client, &size, sizeof(size));
305 cserve2_client_send(client, msg, size);
306
307 free(msg);
308}
309
310static void
311_font_loaded_send(Client *client, unsigned int rid)
312{
313 int size;
314 Msg_Font_Loaded msg;
315
316 DBG("Sending FONT_LOADED reply for RID: %d.", rid);
317
318 size = sizeof(msg);
319 memset(&msg, 0, size);
320 msg.base.rid = rid;
321 msg.base.type = CSERVE2_FONT_LOADED;
322
323 size = sizeof(msg);
324 cserve2_client_send(client, &size, sizeof(size));
325 cserve2_client_send(client, &msg, size);
326}
327
328static void *
329_open_request_build(File_Data *f, int *bufsize)
330{
331 char *buf;
332 int size, pathlen, keylen;
333 Slave_Msg_Image_Open msg;
334
335 pathlen = strlen(f->path) + 1;
336 keylen = strlen(f->key) + 1;
337
338 size = sizeof(msg) + pathlen + keylen;
339 buf = malloc(size);
340 if (!buf) return NULL;
341
342 memset(&msg, 0, sizeof(msg));
343 memcpy(buf, &msg, sizeof(msg));
344 memcpy(buf + sizeof(msg), f->path, pathlen);
345 memcpy(buf + sizeof(msg) + pathlen, f->key, keylen);
346
347 *bufsize = size;
348
349 _entry_load_start(&f->base);
350
351 return buf;
352}
353
354static void
355_request_free(void *msg, void *data __UNUSED__)
356{
357 free(msg);
358}
359
360static Msg_Opened *
361_open_request_response(File_Data *e, Slave_Msg_Image_Opened *resp, int *size)
362{
363 _entry_load_finish(&e->base);
364
365 e->base.request = NULL;
366
367 e->w = resp->w;
368 e->h = resp->h;
369 e->frame_count = resp->frame_count;
370 e->loop_count = resp->loop_count;
371 e->loop_hint = resp->loop_hint;
372 e->alpha = resp->alpha;
373 if (resp->has_loader_data)
374 {
375 const char *ldata = (const char *)resp +
376 sizeof(Slave_Msg_Image_Opened);
377 e->loader_data = eina_stringshare_add(ldata);
378 }
379
380 return _image_opened_msg_create(e, size);
381}
382
383static void
384_request_failed(Entry *e, Error_Type type __UNUSED__)
385{
386 Eina_List *l;
387 Reference *ref;
388
389 e->request = NULL;
390
391 EINA_LIST_FOREACH(e->references, l, ref)
392 {
393 Eina_Hash *hash = NULL;
394 if (e->type == CSERVE2_IMAGE_FILE)
395 hash = ref->client->files.referencing;
396 else if (e->type == CSERVE2_IMAGE_DATA)
397 hash = ref->client->images.referencing;
398 else
399 continue;
400
401 eina_hash_del_by_key(hash, &(ref->client_entry_id));
402 }
403}
404
405static Slave_Request_Funcs _open_funcs = {
406 .msg_create = (Slave_Request_Msg_Create)_open_request_build,
407 .msg_free = _request_free,
408 .response = (Slave_Request_Response)_open_request_response,
409 .error = (Slave_Request_Error)_request_failed
410};
411
412static void *
413_load_request_build(Image_Data *i, int *bufsize)
414{
415 char *buf, *ptr;
416 const char *shmpath;
417 int size;
418 int shmlen, filelen, keylen, loaderlen;
419 Slave_Msg_Image_Load msg;
420
421 // opening shm for this file
422 i->shm = cserve2_shm_request(i->file->w * i->file->h * 4);
423
424 shmpath = cserve2_shm_name_get(i->shm);
425
426 shmlen = strlen(shmpath) + 1;
427 filelen = strlen(i->file->path) + 1;
428 keylen = strlen(i->file->key) + 1;
429 if (i->file->loader_data)
430 loaderlen = strlen(i->file->loader_data) + 1;
431 else
432 loaderlen = 0;
433
434 size = sizeof(msg) + shmlen + filelen + keylen + loaderlen;
435 buf = malloc(size);
436 if (!buf) return NULL;
437
438 memset(&msg, 0, sizeof(msg));
439 msg.w = i->file->w;
440 msg.h = i->file->h;
441 msg.alpha = i->file->alpha;
442 msg.opts.w = i->opts.w;
443 msg.opts.h = i->opts.h;
444 msg.opts.rx = i->opts.rx;
445 msg.opts.ry = i->opts.ry;
446 msg.opts.rw = i->opts.rw;
447 msg.opts.rh = i->opts.rh;
448 msg.opts.scale_down_by = i->opts.scale_down;
449 msg.opts.dpi = i->opts.dpi;
450 msg.opts.orientation = i->opts.orientation;
451
452 msg.shm.mmap_offset = cserve2_shm_map_offset_get(i->shm);
453 msg.shm.image_offset = cserve2_shm_offset_get(i->shm);
454 msg.shm.mmap_size = cserve2_shm_map_size_get(i->shm);
455 msg.shm.image_size = cserve2_shm_size_get(i->shm);
456
457 msg.has_loader_data = !!loaderlen;
458
459 memcpy(buf, &msg, sizeof(msg));
460 ptr = buf + sizeof(msg);
461
462 memcpy(ptr, shmpath, shmlen);
463 ptr += shmlen;
464 memcpy(ptr, i->file->path, filelen);
465 ptr += filelen;
466 memcpy(ptr, i->file->key, keylen);
467 ptr += keylen;
468 memcpy(ptr, i->file->loader_data, loaderlen);
469
470 *bufsize = size;
471
472 _entry_load_start(&i->base);
473
474 return buf;
475}
476
477static Msg_Loaded *
478_load_request_response(Image_Data *e, Slave_Msg_Image_Loaded *resp, int *size)
479{
480 _entry_load_finish(&e->base);
481
482 e->base.request = NULL;
483
484 e->alpha_sparse = resp->alpha_sparse;
485 if (!e->doload)
486 DBG("Entry %d loaded by speculative preload.", e->base.id);
487
488 return _image_loaded_msg_create(e, size);
489}
490
491static Slave_Request_Funcs _load_funcs = {
492 .msg_create = (Slave_Request_Msg_Create)_load_request_build,
493 .msg_free = _request_free,
494 .response = (Slave_Request_Response)_load_request_response,
495 .error = (Slave_Request_Error)_request_failed
496};
497
498static unsigned int
499_img_opts_id_get(Image_Data *im, char *buf, int size)
500{
501 uintptr_t image_id;
502
503 snprintf(buf, size, "%u:%0.3f:%dx%d:%d:%d,%d+%dx%d:%d",
504 im->file_id, im->opts.dpi, im->opts.w, im->opts.h,
505 im->opts.scale_down, im->opts.rx, im->opts.ry,
506 im->opts.rw, im->opts.rh, im->opts.orientation);
507
508 image_id = (uintptr_t)eina_hash_find(image_ids, buf);
509
510 return image_id;
511}
512
513static int
514_image_entry_size_get(Image_Data *e)
515{
516 int size = sizeof(Image_Data);
517 /* XXX: get the overhead of the shm handler too */
518 if (e->shm)
519 size += cserve2_shm_size_get(e->shm);
520 return size / 1024;
521}
522
523static void
524_file_id_free(File_Data *entry)
525{
526 char buf[4096];
527
528 DBG("Removing entry file id: %d, file: \"%s:%s\"",
529 entry->base.id, entry->path, entry->key);
530 snprintf(buf, sizeof(buf), "%s:%s", entry->path, entry->key);
531 eina_hash_del_by_key(file_ids, buf);
532}
533
534static void
535_image_id_free(Image_Data *entry)
536{
537 char buf[4096];
538
539 DBG("Removing entry image id: %d", entry->base.id);
540
541 _img_opts_id_get(entry, buf, sizeof(buf));
542 eina_hash_del_by_key(image_ids, buf);
543}
544
545static void
546_image_entry_free(Image_Data *entry)
547{
548 File_Data *fentry = entry->file;
549
550 if (entry->base.request)
551 cserve2_request_cancel_all(entry->base.request, CSERVE2_REQUEST_CANCEL);
552
553 if (entry->unused)
554 {
555 image_entries_lru = eina_list_remove(image_entries_lru, entry);
556 unused_mem_usage -= _image_entry_size_get(entry);
557 }
558
559 if (fentry)
560 {
561 fentry->images = eina_list_remove(fentry->images, entry);
562 if (!fentry->images && !fentry->base.references)
563 eina_hash_del_by_key(file_entries, &fentry->base.id);
564 }
565 if (entry->shm)
566 cserve2_shm_unref(entry->shm);
567 free(entry);
568}
569
570static void
571_hash_image_entry_free(void *data)
572{
573 Image_Data *entry = data;
574
575 _image_id_free(entry);
576 _image_entry_free(entry);
577}
578
579static void
580_file_entry_free(File_Data *entry)
581{
582 File_Watch *fw;
583
584 // Should we call free for each of the images too?
585 // If everything goes fine, it's not necessary.
586 if (entry->images)
587 {
588 ERR("Freeing file %d (\"%s:%s\") image data still referenced.",
589 entry->base.id, entry->path, entry->key);
590 eina_list_free(entry->images);
591 }
592
593 if (entry->base.request)
594 cserve2_request_cancel_all(entry->base.request, CSERVE2_REQUEST_CANCEL);
595
596 if ((fw = entry->watcher))
597 {
598 fw->entries = eina_list_remove(fw->entries, entry);
599 if (!fw->entries)
600 eina_hash_del_by_key(file_watch, fw->path);
601 }
602
603 free(entry->key);
604 free(entry->path);
605 eina_stringshare_del(entry->loader_data);
606 free(entry);
607}
608
609static void
610_hash_file_entry_free(void *data)
611{
612 File_Data *entry = data;
613 // TODO: Add some checks to make sure that we are freeing an
614 // unused entry.
615
616 _file_id_free(entry);
617 _file_entry_free(entry);
618}
619
620static void
621_file_watch_free(void *data)
622{
623 File_Watch *fw = data;
624 cserve2_file_change_watch_del(fw->path);
625 eina_stringshare_del(fw->path);
626 eina_list_free(fw->entries);
627 free(fw);
628}
629
630static int
631_font_entry_cmp(const Font_Entry *k1, int k1_length __UNUSED__, const Font_Entry *k2, int k2_length __UNUSED__)
632{
633 if (k1->src->key == k2->src->key)
634 {
635 if (k1->size == k2->size)
636 {
637 if (k1->rend_flags == k2->rend_flags)
638 return k1->dpi - k2->dpi;
639 return k1->rend_flags - k2->rend_flags;
640 }
641 return k1->size - k2->size;
642 }
643 return strcmp(k1->src->key, k2->src->key);
644}
645
646static int
647_font_entry_key_hash(const Font_Entry *key, int key_length __UNUSED__)
648{
649 int hash;
650 hash = eina_hash_djb2(key->src->key, eina_stringshare_strlen(key->src->key) + 1);
651 hash ^= eina_hash_int32(&key->rend_flags, sizeof(int));
652 hash ^= eina_hash_int32(&key->size, sizeof(int));
653 hash ^= eina_hash_int32(&key->dpi, sizeof(int));
654
655 return hash;
656}
657
658static void
659_font_entry_free(Font_Entry *fe)
660{
661 fash_gl_free(fe->glyphs);
662 fe->src->references--;
663 if (fe->ft) cserve2_font_ft_free(fe->ft);
664 if (fe->src->references <= 0)
665 eina_hash_del_by_key(font_sources, fe->src->key);
666 free(fe);
667}
668
669static void
670_glyph_free_cb(void *data)
671{
672 Glyph_Entry *gl = data;
673 free(gl);
674}
675
676static void
677_font_source_free(Font_Source *fs)
678{
679 eina_stringshare_del(fs->key);
680 eina_stringshare_del(fs->name);
681 eina_stringshare_del(fs->file);
682 if (fs->ft) cserve2_font_source_ft_free(fs->ft);
683
684 free(fs);
685}
686
687static void
688_font_shm_promote(Font_Cache *fc)
689{
690 Eina_List *l;
691 l = eina_list_data_find_list(font_shm_lru, fc);
692 font_shm_lru = eina_list_demote_list(font_shm_lru, l);
693}
694
695static int
696_font_shm_size_get(Font_Cache *fc)
697{
698 int size;
699
700 size = sizeof(*fc) + cserve2_shm_size_get(fc->shm);
701
702 return size;
703}
704
705static void
706_font_shm_free(Font_Cache *fc)
707{
708 Font_Entry *fe = fc->fe;
709 fe->caches = eina_inlist_remove(fe->caches, EINA_INLIST_GET(fc));
710 if (fc == fe->last_cache)
711 fe->last_cache = NULL;
712
713 while (fc->glyphs)
714 {
715 Glyph_Entry *gl = EINA_INLIST_CONTAINER_GET(fc->glyphs, Glyph_Entry);
716 fc->glyphs = eina_inlist_remove(fc->glyphs, fc->glyphs);
717 fash_gl_del(fe->glyphs, gl->index);
718 }
719
720 cserve2_shm_unref(fc->shm);
721 free(fc);
722
723 if (!fe->caches)
724 eina_hash_del_by_key(font_entries, fe);
725}
726
727static void
728_font_shm_lru_flush(void)
729{
730 Eina_List *l, *l_next;
731
732 l = font_shm_lru;
733 l_next = eina_list_next(l);
734
735 while (l && font_mem_usage > max_font_usage)
736 {
737 int size;
738 Font_Cache *fc;
739
740 fc = eina_list_data_get(l);
741 if (fc->fe->unused && fc->inuse == 0)
742 {
743 font_shm_lru = eina_list_remove_list(font_shm_lru, l);
744 size = _font_shm_size_get(fc);
745 size += fc->nglyphs * sizeof(Glyph_Entry);
746 _font_shm_free(fc);
747 font_mem_usage -= size;
748 }
749
750 l = l_next;
751 l_next = eina_list_next(l);
752 }
753}
754
755void
756cserve2_cache_init(void)
757{
758 file_ids = eina_hash_string_superfast_new(NULL);
759 file_entries = eina_hash_int32_new(_hash_file_entry_free);
760 image_ids = eina_hash_string_superfast_new(NULL);
761 image_entries = eina_hash_string_superfast_new(_hash_image_entry_free);
762 file_watch = eina_hash_string_superfast_new(_file_watch_free);
763
764 font_sources = eina_hash_string_small_new(EINA_FREE_CB(_font_source_free));
765 font_entries = eina_hash_new(NULL,
766 EINA_KEY_CMP(_font_entry_cmp),
767 EINA_KEY_HASH(_font_entry_key_hash),
768 EINA_FREE_CB(_font_entry_free),
769 5);
770}
771
772void
773cserve2_cache_shutdown(void)
774{
775 Font_Cache *fc;
776
777 EINA_LIST_FREE(font_shm_lru, fc)
778 _font_shm_free(fc);
779
780 eina_hash_free(image_entries);
781 eina_hash_free(image_ids);
782 eina_hash_free(file_entries);
783 eina_hash_free(file_ids);
784 eina_hash_free(file_watch);
785
786 eina_hash_free(font_entries);
787 eina_hash_free(font_sources);
788}
789
790static Reference *
791_entry_reference_add(Entry *entry, Client *client, unsigned int client_entry_id)
792{
793 Reference *ref;
794
795 // increase reference for this file
796 ref = malloc(sizeof(*ref));
797 ref->client = client;
798 ref->entry = entry;
799 ref->client_entry_id = client_entry_id;
800 ref->count = 1;
801 entry->references = eina_list_append(entry->references, ref);
802
803 return ref;
804}
805
806static void
807_entry_unused_push(Image_Data *e)
808{
809 int size = _image_entry_size_get(e);
810
811 if ((size > max_unused_mem_usage) || !(e->doload))
812 {
813 eina_hash_del_by_key(image_entries, &e->base.id);
814 return;
815 }
816 while (size > (max_unused_mem_usage - unused_mem_usage))
817 {
818 Entry *ie = eina_list_data_get(eina_list_last(image_entries_lru));
819 eina_hash_del_by_key(image_entries, &ie->id);
820 }
821 image_entries_lru = eina_list_append(image_entries_lru, e);
822 e->unused = EINA_TRUE;
823 unused_mem_usage += size;
824}
825
826static void
827_entry_reference_del(Entry *entry, Reference *ref)
828{
829 entry->references = eina_list_remove(entry->references, ref);
830
831 if (entry->references)
832 goto free_ref;
833
834 if (entry->type == CSERVE2_IMAGE_FILE)
835 {
836 File_Data *fentry = (File_Data *)entry;
837
838 if (fentry->invalid)
839 _file_entry_free(fentry);
840 else if (!fentry->images)
841 eina_hash_del_by_key(file_entries, &entry->id);
842 /* don't free file entries that have images attached to it, they will
843 * be freed when the last unused image is freed */
844 }
845 else if (entry->type == CSERVE2_IMAGE_DATA)
846 {
847 Image_Data *ientry = (Image_Data *)entry;
848
849 if (!ientry->file)
850 eina_hash_del_by_key(image_entries, &entry->id);
851 else if (ientry->file->invalid)
852 _image_entry_free(ientry);
853 else
854 _entry_unused_push(ientry);
855 }
856 else if (entry->type == CSERVE2_FONT_ENTRY)
857 {
858 Font_Entry *fe = (Font_Entry *)entry;
859 fe->unused = EINA_TRUE;
860 if (!fe->caches)
861 eina_hash_del_by_key(font_entries, fe);
862 }
863 else
864 ERR("Wrong type of entry.");
865
866free_ref:
867 free(ref);
868}
869
870static void
871_entry_free_cb(void *data)
872{
873 Reference *ref = data;
874 Entry *entry;
875
876 DBG("Removing client reference for entry id: %d, client: %d",
877 ref->entry->id, ref->client->id);
878
879 entry = ref->entry;
880
881 /* XXX: handle the case of requests being processed gracefully */
882 if (entry->request /*&& !entry->request->processing*/)
883 {
884 if (entry->type == CSERVE2_IMAGE_FILE)
885 cserve2_request_cancel(entry->request, ref->client,
886 CSERVE2_REQUEST_CANCEL);
887 else if (entry->type == CSERVE2_IMAGE_DATA)
888 cserve2_request_cancel(entry->request, ref->client,
889 CSERVE2_REQUEST_CANCEL);
890 }
891
892 _entry_reference_del(entry, ref);
893}
894
895static void
896_font_entry_reference_del(Client *client, Font_Entry *fe)
897{
898 Eina_List *l;
899 Reference *ref;
900
901 EINA_LIST_FOREACH(client->fonts.referencing, l, ref)
902 {
903 if (ref->entry == (Entry *)fe)
904 {
905 ref->count--;
906 if (ref->count > 0)
907 break;
908
909 client->fonts.referencing = eina_list_remove_list(
910 client->fonts.referencing, l);
911 _entry_reference_del(&fe->base, ref);
912 return;
913 }
914 }
915}
916
917void
918cserve2_cache_client_new(Client *client)
919{
920 client->files.referencing = eina_hash_int32_new(_entry_free_cb);
921 client->images.referencing = eina_hash_int32_new(_entry_free_cb);
922 client->fonts.referencing = NULL;
923}
924
925void
926cserve2_cache_client_del(Client *client)
927{
928 Reference *ref;
929
930 // will call _entry_free_cb() for every entry
931 eina_hash_free(client->images.referencing);
932 // will call _entry_free_cb() for every entry
933 eina_hash_free(client->files.referencing);
934
935 EINA_LIST_FREE(client->fonts.referencing, ref)
936 {
937 _entry_reference_del(ref->entry, ref);
938 }
939}
940
941static Image_Data *
942_image_msg_new(Client *client, Msg_Setopts *msg)
943{
944 Reference *ref;
945 Image_Data *im_entry;
946
947 ref = eina_hash_find(client->files.referencing, &msg->file_id);
948 if (!ref)
949 {
950 ERR("Couldn't find file id: %d, for image id: %d",
951 msg->file_id, msg->image_id);
952 cserve2_client_error_send(client, msg->base.rid,
953 CSERVE2_INVALID_CACHE);
954 return NULL;
955 }
956 if (((File_Data *)ref->entry)->invalid)
957 {
958 cserve2_client_error_send(client, msg->base.rid,
959 CSERVE2_FILE_CHANGED);
960 return NULL;
961 }
962
963 im_entry = calloc(1, sizeof(*im_entry));
964 im_entry->base.type = CSERVE2_IMAGE_DATA;
965 im_entry->file_id = ref->entry->id;
966 im_entry->file = (File_Data *)ref->entry;
967 im_entry->opts.dpi = msg->opts.dpi;
968 im_entry->opts.w = msg->opts.w;
969 im_entry->opts.h = msg->opts.h;
970 im_entry->opts.scale_down = msg->opts.scale_down;
971 im_entry->opts.rx = msg->opts.rx;
972 im_entry->opts.ry = msg->opts.ry;
973 im_entry->opts.rw = msg->opts.rw;
974 im_entry->opts.rh = msg->opts.rh;
975 im_entry->opts.orientation = msg->opts.orientation;
976
977 return im_entry;
978}
979
980static void
981_file_changed_cb(const char *path __UNUSED__, Eina_Bool deleted __UNUSED__, void *data)
982{
983 File_Watch *fw = data;
984 File_Data *e;
985 Eina_List *l;
986
987 EINA_LIST_FOREACH(fw->entries, l, e)
988 {
989 Eina_List *ll;
990 Image_Data *ie;
991
992 e->invalid = EINA_TRUE;
993 e->watcher = NULL;
994
995 EINA_LIST_FOREACH(e->images, ll, ie)
996 {
997 _image_id_free(ie);
998 eina_hash_set(image_entries, &ie->base.id, NULL);
999 if (ie->base.request /*&& !ie->base.request->processing*/)
1000 cserve2_request_cancel_all(ie->base.request,
1001 CSERVE2_FILE_CHANGED);
1002 ie->base.request = NULL;
1003 if (ie->unused)
1004 _image_entry_free(ie);
1005 }
1006
1007 _file_id_free(e);
1008 eina_hash_set(file_entries, &e->base.id, NULL);
1009 if (e->base.request /*&& !e->base.request->processing*/)
1010 cserve2_request_cancel_all(e->base.request, CSERVE2_FILE_CHANGED);
1011 e->base.request = NULL;
1012 if (!e->images && !e->base.references)
1013 _file_entry_free(e);
1014 }
1015
1016 eina_hash_del_by_key(file_watch, fw->path);
1017}
1018
1019static Font_Source *
1020_cserve2_font_source_find(const char *name)
1021{
1022 Font_Source *fs;
1023
1024 fs = eina_hash_find(font_sources, name);
1025
1026 return fs;
1027}
1028
1029static Font_Entry *
1030_cserve2_font_entry_find(const char *name, unsigned int namelen, unsigned int size, unsigned int rend_flags, unsigned int dpi)
1031{
1032 Font_Entry tmp_fe;
1033 Font_Source tmp_fs;
1034 Font_Entry *fe;
1035
1036 tmp_fs.key = eina_stringshare_add_length(name, namelen);
1037 tmp_fe.src = &tmp_fs;
1038 tmp_fe.size = size;
1039 tmp_fe.rend_flags = rend_flags;
1040 tmp_fe.dpi = dpi;
1041
1042 fe = eina_hash_find(font_entries, &tmp_fe);
1043 eina_stringshare_del(tmp_fs.key);
1044
1045 return fe;
1046}
1047
1048static void *
1049_font_load_request_build(void *data, int *size)
1050{
1051 Font_Entry *fe = data;
1052 Slave_Msg_Font_Load *msg = calloc(1, sizeof(*msg));
1053
1054 msg->ftdata1 = fe->src->ft;
1055 msg->ftdata2 = fe->ft;
1056 msg->rend_flags = fe->rend_flags;
1057 msg->size = fe->size;
1058 msg->dpi = fe->dpi;
1059 msg->name = fe->src->name;
1060 msg->file = fe->src->file;
1061
1062 *size = 0;
1063
1064 _entry_load_start(&fe->base);
1065
1066 return msg;
1067}
1068
1069static void
1070_font_load_request_free(void *msg, void *data __UNUSED__)
1071{
1072 free(msg);
1073}
1074
1075static Msg_Font_Loaded *
1076_font_load_request_response(Font_Entry *fe, Slave_Msg_Font_Loaded *msg, int *size)
1077{
1078 Msg_Font_Loaded *resp;
1079
1080 if (!fe->src->ft)
1081 fe->src->ft = msg->ftdata1;
1082
1083 if (!fe->ft)
1084 {
1085 fe->ft = msg->ftdata2;
1086 _entry_load_finish(&fe->base);
1087 }
1088
1089 if (fe->base.request) fe->base.request = NULL;
1090
1091 /* could be a function, but it's too basic and only used here */
1092 resp = calloc(1, sizeof(*resp));
1093 resp->base.type = CSERVE2_FONT_LOADED;
1094 *size = sizeof(*resp);
1095
1096 return resp;
1097}
1098
1099static void
1100_font_load_request_failed(Font_Entry *fe, Error_Type error __UNUSED__)
1101{
1102 Eina_List *l;
1103 Reference *ref;
1104
1105 if (fe->base.request) fe->base.request = NULL;
1106
1107 EINA_LIST_FOREACH(fe->base.references, l, ref)
1108 _font_entry_reference_del(ref->client, fe);
1109}
1110
1111static Slave_Request_Funcs _font_load_funcs = {
1112 .msg_create = (Slave_Request_Msg_Create)_font_load_request_build,
1113 .msg_free = (Slave_Request_Msg_Free)_font_load_request_free,
1114 .response = (Slave_Request_Response)_font_load_request_response,
1115 .error = (Slave_Request_Error)_font_load_request_failed
1116};
1117
1118static Eina_Bool
1119_glyphs_request_check(Glyphs_Request *req, Eina_Bool report_load)
1120{
1121 unsigned int i;
1122 Font_Entry *fe = req->fe;
1123
1124 req->answer = malloc(sizeof(*req->answer) * req->nglyphs);
1125 req->nanswer = 0;
1126
1127 for (i = req->current; i < req->nglyphs; i++)
1128 {
1129 Glyph_Entry *ge;
1130 ge = fash_gl_find(fe->glyphs, req->glyphs[i]);
1131 if (ge)
1132 {
1133 req->answer[req->nanswer++] = ge;
1134#ifdef DEBUG_LOAD_TIME
1135 // calculate average time saved when loading glyphs
1136 if (report_load)
1137 fe->gl_saved_time +=
1138 (fe->gl_load_time / fe->nglyphs);
1139#endif
1140 ge->fc->inuse++;
1141 }
1142 else
1143 break;
1144 }
1145
1146 req->current = i;
1147
1148 // No glyphs need to be rendered.
1149 return (req->nanswer == req->nglyphs);
1150}
1151
1152/* organize answer (cache1{gl1, gl2,}, cache2{gl3,gl4,gl5}, cache3{gl6})
1153 */
1154static Eina_List *
1155_glyphs_group_create(Glyphs_Request *req)
1156{
1157 Eina_List *groups = NULL;
1158 unsigned int i;
1159
1160 for (i = 0; i < req->nanswer; i++)
1161 {
1162 Eina_List *l;
1163 Glyphs_Group *iter, *gg = NULL;
1164 Font_Cache *fc = req->answer[i]->fc;
1165
1166 EINA_LIST_FOREACH(groups, l, iter)
1167 {
1168 if (iter->fc == fc)
1169 {
1170 gg = iter;
1171 break;
1172 }
1173 }
1174
1175 if (!gg)
1176 {
1177 gg = calloc(1, sizeof(*gg));
1178 gg->fc = fc;
1179 groups = eina_list_append(groups, gg);
1180 }
1181 gg->glyphs = eina_list_append(gg->glyphs, req->answer[i]);
1182 }
1183
1184 return groups;
1185}
1186
1187static Msg_Font_Glyphs_Loaded *
1188_glyphs_loaded_msg_create(Glyphs_Request *req, int *resp_size)
1189{
1190 Msg_Font_Glyphs_Loaded msg;
1191 unsigned int size;
1192 Eina_List *ll, *answers = NULL;
1193 const char *shmname;
1194 unsigned int shmsize;
1195 unsigned int intsize;
1196 char *resp, *buf;
1197 Glyphs_Group *iter;
1198
1199 memset(&msg, 0, sizeof(msg));
1200 msg.base.type = CSERVE2_FONT_GLYPHS_LOADED;
1201
1202 answers = _glyphs_group_create(req);
1203 msg.ncaches = eina_list_count(answers);
1204 size = sizeof(msg);
1205
1206 // calculate size of message
1207 // ncaches * sizeof(cache) + nglyphs1 * sizeof(glyph) +
1208 // nglyphs2 * sizeof(glyph)...
1209
1210 intsize = sizeof(unsigned int);
1211
1212 EINA_LIST_FOREACH(answers, ll, iter)
1213 {
1214 shmname = cserve2_shm_name_get(iter->fc->shm);
1215 shmsize = eina_stringshare_strlen(shmname) + 1;
1216 // shm namelen + name
1217 size += intsize + shmsize;
1218
1219 // nglyphs
1220 size += intsize;
1221 // nglyphs * (index + offset + size + rows + width + pitch +
1222 // num_grays + pixel_mode)
1223 size += eina_list_count(iter->glyphs) * 8 * intsize;
1224 }
1225
1226 resp = malloc(size);
1227 memcpy(resp, &msg, sizeof(msg));
1228 buf = resp + sizeof(msg);
1229
1230 EINA_LIST_FREE(answers, iter)
1231 {
1232 Glyph_Entry *gl;
1233 unsigned int nglyphs;
1234
1235 shmname = cserve2_shm_name_get(iter->fc->shm);
1236 shmsize = eina_stringshare_strlen(shmname) + 1;
1237 memcpy(buf, &shmsize, intsize);
1238 buf += intsize;
1239 memcpy(buf, shmname, shmsize);
1240 buf += shmsize;
1241
1242 nglyphs = eina_list_count(iter->glyphs);
1243 memcpy(buf, &nglyphs, intsize);
1244 buf += intsize;
1245
1246 iter->fc->inuse -= eina_list_count(iter->glyphs);
1247
1248 EINA_LIST_FREE(iter->glyphs, gl)
1249 {
1250 memcpy(buf, &gl->index, intsize);
1251 buf += intsize;
1252 memcpy(buf, &gl->offset, intsize);
1253 buf += intsize;
1254 memcpy(buf, &gl->size, intsize);
1255 buf += intsize;
1256 memcpy(buf, &gl->rows, intsize);
1257 buf += intsize;
1258 memcpy(buf, &gl->width, intsize);
1259 buf += intsize;
1260 memcpy(buf, &gl->pitch, intsize);
1261 buf += intsize;
1262 memcpy(buf, &gl->num_grays, intsize);
1263 buf += intsize;
1264 memcpy(buf, &gl->pixel_mode, intsize);
1265 buf += intsize;
1266 }
1267
1268 /* We are removing SHMs from the beginning of the list, so this
1269 * gives a higher priority to them */
1270 _font_shm_promote(iter->fc);
1271 eina_list_free(iter->glyphs);
1272 free(iter);
1273 }
1274
1275 *resp_size = size;
1276
1277 return (Msg_Font_Glyphs_Loaded *)resp;
1278}
1279
1280static void
1281_glyphs_loaded_send(Glyphs_Request *req, unsigned int rid)
1282{
1283 Msg_Font_Glyphs_Loaded *resp;
1284 int size;
1285
1286 resp = _glyphs_loaded_msg_create(req, &size);
1287 resp->base.rid = rid;
1288
1289 cserve2_client_send(req->client, &size, sizeof(size));
1290 cserve2_client_send(req->client, resp, size);
1291
1292 free(resp);
1293}
1294
1295/*
1296 * taken from evas_path.c. It would be good to clean up those utils to
1297 * have cserve link against them easily without dragging unneeded dependencies
1298 */
1299#ifdef _WIN32
1300# define EVAS_PATH_SEPARATOR "\\"
1301#else
1302# define EVAS_PATH_SEPARATOR "/"
1303#endif
1304
1305static char *
1306_file_path_join(const char *path, const char *end)
1307{
1308 char *res = NULL;
1309 size_t len;
1310
1311 if ((!path) && (!end)) return NULL;
1312 if (!path) return strdup(end);
1313 if (!end) return strdup(path);
1314 len = strlen(path);
1315 len += strlen(end);
1316 len += strlen(EVAS_PATH_SEPARATOR);
1317 res = malloc(len + 1);
1318 if (!res) return NULL;
1319 strcpy(res, path);
1320 strcat(res, EVAS_PATH_SEPARATOR);
1321 strcat(res, end);
1322 return res;
1323}
1324
1325static Glyphs_Request *
1326_glyphs_request_create(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int hint, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int *glyphs, unsigned int nglyphs)
1327{
1328 char *fullname;
1329 Glyphs_Request *req = calloc(1, sizeof(*req));
1330
1331 if (sourcelen == 0)
1332 source = NULL;
1333 if (namelen == 0)
1334 name = NULL;
1335
1336 fullname = _file_path_join(source, name);
1337 req->fe = _cserve2_font_entry_find(fullname, strlen(fullname) + 1, size,
1338 rend_flags, dpi);
1339 free(fullname);
1340 if (!req->fe)
1341 {
1342 ERR("No font entry found: source %s, name %s, rendflags: %d, hint: %d,"
1343 " size: %d, dpi: %d", source, name, rend_flags, hint, size, dpi);
1344 free(req);
1345 return NULL;
1346 }
1347
1348 req->client = client;
1349
1350 req->nglyphs = nglyphs;
1351 req->current = 0;
1352 req->glyphs = glyphs;
1353 req->hint = hint;
1354
1355 return req;
1356}
1357
1358static void
1359_glyphs_request_free(Glyphs_Request *req)
1360{
1361 free(req->glyphs);
1362 free(req->render);
1363 free(req->answer);
1364 free(req);
1365}
1366
1367/* add glyphs that are already in cache to the "answers" array, and the ones
1368 * that are not cached to the "render" array.
1369 */
1370static void
1371_glyphs_load_request_prepare(Glyphs_Request *req)
1372{
1373 unsigned int i, max;
1374 req->nrender = 0;
1375 Font_Entry *fe = req->fe;
1376
1377 if (!fe)
1378 {
1379 ERR("No font entry for this request.");
1380 return;
1381 }
1382
1383 // Won't render more than this number of glyphs
1384 max = req->nglyphs - req->nanswer;
1385 req->render = malloc(sizeof(*req->render) * max);
1386
1387 for (i = req->current; i < req->nglyphs; i++)
1388 {
1389 Glyph_Entry *ge;
1390 ge = fash_gl_find(fe->glyphs, req->glyphs[i]);
1391 if (ge)
1392 {
1393 req->answer[req->nanswer++] = ge;
1394
1395#ifdef DEBUG_LOAD_TIME
1396 // calculate average time saved when loading glyphs
1397 fe->gl_saved_time +=
1398 (fe->gl_load_time / fe->nglyphs);
1399#endif
1400 ge->fc->inuse++;
1401 }
1402 else
1403 req->render[req->nrender++] = req->glyphs[i];
1404 }
1405}
1406
1407static void *
1408_glyphs_load_request_build(void *data, int *size __UNUSED__)
1409{
1410 Glyphs_Request *req = data;
1411 Slave_Msg_Font_Glyphs_Load *msg = NULL;
1412 Font_Entry *fe = req->fe;
1413 Font_Cache *fc;
1414
1415#ifdef DEBUG_LOAD_TIME
1416 gettimeofday(&fe->rstart, NULL);
1417 _glyphs_load_request_prepare(req);
1418#endif
1419
1420 msg = calloc(1, sizeof(*msg));
1421
1422 msg->font.ftdata1 = fe->src->ft;
1423 msg->font.ftdata2 = fe->ft;
1424 msg->font.hint = req->hint;
1425 msg->font.rend_flags = fe->rend_flags;
1426 msg->glyphs.nglyphs = req->nrender;
1427 msg->glyphs.glyphs = req->render;
1428
1429 // Trying to reuse last filled cache.
1430 fc = fe->last_cache;
1431 if (fc)
1432 {
1433 msg->cache.shm = fc->shm;
1434 msg->cache.usage = fc->usage;
1435 msg->cache.nglyphs = fc->nglyphs;
1436 }
1437
1438 return msg;
1439}
1440
1441static void
1442_glyphs_load_request_free(void *msg, void *data)
1443{
1444 _glyphs_request_free(data);
1445 free(msg);
1446}
1447
1448static Msg_Font_Glyphs_Loaded *
1449_glyphs_load_request_response(Glyphs_Request *req, Slave_Msg_Font_Glyphs_Loaded *msg, int *size)
1450{
1451 Font_Entry *fe = req->fe;
1452 Font_Cache *fc = NULL;
1453 unsigned int i = 0;
1454
1455 if (fe->last_cache && fe->last_cache->shm == msg->caches[0]->shm)
1456 fc = fe->last_cache;
1457
1458 while (i < msg->ncaches)
1459 {
1460 unsigned int j;
1461 Slave_Msg_Font_Cache *c = msg->caches[i++];
1462
1463 if (!fc)
1464 {
1465 fc = malloc(sizeof(*fc));
1466 fe->caches = eina_inlist_append(fe->caches, EINA_INLIST_GET(fc));
1467 fe->last_cache = fc;
1468 fc->fe = fe;
1469 fc->shm = c->shm;
1470 fc->glyphs = NULL;
1471 fc->nglyphs = 0;
1472 fc->inuse = 0;
1473 font_shm_lru = eina_list_append(font_shm_lru, fc);
1474 font_mem_usage += _font_shm_size_get(fc);
1475 }
1476 fc->usage = c->usage;
1477 for (j = 0; j < c->nglyphs; j++)
1478 {
1479 Glyph_Entry *gl = malloc(sizeof(*gl));
1480 gl->fe = fe;
1481 gl->fc = fc;
1482 gl->index = c->glyphs[j].index;
1483 gl->offset = c->glyphs[j].offset;
1484 gl->size = c->glyphs[j].size;
1485 gl->rows = c->glyphs[j].rows;
1486 gl->width = c->glyphs[j].width;
1487 gl->pitch = c->glyphs[j].pitch;
1488 gl->num_grays = c->glyphs[j].num_grays;
1489 gl->pixel_mode = c->glyphs[j].pixel_mode;
1490 font_mem_usage += sizeof(*gl);
1491 fc->glyphs = eina_inlist_append(fc->glyphs, EINA_INLIST_GET(gl));
1492 fc->nglyphs++;
1493 fe->nglyphs++;
1494 fash_gl_add(fe->glyphs, gl->index, gl);
1495 req->answer[req->nanswer++] = gl;
1496 gl->fc->inuse++;
1497 }
1498
1499 free(c); // FIXME: We are freeing this here because we only do a
1500 // simple free on the response message. Later we need to
1501 // setup a free callback for the slave response.
1502 fc = NULL;
1503 }
1504
1505#ifdef DEBUG_LOAD_TIME
1506 gettimeofday(&fe->rfinish, NULL);
1507 fe->gl_request_time += _timeval_sub(&fe->rfinish, &fe->rstart);
1508 fe->gl_load_time += msg->gl_load_time;
1509 fe->gl_render_time += msg->gl_render_time;
1510 fe->gl_slave_time += msg->gl_slave_time;
1511#endif
1512
1513 _font_shm_lru_flush();
1514
1515 return _glyphs_loaded_msg_create(req, size);
1516}
1517
1518static void
1519_glyphs_load_request_failed(void *data __UNUSED__, Error_Type error __UNUSED__)
1520{
1521}
1522
1523static Slave_Request_Funcs _glyphs_load_funcs = {
1524 .msg_create = (Slave_Request_Msg_Create)_glyphs_load_request_build,
1525 .msg_free = (Slave_Request_Msg_Free)_glyphs_load_request_free,
1526 .response = (Slave_Request_Response)_glyphs_load_request_response,
1527 .error = (Slave_Request_Error)_glyphs_load_request_failed
1528};
1529
1530static Eina_Bool
1531_font_entry_stats_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
1532{
1533 Font_Entry *fe = data;
1534 Msg_Stats *msg = fdata;
1535 Font_Cache *fc;
1536 int nrefs = eina_list_count(fe->base.references);
1537
1538 msg->fonts.fonts_loaded++;
1539 if (fe->unused) msg->fonts.fonts_unused++;
1540
1541 // accounting size
1542 EINA_INLIST_FOREACH(fe->caches, fc)
1543 {
1544 unsigned int fc_usage, shmsize;
1545 /* This is not real requested usage, but an approximation. We don't
1546 * know how many times each glyph would be used by each client, but
1547 * assume that a similar set of glyphs from a given font would be used
1548 * by each client, thus counting them one time per client referencing
1549 * them.
1550 */
1551 fc_usage = fc->usage * nrefs;
1552 shmsize = cserve2_shm_size_get(fc->shm);
1553
1554 msg->fonts.requested_size += fc_usage;
1555 msg->fonts.real_size += shmsize;
1556 if (fe->unused) msg->fonts.unused_size += shmsize;
1557 }
1558
1559#ifdef DEBUG_LOAD_TIME
1560 // accounting fonts load time
1561 msg->fonts.fonts_load_time += fe->base.load_time;
1562 if (fe->caches)
1563 {
1564 msg->fonts.fonts_used_load_time += fe->base.load_time;
1565 msg->fonts.fonts_used_saved_time += fe->base.saved_time;
1566 }
1567
1568 // accounting glyphs load time
1569 msg->fonts.glyphs_load_time += fe->gl_load_time;
1570 msg->fonts.glyphs_render_time += fe->gl_render_time;
1571 msg->fonts.glyphs_saved_time += fe->gl_saved_time;
1572 msg->fonts.glyphs_request_time += fe->gl_request_time;
1573 msg->fonts.glyphs_slave_time += fe->gl_slave_time;
1574#endif
1575
1576 return EINA_TRUE;
1577}
1578
1579static Eina_Bool
1580_image_file_entry_stats_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
1581{
1582 Msg_Stats *msg = fdata;
1583 File_Data *fd = data;
1584
1585 // accounting numbers
1586 msg->images.files_loaded++;
1587
1588 // accounting size
1589 msg->images.files_size += sizeof(File_Data) +
1590 eina_list_count(fd->images) * sizeof(Eina_List *) +
1591 eina_list_count(fd->base.references) *
1592 (sizeof(Slave_Request *) + sizeof(Eina_List *));
1593
1594#ifdef DEBUG_LOAD_TIME
1595 // accounting file entries load time
1596 msg->images.files_load_time += fd->base.load_time;
1597 msg->images.files_saved_time += fd->base.saved_time;
1598#endif
1599
1600 return EINA_TRUE;
1601}
1602
1603static Eina_Bool
1604_image_data_entry_stats_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
1605{
1606 Msg_Stats *msg = fdata;
1607 Image_Data *id = data;
1608 unsigned int image_size;
1609
1610 // accounting numbers
1611 msg->images.images_loaded++;
1612 if (id->unused) msg->images.images_unused++;
1613
1614 // accounting size
1615 msg->images.images_size += _image_entry_size_get(id) * 1024;
1616 if (id->unused) msg->images.unused_size += _image_entry_size_get(id) * 1024;
1617
1618 image_size = id->file->w * id->file->h * 4;
1619 msg->images.requested_size +=
1620 (image_size * eina_list_count(id->base.references));
1621
1622#ifdef DEBUG_LOAD_TIME
1623 // accounting image entries load time
1624 msg->images.images_load_time += id->base.load_time;
1625 msg->images.images_saved_time += id->base.saved_time;
1626#endif
1627
1628 return EINA_TRUE;
1629}
1630
1631static void
1632_cserve2_cache_image_stats_get(Msg_Stats *msg)
1633{
1634 eina_hash_foreach(file_entries, _image_file_entry_stats_cb, msg);
1635 eina_hash_foreach(image_entries, _image_data_entry_stats_cb, msg);
1636}
1637
1638static void
1639_cserve2_cache_font_stats_get(Msg_Stats *msg)
1640{
1641 eina_hash_foreach(font_entries, _font_entry_stats_cb, msg);
1642}
1643
1644struct _debug_info
1645{
1646 unsigned int size;
1647 unsigned int nfonts;
1648};
1649
1650static Eina_Bool
1651_font_entry_debug_size_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
1652{
1653 struct _debug_info *di = fdata;
1654 unsigned int size = di->size;
1655 Font_Entry *fe = data;
1656 Font_Cache *fc;
1657 unsigned int intsize = sizeof(unsigned int);
1658
1659 // filelen
1660 size += intsize;
1661
1662 // file
1663 if (fe->src->file)
1664 size += strlen(fe->src->file) + 1;
1665
1666 // namelen
1667 size += intsize;
1668
1669 // name
1670 if (fe->src->name)
1671 size += strlen(fe->src->name) + 1;
1672
1673 // rend_flags, size, dpi
1674 size += 3 * intsize;
1675
1676 // unused
1677 size += intsize;
1678
1679 // ncaches
1680 size += intsize;
1681
1682 EINA_INLIST_FOREACH(fe->caches, fc)
1683 {
1684 Glyph_Entry *gl;
1685
1686 // shmnamelen + shmname
1687 size += intsize;
1688 size += strlen(cserve2_shm_name_get(fc->shm)) + 1;
1689
1690 // size + usage
1691 size += 2 * intsize;
1692
1693 // nglyphs
1694 size += intsize;
1695
1696 EINA_INLIST_FOREACH(fc->glyphs, gl)
1697 {
1698 // index, offset, size
1699 size += 3 * intsize;
1700
1701 // rows, width, pitch
1702 size += 3 * intsize;
1703
1704 // num_grays, pixel_mode
1705 size += 2 * intsize;
1706 }
1707 }
1708
1709 di->size = size;
1710 di->nfonts++;
1711
1712 return EINA_TRUE;
1713}
1714
1715static Eina_Bool
1716_font_entry_debug_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
1717{
1718 char **pos = fdata;
1719 char *buf = *pos;
1720 Font_Entry *fe = data;
1721 Font_Cache *fc;
1722 unsigned int len;
1723 unsigned int unused;
1724 unsigned int ncaches;
1725 unsigned int intsize = sizeof(unsigned int);
1726
1727 // filelen + file
1728 len = 0;
1729 if (fe->src->file)
1730 len = strlen(fe->src->file) + 1;
1731 memcpy(buf, &len, intsize);
1732 buf += intsize;
1733 memcpy(buf, fe->src->file, len);
1734 buf += len;
1735
1736 // namelen + name
1737 len = 0;
1738 if (fe->src->name)
1739 len = strlen(fe->src->name) + 1;
1740 memcpy(buf, &len, intsize);
1741 buf += intsize;
1742 memcpy(buf, fe->src->name, len);
1743 buf += len;
1744
1745 // rend_flags, size, dpi
1746 memcpy(buf, &fe->rend_flags, intsize);
1747 buf += intsize;
1748 memcpy(buf, &fe->size, intsize);
1749 buf += intsize;
1750 memcpy(buf, &fe->dpi, intsize);
1751 buf += intsize;
1752
1753 // unused
1754 unused = fe->unused;
1755 memcpy(buf, &unused, intsize);
1756 buf += intsize;
1757
1758 // ncaches
1759 ncaches = eina_inlist_count(fe->caches);
1760 memcpy(buf, &ncaches, intsize);
1761 buf += intsize;
1762
1763 EINA_INLIST_FOREACH(fe->caches, fc)
1764 {
1765 Glyph_Entry *gl;
1766 const char *shmname;
1767 unsigned int shmsize;
1768
1769 // shmnamelen + shmname
1770 shmname = cserve2_shm_name_get(fc->shm);
1771 len = strlen(shmname) + 1;
1772 memcpy(buf, &len, intsize);
1773 buf += intsize;
1774 memcpy(buf, shmname, len);
1775 buf += len;
1776
1777 // size, usage, nglyphs
1778 shmsize = cserve2_shm_size_get(fc->shm);
1779 memcpy(buf, &shmsize, intsize);
1780 buf += intsize;
1781 memcpy(buf, &fc->usage, intsize);
1782 buf += intsize;
1783 memcpy(buf, &fc->nglyphs, intsize);
1784 buf += intsize;
1785
1786 EINA_INLIST_FOREACH(fc->glyphs, gl)
1787 {
1788 // index, offset, size
1789 memcpy(buf, &gl->index, intsize);
1790 buf += intsize;
1791 memcpy(buf, &gl->offset, intsize);
1792 buf += intsize;
1793 memcpy(buf, &gl->size, intsize);
1794 buf += intsize;
1795
1796 // rows, width, pitch
1797 memcpy(buf, &gl->rows, intsize);
1798 buf += intsize;
1799 memcpy(buf, &gl->width, intsize);
1800 buf += intsize;
1801 memcpy(buf, &gl->pitch, intsize);
1802 buf += intsize;
1803
1804 // num_grays, pixel_mode
1805 memcpy(buf, &gl->num_grays, intsize);
1806 buf += intsize;
1807 memcpy(buf, &gl->pixel_mode, intsize);
1808 buf += intsize;
1809 }
1810 }
1811
1812 *pos = buf;
1813 return EINA_TRUE;
1814}
1815
1816static void *
1817_cserve2_cache_font_debug(unsigned int rid, unsigned int *size)
1818{
1819 Msg_Font_Debug msg;
1820 char *buf, *pos;
1821 struct _debug_info di;
1822 di.size = sizeof(msg);
1823 di.nfonts = 0;
1824
1825 memset(&msg, 0, sizeof(msg));
1826
1827 msg.base.type = CSERVE2_FONT_DEBUG;
1828 msg.base.rid = rid;
1829
1830 // First calculate how much size is needed for this message:
1831
1832 // nfonts
1833 di.size += sizeof(unsigned int);
1834
1835 // size needed for each font entry
1836 eina_hash_foreach(font_entries, _font_entry_debug_size_cb, &di);
1837
1838 // Now really create the message
1839 buf = malloc(di.size);
1840 pos = buf;
1841
1842 // msg base
1843 memcpy(buf, &msg, sizeof(msg));
1844 pos += sizeof(msg);
1845
1846 // nfonts
1847 memcpy(pos, &di.nfonts, sizeof(unsigned int));
1848 pos += sizeof(unsigned int);
1849
1850 eina_hash_foreach(font_entries, _font_entry_debug_cb, &pos);
1851
1852 *size = di.size;
1853 return buf;
1854}
1855
1856int
1857cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid)
1858{
1859 unsigned int file_id;
1860 File_Data *entry;
1861 Reference *ref;
1862 File_Watch *fw;
1863 char buf[4906];
1864
1865 // look for this file on client references
1866 ref = eina_hash_find(client->files.referencing, &client_file_id);
1867 if (ref)
1868 {
1869 entry = (File_Data *)ref->entry;
1870 _entry_load_reused(ref->entry);
1871
1872 if (entry->invalid)
1873 {
1874 cserve2_client_error_send(client, rid, CSERVE2_FILE_CHANGED);
1875 return -1;
1876 }
1877
1878 DBG("found client file id: %d", client_file_id);
1879 ref->count++;
1880
1881 // File already being loaded, just add the request to be replied
1882 if (entry->base.request)
1883 cserve2_request_waiter_add(entry->base.request, rid, client);
1884 else
1885 _image_opened_send(client, entry, rid);
1886 return 0;
1887 }
1888
1889 // search whether the file is already opened by another client
1890 snprintf(buf, sizeof(buf), "%s:%s", path, key);
1891 file_id = (unsigned int)(uintptr_t)eina_hash_find(file_ids, buf);
1892 if (file_id)
1893 {
1894 DBG("found file_id %u for client file id %d",
1895 file_id, client_file_id);
1896 entry = eina_hash_find(file_entries, &file_id);
1897 if (!entry)
1898 {
1899 ERR("file \"%s\" is in file_ids hash but not in entries hash.",
1900 buf);
1901 cserve2_client_error_send(client, rid, CSERVE2_INVALID_CACHE);
1902 return -1;
1903 }
1904 ref = _entry_reference_add((Entry *)entry, client, client_file_id);
1905 _entry_load_reused(ref->entry);
1906 eina_hash_add(client->files.referencing, &client_file_id, ref);
1907 if (entry->base.request)
1908 cserve2_request_waiter_add(entry->base.request, rid, client);
1909 else // File already loaded, otherwise there would be a request
1910 _image_opened_send(client, entry, rid);
1911 return 0;
1912 }
1913
1914 file_id = _file_id++;
1915 while ((file_id == 0) || (eina_hash_find(file_entries, &file_id)))
1916 file_id = _file_id++;
1917
1918 DBG("Creating new entry with file_id: %u for file \"%s:%s\"",
1919 file_id, path, key);
1920 entry = calloc(1, sizeof(*entry));
1921 entry->base.type = CSERVE2_IMAGE_FILE;
1922 entry->path = strdup(path);
1923 entry->key = strdup(key);
1924 entry->base.id = file_id;
1925 eina_hash_add(file_entries, &file_id, entry);
1926 eina_hash_add(file_ids, buf, (void*)(intptr_t)file_id);
1927 ref = _entry_reference_add((Entry *)entry, client, client_file_id);
1928 eina_hash_add(client->files.referencing, &client_file_id, ref);
1929
1930 fw = eina_hash_find(file_watch, entry->path);
1931 if (!fw)
1932 {
1933 fw = calloc(1, sizeof(File_Watch));
1934 fw->path = eina_stringshare_add(entry->path);
1935 cserve2_file_change_watch_add(fw->path, _file_changed_cb, fw);
1936 eina_hash_direct_add(file_watch, fw->path, fw);
1937 }
1938 fw->entries = eina_list_append(fw->entries, entry);
1939 entry->watcher = fw;
1940
1941 entry->base.request = cserve2_request_add(CSERVE2_REQ_IMAGE_OPEN,
1942 rid, client, NULL, &_open_funcs,
1943 entry);
1944
1945 // _open_image_default_set(entry);
1946
1947 return 0;
1948}
1949
1950void
1951cserve2_cache_file_close(Client *client, unsigned int client_file_id)
1952{
1953 Reference *ref = eina_hash_find(client->files.referencing,
1954 &client_file_id);
1955 if (!ref)
1956 {
1957 ERR("Couldn't find file %d in client hash.", client_file_id);
1958 return;
1959 }
1960
1961 ref->count--;
1962 if (ref->count <= 0)
1963 // will call _entry_free_cb() for this entry
1964 eina_hash_del_by_key(client->files.referencing, &client_file_id);
1965}
1966
1967int
1968cserve2_cache_image_opts_set(Client *client, Msg_Setopts *msg)
1969{
1970 Image_Data *entry;
1971 File_Data *fentry = NULL;
1972 Reference *ref, *oldref;
1973 unsigned int image_id;
1974 char buf[4096];
1975
1976 oldref = eina_hash_find(client->images.referencing, &msg->image_id);
1977
1978 // search whether the image is already loaded by another client
1979 entry = _image_msg_new(client, msg);
1980 if (!entry)
1981 return -1;
1982 image_id = _img_opts_id_get(entry, buf, sizeof(buf));
1983 if (image_id)
1984 { // if so, just update the references
1985 free(entry);
1986 DBG("found image_id %d for client image id %d",
1987 image_id, msg->image_id);
1988 entry = eina_hash_find(image_entries, &image_id);
1989 if (!entry)
1990 {
1991 ERR("image id %d is in file_ids hash, but not in entries hash"
1992 "with entry id %d.", msg->image_id, image_id);
1993 cserve2_client_error_send(client, msg->base.rid,
1994 CSERVE2_INVALID_CACHE);
1995 return -1;
1996 }
1997
1998 if (entry->unused)
1999 {
2000 DBG("Re-using old image entry (id: %d) from the LRU list.",
2001 entry->base.id);
2002 entry->unused = EINA_FALSE;
2003 image_entries_lru = eina_list_remove(image_entries_lru, entry);
2004 unused_mem_usage -= _image_entry_size_get(entry);
2005 }
2006 _entry_load_reused(&entry->base);
2007
2008 if (oldref && (oldref->entry->id == image_id))
2009 return 0;
2010
2011 ref = _entry_reference_add((Entry *)entry, client, msg->image_id);
2012
2013 if (oldref)
2014 eina_hash_del_by_key(client->images.referencing, &msg->image_id);
2015
2016 eina_hash_add(client->images.referencing, &msg->image_id, ref);
2017
2018 return 0;
2019 }
2020
2021 image_id = _image_id++;
2022 while ((image_id == 0) || (eina_hash_find(image_entries, &image_id)))
2023 image_id = _image_id++;
2024
2025 entry->base.id = image_id;
2026 eina_hash_add(image_entries, &image_id, entry);
2027 eina_hash_add(image_ids, buf, (void *)(intptr_t)image_id);
2028 ref = _entry_reference_add((Entry *)entry, client, msg->image_id);
2029
2030 if (oldref)
2031 eina_hash_del_by_key(client->images.referencing, &msg->image_id);
2032 eina_hash_add(client->images.referencing, &msg->image_id, ref);
2033
2034 fentry = entry->file;
2035 fentry->images = eina_list_append(fentry->images, entry);
2036
2037 entry->base.request = cserve2_request_add(CSERVE2_REQ_IMAGE_SPEC_LOAD,
2038 0, NULL, fentry->base.request,
2039 &_load_funcs, entry);
2040 return 0;
2041}
2042
2043void
2044cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid)
2045{
2046 Image_Data *entry;
2047 Reference *ref;
2048
2049 ref = eina_hash_find(client->images.referencing, &client_image_id);
2050 if (!ref)
2051 {
2052 ERR("Can't load: client %d has no image id %d",
2053 client->id, client_image_id);
2054 return;
2055 }
2056
2057 entry = (Image_Data *)ref->entry;
2058
2059 if (entry->file->invalid)
2060 {
2061 cserve2_client_error_send(client, rid, CSERVE2_FILE_CHANGED);
2062 return;
2063 }
2064
2065 DBG("Loading image id: %d", ref->entry->id);
2066
2067 // File already being loaded, just add the request to be replied
2068 if (entry->base.request)
2069 {
2070 cserve2_request_waiter_add(entry->base.request, rid, client);
2071 if (!entry->doload)
2072 cserve2_request_type_set(entry->base.request, CSERVE2_REQ_IMAGE_LOAD);
2073 }
2074 else if (entry->shm)
2075 _image_loaded_send(client, entry, rid);
2076 else
2077 entry->base.request = cserve2_request_add(CSERVE2_REQ_IMAGE_LOAD,
2078 rid, client,
2079 entry->file->base.request,
2080 &_load_funcs,
2081 entry);
2082
2083 entry->doload = EINA_TRUE;
2084}
2085
2086void
2087cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid)
2088{
2089 Image_Data *entry;
2090 Reference *ref;
2091
2092 ref = eina_hash_find(client->images.referencing, &client_image_id);
2093 if (!ref)
2094 {
2095 ERR("Can't load: client %d has no image id %d",
2096 client->id, client_image_id);
2097 return;
2098 }
2099
2100 entry = (Image_Data *)ref->entry;
2101
2102 if (entry->file->invalid)
2103 {
2104 cserve2_client_error_send(client, rid, CSERVE2_FILE_CHANGED);
2105 return;
2106 }
2107
2108 DBG("Loading image id: %d", ref->entry->id);
2109
2110 // File already being loaded, just add the request to be replied
2111 if (entry->base.request)
2112 {
2113 cserve2_request_waiter_add(entry->base.request, rid, client);
2114 if (!entry->doload)
2115 cserve2_request_type_set(entry->base.request, CSERVE2_REQ_IMAGE_LOAD);
2116 }
2117 else if (entry->shm)
2118 _image_loaded_send(client, entry, rid);
2119 else
2120 entry->base.request = cserve2_request_add(CSERVE2_REQ_IMAGE_LOAD,
2121 rid, client,
2122 entry->file->base.request,
2123 &_load_funcs,
2124 entry);
2125
2126 entry->doload = EINA_TRUE;
2127}
2128
2129void
2130cserve2_cache_image_unload(Client *client, unsigned int client_image_id)
2131{
2132 Reference *ref = eina_hash_find(client->images.referencing,
2133 &client_image_id);
2134 if (!ref)
2135 {
2136 ERR("Couldn't find file %d in client hash.", client_image_id);
2137 return;
2138 }
2139
2140 ref->count--;
2141 if (ref->count <= 0)
2142 // will call _entry_free_cb() for this entry
2143 eina_hash_del_by_key(client->images.referencing, &client_image_id);
2144}
2145
2146int
2147cserve2_cache_font_load(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int rid)
2148{
2149 Reference *ref;
2150 Font_Source *fs;
2151 Font_Entry *fe;
2152 char *fullname;
2153
2154 if (sourcelen == 0)
2155 source = NULL;
2156 if (namelen == 0)
2157 name = NULL;
2158
2159 fullname = _file_path_join(source, name);
2160 fe = _cserve2_font_entry_find(fullname, strlen(fullname) + 1, size,
2161 rend_flags, dpi);
2162 if (fe)
2163 {
2164 DBG("found font entry %s, rendflags: %d, size: %d, dpi: %d",
2165 name, rend_flags, size, dpi);
2166
2167 ref = _entry_reference_add((Entry *)fe, client, 0);
2168 client->fonts.referencing = eina_list_append(
2169 client->fonts.referencing, ref);
2170
2171 _entry_load_reused(&fe->base);
2172 fe->unused = EINA_FALSE;
2173
2174 if (fe->base.request)
2175 cserve2_request_waiter_add(fe->base.request, rid, client);
2176 else
2177 _font_loaded_send(client, rid);
2178 free(fullname);
2179 return 0;
2180 }
2181
2182 fe = calloc(1, sizeof(*fe));
2183 fe->rend_flags = rend_flags;
2184 fe->size = size;
2185 fe->dpi = dpi;
2186 fe->base.type = CSERVE2_FONT_ENTRY;
2187 fe->glyphs = fash_gl_new(_glyph_free_cb);
2188 ref = _entry_reference_add((Entry *)fe, client, 0);
2189 client->fonts.referencing = eina_list_append(
2190 client->fonts.referencing, ref);
2191 fe->unused = EINA_FALSE;
2192
2193 fs = _cserve2_font_source_find(fullname);
2194 if (!fs)
2195 {
2196 fs = calloc(1, sizeof(*fs));
2197 if (source)
2198 {
2199 fs->key = eina_stringshare_add(fullname);
2200 fs->name = eina_stringshare_add_length(name, namelen);
2201 fs->file = eina_stringshare_add_length(source, sourcelen);
2202 }
2203 else
2204 {
2205 fs->file = eina_stringshare_add_length(name, namelen);
2206 fs->key = eina_stringshare_ref(fs->file);
2207 }
2208 eina_hash_direct_add(font_sources, fs->key, fs);
2209 }
2210
2211 fe->src = fs;
2212 fs->references++;
2213 DBG("adding FONT_LOAD '%s' request.", fs->name);
2214 fe->base.request = cserve2_request_add(CSERVE2_REQ_FONT_LOAD, rid, client,
2215 NULL, &_font_load_funcs, fe);
2216
2217 eina_hash_direct_add(font_entries, fe, fe);
2218
2219 free(fullname);
2220
2221 return 0;
2222}
2223
2224int
2225cserve2_cache_font_unload(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int rid __UNUSED__)
2226{
2227 Font_Entry *fe;
2228 char *fullname;
2229
2230 if (sourcelen == 0)
2231 source = NULL;
2232 if (namelen == 0)
2233 name = NULL;
2234
2235 fullname = _file_path_join(source, name);
2236 fe = _cserve2_font_entry_find(fullname, strlen(fullname) + 1, size,
2237 rend_flags, dpi);
2238 free(fullname);
2239
2240 if (!fe)
2241 {
2242 ERR("Unreferencing font not found: '%s:%s'.", source, name);
2243 return -1;
2244 }
2245
2246 _font_entry_reference_del(client, fe);
2247
2248 return 0;
2249}
2250
2251int
2252cserve2_cache_font_glyphs_load(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int hint, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int *glyphs, unsigned int nglyphs, unsigned int rid)
2253{
2254 Glyphs_Request *req;
2255
2256 req = _glyphs_request_create(client, source, sourcelen, name, namelen,
2257 hint, rend_flags, size, dpi, glyphs, nglyphs);
2258 if (!req)
2259 {
2260 free(glyphs);
2261 return -1;
2262 }
2263
2264 if (_glyphs_request_check(req, EINA_TRUE))
2265 {
2266 INF("Glyphs already loaded. Sending answer.");
2267 _glyphs_loaded_send(req, rid);
2268 _glyphs_request_free(req);
2269 }
2270 else
2271 {
2272 cserve2_request_add(CSERVE2_REQ_FONT_GLYPHS_LOAD, rid, client,
2273 req->fe->base.request, &_glyphs_load_funcs, req);
2274 }
2275 return 0;
2276}
2277
2278int
2279cserve2_cache_font_glyphs_used(Client *client, const char *source, unsigned int sourcelen, const char *name, unsigned int namelen, unsigned int hint, unsigned int rend_flags, unsigned int size, unsigned int dpi, unsigned int *glyphs, unsigned int nglyphs, unsigned int rid __UNUSED__)
2280{
2281 Glyphs_Group *gg;
2282 Eina_List *groups;
2283 Glyphs_Request *req;
2284
2285 DBG("Received report of used glyphs from client %d", client->id);
2286 req = _glyphs_request_create(client, source, sourcelen, name, namelen,
2287 hint, rend_flags, size, dpi, glyphs, nglyphs);
2288 if (!req)
2289