1 #include "evas_common.h" /* Also includes international specific stuff */
2 #include "evas_private.h"
11 static int cpunum = 0;
12 static int _evas_soft_gen_log_dom = -1;
15 eng_output_dump(void *data __UNUSED__)
17 evas_common_image_image_all_unload();
18 evas_common_font_font_all_unload();
22 eng_context_new(void *data __UNUSED__)
24 return evas_common_draw_context_new();
28 eng_context_free(void *data __UNUSED__, void *context)
30 evas_common_draw_context_free(context);
34 eng_context_clip_set(void *data __UNUSED__, void *context, int x, int y, int w, int h)
36 evas_common_draw_context_set_clip(context, x, y, w, h);
40 eng_context_clip_clip(void *data __UNUSED__, void *context, int x, int y, int w, int h)
42 evas_common_draw_context_clip_clip(context, x, y, w, h);
46 eng_context_clip_unset(void *data __UNUSED__, void *context)
48 evas_common_draw_context_unset_clip(context);
52 eng_context_clip_get(void *data __UNUSED__, void *context, int *x, int *y, int *w, int *h)
54 *x = ((RGBA_Draw_Context *)context)->clip.x;
55 *y = ((RGBA_Draw_Context *)context)->clip.y;
56 *w = ((RGBA_Draw_Context *)context)->clip.w;
57 *h = ((RGBA_Draw_Context *)context)->clip.h;
58 return ((RGBA_Draw_Context *)context)->clip.use;
62 eng_context_color_set(void *data __UNUSED__, void *context, int r, int g, int b, int a)
64 evas_common_draw_context_set_color(context, r, g, b, a);
68 eng_context_color_get(void *data __UNUSED__, void *context, int *r, int *g, int *b, int *a)
70 *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->col.col));
71 *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->col.col));
72 *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->col.col));
73 *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->col.col));
78 eng_context_multiplier_set(void *data __UNUSED__, void *context, int r, int g, int b, int a)
80 evas_common_draw_context_set_multiplier(context, r, g, b, a);
84 eng_context_multiplier_unset(void *data __UNUSED__, void *context)
86 evas_common_draw_context_unset_multiplier(context);
90 eng_context_multiplier_get(void *data __UNUSED__, void *context, int *r, int *g, int *b, int *a)
92 *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->mul.col));
93 *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->mul.col));
94 *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->mul.col));
95 *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->mul.col));
96 return ((RGBA_Draw_Context *)context)->mul.use;
100 eng_context_mask_set(void *data __UNUSED__, void *context, void *mask, int x, int y, int w, int h)
102 evas_common_draw_context_set_mask(context, mask, x, y, w, h);
106 eng_context_mask_unset(void *data __UNUSED__, void *context)
108 evas_common_draw_context_unset_mask(context);
112 eng_context_mask_get(void *data __UNUSED__, void *context)
114 return ((RGBA_Draw_Context *)context)->mask.mask;
119 eng_context_cutout_add(void *data __UNUSED__, void *context, int x, int y, int w, int h)
121 evas_common_draw_context_add_cutout(context, x, y, w, h);
125 eng_context_cutout_clear(void *data __UNUSED__, void *context)
127 evas_common_draw_context_clear_cutouts(context);
131 eng_context_anti_alias_set(void *data __UNUSED__, void *context, unsigned char aa)
133 evas_common_draw_context_set_anti_alias(context, aa);
137 eng_context_anti_alias_get(void *data __UNUSED__, void *context)
139 return ((RGBA_Draw_Context *)context)->anti_alias;
143 eng_context_color_interpolation_set(void *data __UNUSED__, void *context, int color_space)
145 evas_common_draw_context_set_color_interpolation(context, color_space);
149 eng_context_color_interpolation_get(void *data __UNUSED__, void *context)
151 return ((RGBA_Draw_Context *)context)->interpolation.color_space;
155 eng_context_render_op_set(void *data __UNUSED__, void *context, int op)
157 evas_common_draw_context_set_render_op(context, op);
161 eng_context_render_op_get(void *data __UNUSED__, void *context)
163 return ((RGBA_Draw_Context *)context)->render_op;
169 eng_rectangle_draw(void *data __UNUSED__, void *context, void *surface, int x, int y, int w, int h)
171 #ifdef BUILD_PIPE_RENDER
173 #ifdef EVAS_FRAME_QUEUING
174 && evas_common_frameq_enabled()
177 evas_common_pipe_rectangle_draw(surface, context, x, y, w, h);
181 evas_common_rectangle_draw(surface, context, x, y, w, h);
182 evas_common_cpu_end_opt();
187 eng_line_draw(void *data __UNUSED__, void *context, void *surface, int x1, int y1, int x2, int y2)
189 #ifdef BUILD_PIPE_RENDER
191 #ifdef EVAS_FRAME_QUEUING
192 && evas_common_frameq_enabled()
195 evas_common_pipe_line_draw(surface, context, x1, y1, x2, y2);
199 evas_common_line_draw(surface, context, x1, y1, x2, y2);
200 evas_common_cpu_end_opt();
205 eng_polygon_point_add(void *data __UNUSED__, void *context __UNUSED__, void *polygon, int x, int y)
207 return evas_common_polygon_point_add(polygon, x, y);
211 eng_polygon_points_clear(void *data __UNUSED__, void *context __UNUSED__, void *polygon)
213 return evas_common_polygon_points_clear(polygon);
217 eng_polygon_draw(void *data __UNUSED__, void *context, void *surface, void *polygon, int x, int y)
219 #ifdef BUILD_PIPE_RENDER
221 #ifdef EVAS_FRAME_QUEUING
222 && evas_common_frameq_enabled()
225 evas_common_pipe_poly_draw(surface, context, polygon, x, y);
229 evas_common_polygon_draw(surface, context, polygon, x, y);
230 evas_common_cpu_end_opt();
235 eng_image_alpha_get(void *data __UNUSED__, void *image)
239 if (!image) return 1;
243 case EVAS_COLORSPACE_ARGB8888:
244 if (im->flags.alpha) return 1;
252 eng_image_colorspace_get(void *data __UNUSED__, void *image)
256 if (!image) return EVAS_COLORSPACE_ARGB8888;
262 eng_image_can_region_get(void *data__UNUSED__, void *image)
265 if (!image) return EINA_FALSE;
267 return ((Evas_Image_Load_Func*) im->info.loader)->do_region;
271 eng_image_mask_create(void *data __UNUSED__, void *image)
280 if (im->mask.mask && !im->mask.dirty) return;
282 if (im->mask.mask) free(im->mask.mask);
283 sz = im->cache_entry.w * im->cache_entry.h;
284 im->mask.mask = malloc(sz);
287 evas_cache_image_load_data(&im->cache_entry);
288 src = (void*) im->image.data;
290 for (end = dst + sz ; dst < end ; dst ++, src ++)
297 eng_image_alpha_set(void *data __UNUSED__, void *image, int has_alpha)
301 if (!image) return NULL;
303 if (im->cache_entry.space != EVAS_COLORSPACE_ARGB8888)
305 im->cache_entry.flags.alpha = 0;
308 im = (RGBA_Image *) evas_cache_image_alone(&im->cache_entry);
309 evas_common_image_colorspace_dirty(im);
311 im->cache_entry.flags.alpha = has_alpha ? 1 : 0;
316 eng_image_border_set(void *data __UNUSED__, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__)
325 eng_image_border_get(void *data __UNUSED__, void *image, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__)
333 eng_image_comment_get(void *data __UNUSED__, void *image, char *key __UNUSED__)
337 if (!image) return NULL;
339 return im->info.comment;
343 eng_image_format_get(void *data __UNUSED__, void *image __UNUSED__)
349 eng_image_colorspace_set(void *data __UNUSED__, void *image, int cspace)
355 evas_cache_image_colorspace(im, cspace);
359 eng_image_native_set(void *data __UNUSED__, void *image, void *native __UNUSED__)
365 eng_image_native_get(void *data __UNUSED__, void *image __UNUSED__)
371 eng_image_load(void *data __UNUSED__, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo)
373 *error = EVAS_LOAD_ERROR_NONE;
374 return evas_common_load_image_from_file(file, key, lo, error);
378 eng_image_new_from_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace)
380 return evas_cache_image_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace);
384 eng_image_new_from_copied_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace)
386 return evas_cache_image_copied_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace);
390 eng_image_free(void *data __UNUSED__, void *image)
392 evas_cache_image_drop(image);
396 eng_image_size_get(void *data __UNUSED__, void *image, int *w, int *h)
406 eng_image_size_set(void *data __UNUSED__, void *image, int w, int h)
411 return evas_cache_image_size_set(image, w, h);
415 eng_image_dirty_region(void *data __UNUSED__, void *image, int x, int y, int w, int h)
417 Image_Entry *im = image;
419 if (!image) return NULL;
420 return evas_cache_image_dirty(im, x, y, w, h);
424 eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **image_data, int *err)
435 error = evas_cache_image_load_data(&im->cache_entry);
436 switch (im->cache_entry.space)
438 case EVAS_COLORSPACE_ARGB8888:
440 im = (RGBA_Image *)evas_cache_image_alone(&im->cache_entry);
441 *image_data = im->image.data;
443 case EVAS_COLORSPACE_YCBCR422P601_PL:
444 case EVAS_COLORSPACE_YCBCR422P709_PL:
445 case EVAS_COLORSPACE_YCBCR422601_PL:
446 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
447 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
448 *image_data = im->cs.data;
454 if (err) *err = error;
459 eng_image_data_put(void *data, void *image, DATA32 *image_data)
461 RGBA_Image *im, *im2;
463 if (!image) return NULL;
465 switch (im->cache_entry.space)
467 case EVAS_COLORSPACE_ARGB8888:
468 if (image_data != im->image.data)
472 w = im->cache_entry.w;
473 h = im->cache_entry.h;
474 im2 = eng_image_new_from_data(data, w, h, image_data,
475 eng_image_alpha_get(data, image),
476 eng_image_colorspace_get(data, image));
477 evas_cache_image_drop(&im->cache_entry);
481 case EVAS_COLORSPACE_YCBCR422P601_PL:
482 case EVAS_COLORSPACE_YCBCR422P709_PL:
483 case EVAS_COLORSPACE_YCBCR422601_PL:
484 case EVAS_COLORSPACE_YCBCR420NV12601_PL:
485 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
486 if (image_data != im->cs.data)
490 if (!im->cs.no_free) free(im->cs.data);
492 im->cs.data = image_data;
494 evas_common_image_colorspace_dirty(im);
504 eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target)
506 RGBA_Image *im = image;
509 evas_cache_image_preload_data(&im->cache_entry, target);
513 eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target)
515 RGBA_Image *im = image;
518 evas_cache_image_preload_cancel(&im->cache_entry, target);
522 eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth)
528 #ifdef BUILD_PIPE_RENDER
530 #ifdef EVAS_FRAME_QUEUING
531 && evas_common_frameq_enabled()
535 evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
536 surface, context, smooth,
537 src_x, src_y, src_w, src_h,
538 dst_x, dst_y, dst_w, dst_h);
540 evas_common_pipe_image_draw(im, surface, context, smooth,
541 src_x, src_y, src_w, src_h,
542 dst_x, dst_y, dst_w, dst_h);
547 // if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
548 // evas_cache_image_load_data(&im->cache_entry);
549 // evas_common_image_colorspace_normalize(im);
550 evas_common_rgba_image_scalecache_prepare(&im->cache_entry, surface, context, smooth,
551 src_x, src_y, src_w, src_h,
552 dst_x, dst_y, dst_w, dst_h);
553 evas_common_rgba_image_scalecache_do(&im->cache_entry, surface, context, smooth,
554 src_x, src_y, src_w, src_h,
555 dst_x, dst_y, dst_w, dst_h);
558 evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context,
559 src_x, src_y, src_w, src_h,
560 dst_x, dst_y, dst_w, dst_h);
562 evas_common_scale_rgba_in_to_out_clip_sample(im, surface, context,
563 src_x, src_y, src_w, src_h,
564 dst_x, dst_y, dst_w, dst_h);
566 evas_common_cpu_end_opt();
571 eng_image_map_draw(void *data __UNUSED__, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level)
576 if (npoints < 3) return;
579 if ((p[0].x == p[3].x) &&
580 (p[1].x == p[2].x) &&
581 (p[0].y == p[1].y) &&
582 (p[3].y == p[2].y) &&
583 (p[0].x <= p[1].x) &&
584 (p[0].y <= p[2].y) &&
587 (p[1].u == (int)(im->cache_entry.w << FP)) &&
589 (p[2].u == (int)(im->cache_entry.w << FP)) &&
590 (p[2].v == (int)(im->cache_entry.h << FP)) &&
592 (p[3].v == (int)(im->cache_entry.h << FP)) &&
593 (p[0].col == 0xffffffff) &&
594 (p[1].col == 0xffffffff) &&
595 (p[2].col == 0xffffffff) &&
596 (p[3].col == 0xffffffff))
602 dw = (p[2].x >> FP) - dx;
603 dh = (p[2].y >> FP) - dy;
605 (data, context, surface, image,
606 0, 0, im->cache_entry.w, im->cache_entry.h,
607 dx, dy, dw, dh, smooth);
611 #ifdef BUILD_PIPE_RENDER
613 # ifdef EVAS_FRAME_QUEUING
614 && evas_common_frameq_enabled()
617 evas_common_pipe_map_draw(im, surface, context, npoints, p, smooth, level);
620 evas_common_map_rgba(im, surface, context, npoints, p, smooth, level);
622 evas_common_cpu_end_opt();
626 eng_image_map_draw(data, context, surface, image, npoints - 2, p + 2,
632 eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha)
636 surface = evas_cache_image_copied_data(evas_common_image_cache_get(),
638 EVAS_COLORSPACE_ARGB8888);
639 pixels = evas_cache_image_pixels(surface);
644 eng_image_map_surface_free(void *data __UNUSED__, void *surface)
646 evas_cache_image_drop(surface);
650 eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint)
656 im->scale_hint = hint;
660 eng_image_scale_hint_get(void *data __UNUSED__, void *image)
664 if (!image) return EVAS_IMAGE_SCALE_HINT_NONE;
666 return im->scale_hint;
670 eng_image_animated_get(void *data __UNUSED__, void *image)
674 if (!image) return EINA_FALSE;
676 return im->flags.animated;
680 eng_image_animated_frame_count_get(void *data __UNUSED__, void *image)
684 if (!image) return -1;
686 if (!im->flags.animated) return -1;
687 return im->frame_count;
690 static Evas_Image_Animated_Loop_Hint
691 eng_image_animated_loop_type_get(void *data __UNUSED__, void *image)
695 if (!image) return EVAS_IMAGE_ANIMATED_HINT_NONE;
697 if (!im->flags.animated) return EVAS_IMAGE_ANIMATED_HINT_NONE;
698 return im->loop_hint;
702 eng_image_animated_loop_count_get(void *data __UNUSED__, void *image)
706 if (!image) return -1;
708 if (!im->flags.animated) return -1;
709 return im->loop_count;
713 eng_image_animated_frame_duration_get(void *data __UNUSED__, void *image, int start_frame, int frame_num)
717 if (!image) return -1;
719 if (!im->flags.animated) return -1;
720 return evas_common_load_rgba_image_frame_duration_from_file(im, start_frame, frame_num);
724 eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index)
728 if (!image) return EINA_FALSE;
730 if (!im->flags.animated) return EINA_FALSE;
731 if (im->cur_frame == frame_index) return EINA_FALSE;
732 im->cur_frame = frame_index;
737 eng_image_cache_flush(void *data __UNUSED__)
741 tmp_size = evas_common_image_get_cache();
742 evas_common_image_set_cache(0);
743 evas_common_rgba_image_scalecache_flush();
744 evas_common_image_set_cache(tmp_size);
748 eng_image_cache_set(void *data __UNUSED__, int bytes)
750 evas_common_image_set_cache(bytes);
751 evas_common_rgba_image_scalecache_size_set(bytes);
755 eng_image_cache_get(void *data __UNUSED__)
757 return evas_common_image_get_cache();
760 static Evas_Font_Set *
761 eng_font_load(void *data __UNUSED__, const char *name, int size,
762 Font_Rend_Flags wanted_rend)
764 return (Evas_Font_Set *) evas_common_font_load(name, size, wanted_rend);
767 static Evas_Font_Set *
768 eng_font_memory_load(void *data __UNUSED__, char *name, int size, const void *fdata, int fdata_size, Font_Rend_Flags wanted_rend)
770 return (Evas_Font_Set *) evas_common_font_memory_load(name, size, fdata,
771 fdata_size, wanted_rend);
774 static Evas_Font_Set *
775 eng_font_add(void *data __UNUSED__, Evas_Font_Set *font, const char *name, int size, Font_Rend_Flags wanted_rend)
777 return (Evas_Font_Set *) evas_common_font_add((RGBA_Font *) font, name,
781 static Evas_Font_Set *
782 eng_font_memory_add(void *data __UNUSED__, Evas_Font_Set *font, char *name, int size, const void *fdata, int fdata_size, Font_Rend_Flags wanted_rend)
784 return (Evas_Font_Set *) evas_common_font_memory_add((RGBA_Font *) font,
785 name, size, fdata, fdata_size, wanted_rend);
789 eng_font_free(void *data __UNUSED__, Evas_Font_Set *font)
791 evas_common_font_free((RGBA_Font *) font);
795 eng_font_ascent_get(void *data __UNUSED__, Evas_Font_Set *font)
797 return evas_common_font_ascent_get((RGBA_Font *) font);
801 eng_font_descent_get(void *data __UNUSED__, Evas_Font_Set *font)
803 return evas_common_font_descent_get((RGBA_Font *) font);
807 eng_font_max_ascent_get(void *data __UNUSED__, Evas_Font_Set *font)
809 return evas_common_font_max_ascent_get((RGBA_Font *) font);
813 eng_font_max_descent_get(void *data __UNUSED__, Evas_Font_Set *font)
815 return evas_common_font_max_descent_get((RGBA_Font *) font);
819 eng_font_string_size_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int *w, int *h)
821 evas_common_font_query_size((RGBA_Font *) font, text_props, w, h);
825 eng_font_inset_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props)
827 return evas_common_font_query_inset((RGBA_Font *) font, text_props);
831 eng_font_right_inset_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props)
833 return evas_common_font_query_right_inset((RGBA_Font *) font, text_props);
837 eng_font_h_advance_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props)
841 evas_common_font_query_advance((RGBA_Font *) font, text_props, &h, &v);
846 eng_font_v_advance_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props)
850 evas_common_font_query_advance((RGBA_Font *) font, text_props, &h, &v);
855 eng_font_pen_coords_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch)
857 return evas_common_font_query_pen_coords((RGBA_Font *) font, text_props, pos, cpen_x, cy, cadv, ch);
861 eng_font_text_props_info_create(void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len)
863 return evas_common_text_props_content_create((RGBA_Font_Int *) fi, text,
864 text_props, par_props, par_pos, len);
868 eng_font_char_coords_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int pos, int *cx, int *cy, int *cw, int *ch)
870 return evas_common_font_query_char_coords((RGBA_Font *) font, text_props, pos, cx, cy, cw, ch);
874 eng_font_char_at_coords_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int x, int y, int *cx, int *cy, int *cw, int *ch)
876 return evas_common_font_query_char_at_coords((RGBA_Font *) font, text_props, x, y, cx, cy, cw, ch);
880 eng_font_last_up_to_pos(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int x, int y)
882 return evas_common_font_query_last_up_to_pos((RGBA_Font *) font, text_props, x, y);
886 eng_font_run_font_end_get(void *data __UNUSED__, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len)
888 return evas_common_font_query_run_font_end_get((RGBA_Font *) font,
889 (RGBA_Font_Int **) script_fi, (RGBA_Font_Int **) cur_fi,
890 script, text, run_len);
894 eng_font_draw(void *data __UNUSED__, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Evas_Text_Props *text_props)
896 #ifdef BUILD_PIPE_RENDER
898 #ifdef EVAS_FRAME_QUEUING
899 && evas_common_frameq_enabled()
902 evas_common_pipe_text_draw(surface, context, (RGBA_Font *) font, x, y,
907 evas_common_font_draw(surface, context, (RGBA_Font *) font, x, y,
909 evas_common_cpu_end_opt();
914 eng_font_cache_flush(void *data __UNUSED__)
918 tmp_size = evas_common_font_cache_get();
919 evas_common_font_cache_set(0);
920 evas_common_font_flush();
921 evas_common_font_cache_set(tmp_size);
925 eng_font_cache_set(void *data __UNUSED__, int bytes)
927 evas_common_font_cache_set(bytes);
931 eng_font_cache_get(void *data __UNUSED__)
933 return evas_common_font_cache_get();
937 eng_font_hinting_set(void *data __UNUSED__, Evas_Font_Set *font, int hinting)
939 evas_common_font_hinting_set((RGBA_Font *) font, hinting);
943 eng_font_hinting_can_hint(void *data __UNUSED__, int hinting)
945 return evas_common_hinting_available(hinting);
949 eng_canvas_alpha_get(void *data __UNUSED__, void *info __UNUSED__)
956 #if 0 // filtering disabled
958 eng_image_draw_filtered(void *data __UNUSED__, void *context __UNUSED__,
959 void *surface, void *image, Evas_Filter_Info *filter)
961 Evas_Software_Filter_Fn fn;
962 RGBA_Image *im = image;
964 fn = evas_filter_software_get(filter);
966 if (im->cache_entry.cache) evas_cache_image_load_data(&im->cache_entry);
967 fn(filter, image, surface);
971 static Filtered_Image *
972 eng_image_filtered_get(void *image, uint8_t *key, size_t keylen)
974 RGBA_Image *im = image;
978 for (l = im->filtered ; l ; l = l->next)
981 if (fi->keylen != keylen) continue;
982 if (memcmp(key, fi->key, keylen) != 0) continue;
990 static Filtered_Image *
991 eng_image_filtered_save(void *image, void *fimage, uint8_t *key, size_t keylen)
993 RGBA_Image *im = image;
997 for (l = im->filtered ; l ; l = l->next)
1000 if (fi->keylen != keylen) continue;
1001 if (memcmp(key, fi->key, keylen) == 0) continue;
1002 evas_cache_image_drop((void *)fi->image);
1007 fi = calloc(1,sizeof(Filtered_Image));
1008 if (!fi) return NULL;
1010 fi->keylen = keylen;
1011 fi->key = malloc(keylen);
1012 memcpy(fi->key, key, keylen);
1016 im->filtered = eina_list_prepend(im->filtered, fi);
1022 eng_image_filtered_free(void *image, Filtered_Image *fi)
1024 RGBA_Image *im = image;
1027 if (fi->ref) return;
1030 evas_cache_image_drop(&fi->image->cache_entry);
1033 im->filtered = eina_list_remove(im->filtered, fi);
1038 eng_image_load_error_get(void *data __UNUSED__, void *image)
1042 if (!image) return EVAS_LOAD_ERROR_NONE;
1044 return im->cache_entry.load_error;
1055 static Evas_Func func =
1071 /* draw context virtual methods */
1073 eng_canvas_alpha_get,
1075 eng_context_clip_set,
1076 eng_context_clip_clip,
1077 eng_context_clip_unset,
1078 eng_context_clip_get,
1079 eng_context_mask_set,
1080 eng_context_mask_unset,
1081 eng_context_color_set,
1082 eng_context_color_get,
1083 eng_context_multiplier_set,
1084 eng_context_multiplier_unset,
1085 eng_context_multiplier_get,
1086 eng_context_cutout_add,
1087 eng_context_cutout_clear,
1088 eng_context_anti_alias_set,
1089 eng_context_anti_alias_get,
1090 eng_context_color_interpolation_set,
1091 eng_context_color_interpolation_get,
1092 eng_context_render_op_set,
1093 eng_context_render_op_get,
1094 /* rect draw funcs */
1096 /* line draw funcs */
1098 /* polygon draw funcs */
1099 eng_polygon_point_add,
1100 eng_polygon_points_clear,
1102 /* image draw funcs */
1104 eng_image_new_from_data,
1105 eng_image_new_from_copied_data,
1110 eng_image_dirty_region,
1113 eng_image_data_preload_request,
1114 eng_image_data_preload_cancel,
1115 eng_image_alpha_set,
1116 eng_image_alpha_get,
1117 eng_image_border_set,
1118 eng_image_border_get,
1120 eng_image_comment_get,
1121 eng_image_format_get,
1122 eng_image_colorspace_set,
1123 eng_image_colorspace_get,
1124 eng_image_can_region_get,
1125 eng_image_mask_create,
1126 eng_image_native_set,
1127 eng_image_native_get,
1128 /* image cache funcs */
1129 eng_image_cache_flush,
1130 eng_image_cache_set,
1131 eng_image_cache_get,
1132 /* font draw functions */
1134 eng_font_memory_load,
1136 eng_font_memory_add,
1138 eng_font_ascent_get,
1139 eng_font_descent_get,
1140 eng_font_max_ascent_get,
1141 eng_font_max_descent_get,
1142 eng_font_string_size_get,
1144 eng_font_h_advance_get,
1145 eng_font_v_advance_get,
1146 eng_font_char_coords_get,
1147 eng_font_char_at_coords_get,
1149 /* font cache functions */
1150 eng_font_cache_flush,
1153 /* font hinting functions */
1154 eng_font_hinting_set,
1155 eng_font_hinting_can_hint,
1156 eng_image_scale_hint_set,
1157 eng_image_scale_hint_get,
1158 /* more font draw functions */
1159 eng_font_last_up_to_pos,
1161 eng_image_map_surface_new,
1162 eng_image_map_surface_free,
1163 NULL, // eng_image_content_hint_set - software doesn't use it
1164 NULL, // eng_image_content_hint_get - software doesn't use it
1165 eng_font_pen_coords_get,
1166 eng_font_text_props_info_create,
1167 eng_font_right_inset_get,
1168 #if 0 // filtering disabled
1169 eng_image_draw_filtered,
1170 eng_image_filtered_get,
1171 eng_image_filtered_save,
1172 eng_image_filtered_free,
1174 NULL, // FIXME: need software mesa for gl rendering <- gl_surface_create
1175 NULL, // FIXME: need software mesa for gl rendering <- gl_surface_destroy
1176 NULL, // FIXME: need software mesa for gl rendering <- gl_context_create
1177 NULL, // FIXME: need software mesa for gl rendering <- gl_context_destroy
1178 NULL, // FIXME: need software mesa for gl rendering <- gl_make_current
1179 NULL, // FIXME: need software mesa for gl rendering <- gl_string_query
1180 NULL, // FIXME: need software mesa for gl rendering <- gl_proc_address_get
1181 NULL, // FIXME: need software mesa for gl rendering <- gl_native_surface_get
1182 NULL, // FIXME: need software mesa for gl rendering <- gl_api_get
1183 eng_image_load_error_get,
1184 eng_font_run_font_end_get,
1185 eng_image_animated_get,
1186 eng_image_animated_frame_count_get,
1187 eng_image_animated_loop_type_get,
1188 eng_image_animated_loop_count_get,
1189 eng_image_animated_frame_duration_get,
1190 eng_image_animated_frame_set,
1192 /* FUTURE software generic calls go here */
1198 ** MODULE ACCESSIBLE API API
1204 module_open(Evas_Module *em)
1207 _evas_soft_gen_log_dom = eina_log_domain_register
1208 ("evas-software_generic", EVAS_DEFAULT_LOG_COLOR);
1209 if(_evas_soft_gen_log_dom<0)
1211 EINA_LOG_ERR("Can not create a module log domain.");
1214 em->functions = (void *)(&func);
1215 cpunum = eina_cpu_count();
1220 module_close(Evas_Module *em __UNUSED__)
1222 eina_log_domain_unregister(_evas_soft_gen_log_dom);
1225 static Evas_Module_Api evas_modapi =
1227 EVAS_MODULE_API_VERSION,
1236 EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_generic);
1238 #ifndef EVAS_STATIC_BUILD_SOFTWARE_GENERIC
1239 EVAS_EINA_MODULE_DEFINE(engine, software_generic);