diff options
Diffstat (limited to 'src/modules/evas/engines/software_generic/evas_engine.c')
-rw-r--r-- | src/modules/evas/engines/software_generic/evas_engine.c | 711 |
1 files changed, 686 insertions, 25 deletions
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index e16795d..6b8fa8b 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "evas_common.h" /* Also includes international specific stuff */ | 1 | #include "evas_common.h" /* Also includes international specific stuff */ |
2 | #include "evas_private.h" | 2 | #include "evas_private.h" |
3 | #include "evas_blend_private.h" | ||
3 | #ifdef EVAS_CSERVE2 | 4 | #ifdef EVAS_CSERVE2 |
4 | #include "evas_cs2_private.h" | 5 | #include "evas_cs2_private.h" |
5 | #endif | 6 | #endif |
@@ -273,6 +274,83 @@ static void (*_sym_glViewport) (GLint x, GLint | |||
273 | /* static void (*_sym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL; */ | 274 | /* static void (*_sym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL; */ |
274 | #endif | 275 | #endif |
275 | 276 | ||
277 | // Threaded Render | ||
278 | |||
279 | typedef struct _Evas_Thread_Command_Rect Evas_Thread_Command_Rect; | ||
280 | typedef struct _Evas_Thread_Command_Line Evas_Thread_Command_Line; | ||
281 | typedef struct _Evas_Thread_Command_Polygon Evas_Thread_Command_Polygon; | ||
282 | typedef struct _Evas_Thread_Command_Image Evas_Thread_Command_Image; | ||
283 | typedef struct _Evas_Thread_Command_Font Evas_Thread_Command_Font; | ||
284 | typedef struct _Evas_Thread_Command_Map Evas_Thread_Command_Map; | ||
285 | |||
286 | struct _Evas_Thread_Command_Rect | ||
287 | { | ||
288 | void *surface; | ||
289 | DATA32 color; | ||
290 | int render_op; | ||
291 | int x, y, w, h; | ||
292 | }; | ||
293 | |||
294 | struct _Evas_Thread_Command_Line | ||
295 | { | ||
296 | void *surface; | ||
297 | Eina_Rectangle clip; | ||
298 | DATA32 color; | ||
299 | int render_op; | ||
300 | Eina_Bool anti_alias; | ||
301 | int x1, y1; | ||
302 | int x2, y2; | ||
303 | }; | ||
304 | |||
305 | struct _Evas_Thread_Command_Polygon | ||
306 | { | ||
307 | Eina_Rectangle ext; | ||
308 | DATA32 col; | ||
309 | int render_op; | ||
310 | void *surface; | ||
311 | RGBA_Polygon_Point *points; | ||
312 | int x, y; | ||
313 | }; | ||
314 | |||
315 | struct _Evas_Thread_Command_Image | ||
316 | { | ||
317 | void *surface; | ||
318 | void *image; | ||
319 | Eina_Rectangle src, dst, clip; | ||
320 | DATA32 mul_col; | ||
321 | int render_op; | ||
322 | int smooth; | ||
323 | }; | ||
324 | |||
325 | struct _Evas_Thread_Command_Font | ||
326 | { | ||
327 | RGBA_Image *dst; | ||
328 | int x; | ||
329 | int y; | ||
330 | Evas_Glyph_Array *glyphs; | ||
331 | RGBA_Gfx_Func func; | ||
332 | void *gl_new; | ||
333 | void *gl_free; | ||
334 | void *gl_draw; | ||
335 | void *font_ext_data; | ||
336 | DATA32 col; | ||
337 | Eina_Bool clip_use : 1; | ||
338 | Eina_Rectangle clip_rect, ext; | ||
339 | int im_w, im_h; | ||
340 | }; | ||
341 | |||
342 | struct _Evas_Thread_Command_Map | ||
343 | { | ||
344 | void *image; | ||
345 | RGBA_Draw_Context image_ctx; | ||
346 | void *surface; | ||
347 | Eina_Rectangle clip; | ||
348 | DATA32 mul_col; | ||
349 | int render_op; | ||
350 | RGBA_Map *map; | ||
351 | int smooth, level, offset; | ||
352 | }; | ||
353 | |||
276 | /* | 354 | /* |
277 | ***** | 355 | ***** |
278 | ** | 356 | ** |
@@ -416,33 +494,154 @@ eng_context_render_op_get(void *data EINA_UNUSED, void *context) | |||
416 | return ((RGBA_Draw_Context *)context)->render_op; | 494 | return ((RGBA_Draw_Context *)context)->render_op; |
417 | } | 495 | } |
418 | 496 | ||
497 | static void | ||
498 | _draw_thread_rectangle_draw(void *data) | ||
499 | { | ||
500 | Evas_Thread_Command_Rect *rect = data; | ||
419 | 501 | ||
502 | evas_common_rectangle_rgba_draw(rect->surface, | ||
503 | rect->color, rect->render_op, | ||
504 | rect->x, rect->y, rect->w, rect->h); | ||
505 | } | ||
420 | 506 | ||
421 | static void | 507 | static void |
422 | eng_rectangle_draw(void *data EINA_UNUSED, void *context, void *surface, int x, int y, int w, int h) | 508 | _draw_rectangle_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, int w, int h) |
423 | { | 509 | { |
510 | Evas_Thread_Command_Rect cr; | ||
511 | |||
512 | RECTS_CLIP_TO_RECT(x, y, w, h, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); | ||
513 | if ((w <= 0) || (h <= 0)) return; | ||
514 | |||
515 | cr.surface = dst; | ||
516 | cr.color = dc->col.col; | ||
517 | cr.render_op = dc->render_op; | ||
518 | cr.x = x; | ||
519 | cr.y = y; | ||
520 | cr.w = w; | ||
521 | cr.h = h; | ||
522 | |||
523 | evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, &cr, sizeof(cr)); | ||
524 | } | ||
525 | |||
526 | static void | ||
527 | eng_rectangle_draw(void *data EINA_UNUSED, void *context, void *surface, int x, int y, int w, int h, Eina_Bool do_async) | ||
528 | { | ||
529 | if (do_async) | ||
530 | evas_common_rectangle_draw_cb(surface, context, x, y, w, h, | ||
531 | _draw_rectangle_thread_cmd); | ||
424 | #ifdef BUILD_PIPE_RENDER | 532 | #ifdef BUILD_PIPE_RENDER |
425 | if ((cpunum > 1)) | 533 | else if ((cpunum > 1)) |
426 | evas_common_pipe_rectangle_draw(surface, context, x, y, w, h); | 534 | evas_common_pipe_rectangle_draw(surface, context, x, y, w, h); |
427 | else | ||
428 | #endif | 535 | #endif |
536 | else | ||
429 | { | 537 | { |
430 | evas_common_rectangle_draw(surface, context, x, y, w, h); | 538 | evas_common_rectangle_draw(surface, context, x, y, w, h); |
431 | evas_common_cpu_end_opt(); | 539 | evas_common_cpu_end_opt(); |
540 | } | ||
541 | } | ||
542 | |||
543 | static void | ||
544 | _draw_thread_line_draw(void *data) | ||
545 | { | ||
546 | Evas_Thread_Command_Line *line = data; | ||
547 | int clip_x, clip_y, clip_w, clip_h; | ||
548 | |||
549 | clip_x = line->clip.x; | ||
550 | clip_y = line->clip.y; | ||
551 | clip_w = line->clip.w; | ||
552 | clip_h = line->clip.h; | ||
553 | |||
554 | if ((line->x1 == line->x2) && (line->y1 == line->y2)) | ||
555 | { | ||
556 | evas_common_line_point_draw(line->surface, | ||
557 | clip_x, clip_y, clip_w, clip_h, | ||
558 | line->color, line->render_op, | ||
559 | line->x1, line->y1); | ||
560 | return; | ||
432 | } | 561 | } |
562 | |||
563 | if (line->anti_alias) | ||
564 | evas_common_line_draw_line_aa | ||
565 | (line->surface, | ||
566 | clip_x, clip_y, clip_w, clip_h, | ||
567 | line->color, line->render_op, | ||
568 | line->x1, line->y1, | ||
569 | line->x2, line->y2); | ||
570 | else | ||
571 | evas_common_line_draw_line | ||
572 | (line->surface, | ||
573 | clip_x, clip_y, clip_w, clip_h, | ||
574 | line->color, line->render_op, | ||
575 | line->x1, line->y1, | ||
576 | line->x2, line->y2); | ||
433 | } | 577 | } |
434 | 578 | ||
435 | static void | 579 | static void |
436 | eng_line_draw(void *data EINA_UNUSED, void *context, void *surface, int x1, int y1, int x2, int y2) | 580 | _line_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x1, int y1, int x2, int y2) |
437 | { | 581 | { |
582 | Evas_Thread_Command_Line cl; | ||
583 | int clx, cly, clw, clh; | ||
584 | int cx, cy, cw, ch; | ||
585 | int x, y, w, h; | ||
586 | |||
587 | cl.surface = dst; | ||
588 | |||
589 | if ((x1 == x2) && (y1 == y2)) | ||
590 | { | ||
591 | EINA_RECTANGLE_SET(&cl.clip, | ||
592 | dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); | ||
593 | goto done; | ||
594 | } | ||
595 | |||
596 | clx = cly = 0; | ||
597 | clw = dst->cache_entry.w; | ||
598 | clh = dst->cache_entry.h; | ||
599 | |||
600 | cx = dc->clip.x; | ||
601 | cy = dc->clip.y; | ||
602 | cw = dc->clip.w; | ||
603 | ch = dc->clip.h; | ||
604 | |||
605 | if (dc->clip.use) | ||
606 | { | ||
607 | RECTS_CLIP_TO_RECT(clx, cly, clw, clh, cx, cy, cw, ch); | ||
608 | if ((clw < 1) || (clh < 1)) return; | ||
609 | } | ||
610 | |||
611 | x = MIN(x1, x2); | ||
612 | y = MIN(y1, y2); | ||
613 | w = MAX(x1, x2) - x + 1; | ||
614 | h = MAX(y1, y2) - y + 1; | ||
615 | |||
616 | RECTS_CLIP_TO_RECT(clx, cly, clw, clh, x, y, w, h); | ||
617 | if ((clw < 1) || (clh < 1)) return; | ||
618 | |||
619 | EINA_RECTANGLE_SET(&cl.clip, clx, cly, clw, clh); | ||
620 | |||
621 | done: | ||
622 | cl.color = dc->col.col; | ||
623 | cl.render_op = dc->render_op; | ||
624 | cl.anti_alias = dc->anti_alias; | ||
625 | cl.x1 = x1; | ||
626 | cl.y1 = y1; | ||
627 | cl.x2 = x2; | ||
628 | cl.y2 = y2; | ||
629 | |||
630 | evas_thread_cmd_enqueue(_draw_thread_line_draw, &cl, sizeof(cl)); | ||
631 | } | ||
632 | |||
633 | static void | ||
634 | eng_line_draw(void *data EINA_UNUSED, void *context, void *surface, int x1, int y1, int x2, int y2, Eina_Bool do_async) | ||
635 | { | ||
636 | if (do_async) _line_draw_thread_cmd(surface, context, x1, y1, x2, y2); | ||
438 | #ifdef BUILD_PIPE_RENDER | 637 | #ifdef BUILD_PIPE_RENDER |
439 | if ((cpunum > 1)) | 638 | else if ((cpunum > 1)) |
440 | evas_common_pipe_line_draw(surface, context, x1, y1, x2, y2); | 639 | evas_common_pipe_line_draw(surface, context, x1, y1, x2, y2); |
640 | #endif | ||
441 | else | 641 | else |
442 | #endif | ||
443 | { | 642 | { |
444 | evas_common_line_draw(surface, context, x1, y1, x2, y2); | 643 | evas_common_line_draw(surface, context, x1, y1, x2, y2); |
445 | evas_common_cpu_end_opt(); | 644 | evas_common_cpu_end_opt(); |
446 | } | 645 | } |
447 | } | 646 | } |
448 | 647 | ||
@@ -459,13 +658,115 @@ eng_polygon_points_clear(void *data EINA_UNUSED, void *context EINA_UNUSED, void | |||
459 | } | 658 | } |
460 | 659 | ||
461 | static void | 660 | static void |
462 | eng_polygon_draw(void *data EINA_UNUSED, void *context, void *surface, void *polygon, int x, int y) | 661 | _draw_thread_polygon_cleanup(Evas_Thread_Command_Polygon *poly) |
662 | { | ||
663 | RGBA_Polygon_Point *points = poly->points; | ||
664 | |||
665 | while (points) | ||
666 | { | ||
667 | RGBA_Polygon_Point *p; | ||
668 | |||
669 | p = points; | ||
670 | points = | ||
671 | (RGBA_Polygon_Point *)eina_inlist_remove(EINA_INLIST_GET(points), | ||
672 | EINA_INLIST_GET(points)); | ||
673 | free(p); | ||
674 | } | ||
675 | |||
676 | poly->points = NULL; | ||
677 | } | ||
678 | |||
679 | static void | ||
680 | _draw_thread_polygon_draw(void *data) | ||
681 | { | ||
682 | Evas_Thread_Command_Polygon *poly = data; | ||
683 | |||
684 | evas_common_polygon_rgba_draw | ||
685 | (poly->surface, | ||
686 | poly->ext.x, poly->ext.y, poly->ext.w, poly->ext.h, | ||
687 | poly->col, poly->render_op, | ||
688 | poly->points, poly->x, poly->y); | ||
689 | |||
690 | _draw_thread_polygon_cleanup(poly); | ||
691 | } | ||
692 | |||
693 | static void | ||
694 | _polygon_draw_thread_points_populate(Evas_Thread_Command_Polygon *cp, RGBA_Polygon_Point *points) | ||
695 | { | ||
696 | RGBA_Polygon_Point *cur, *npoints = NULL; | ||
697 | |||
698 | if (!points) return; | ||
699 | |||
700 | EINA_INLIST_FOREACH(EINA_INLIST_GET(points), cur) | ||
701 | { | ||
702 | RGBA_Polygon_Point *point; | ||
703 | |||
704 | point = malloc(sizeof *point); | ||
705 | point->x = cur->x; | ||
706 | point->y = cur->y; | ||
707 | |||
708 | npoints = | ||
709 | (RGBA_Polygon_Point *)eina_inlist_append(EINA_INLIST_GET(npoints), | ||
710 | EINA_INLIST_GET(point)); | ||
711 | } | ||
712 | |||
713 | cp->points = npoints; | ||
714 | } | ||
715 | |||
716 | static void | ||
717 | _polygon_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y) | ||
718 | { | ||
719 | int ext_x, ext_y, ext_w, ext_h; | ||
720 | Evas_Thread_Command_Polygon cp; | ||
721 | |||
722 | ext_x = 0; | ||
723 | ext_y = 0; | ||
724 | ext_w = dst->cache_entry.w; | ||
725 | ext_h = dst->cache_entry.h; | ||
726 | |||
727 | if (dc->clip.use) | ||
728 | { | ||
729 | if (dc->clip.x > ext_x) | ||
730 | { | ||
731 | ext_w += ext_x - dc->clip.x; | ||
732 | ext_x = dc->clip.x; | ||
733 | } | ||
734 | |||
735 | if ((ext_x + ext_w) > (dc->clip.x + dc->clip.w)) | ||
736 | ext_w = (dc->clip.x + dc->clip.w) - ext_x; | ||
737 | |||
738 | if (dc->clip.y > ext_y) | ||
739 | { | ||
740 | ext_h += ext_y - dc->clip.y; | ||
741 | ext_y = dc->clip.y; | ||
742 | } | ||
743 | |||
744 | if ((ext_y + ext_h) > (dc->clip.y + dc->clip.h)) | ||
745 | ext_h = (dc->clip.y + dc->clip.h) - ext_y; | ||
746 | } | ||
747 | |||
748 | EINA_RECTANGLE_SET(&cp.ext, ext_x, ext_y, ext_w, ext_h); | ||
749 | cp.col = dc->col.col; | ||
750 | cp.render_op = dc->render_op; | ||
751 | cp.surface = dst; | ||
752 | |||
753 | _polygon_draw_thread_points_populate(&cp, points); | ||
754 | |||
755 | cp.x = x; | ||
756 | cp.y = y; | ||
757 | |||
758 | evas_thread_cmd_enqueue(_draw_thread_polygon_draw, &cp, sizeof(cp)); | ||
759 | } | ||
760 | |||
761 | static void | ||
762 | eng_polygon_draw(void *data EINA_UNUSED, void *context, void *surface, void *polygon, int x, int y, Eina_Bool do_async) | ||
463 | { | 763 | { |
764 | if (do_async) _polygon_draw_thread_cmd(surface, context, polygon, x, y); | ||
464 | #ifdef BUILD_PIPE_RENDER | 765 | #ifdef BUILD_PIPE_RENDER |
465 | if ((cpunum > 1)) | 766 | else if ((cpunum > 1)) |
466 | evas_common_pipe_poly_draw(surface, context, polygon, x, y); | 767 | evas_common_pipe_poly_draw(surface, context, polygon, x, y); |
467 | else | ||
468 | #endif | 768 | #endif |
769 | else | ||
469 | { | 770 | { |
470 | evas_common_polygon_draw(surface, context, polygon, x, y); | 771 | evas_common_polygon_draw(surface, context, polygon, x, y); |
471 | evas_common_cpu_end_opt(); | 772 | evas_common_cpu_end_opt(); |
@@ -825,14 +1126,132 @@ eng_image_data_preload_cancel(void *data EINA_UNUSED, void *image, const void *t | |||
825 | } | 1126 | } |
826 | 1127 | ||
827 | static void | 1128 | static void |
828 | eng_image_draw(void *data EINA_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) | 1129 | _drop_cache_ref(void *target, Evas_Callback_Type type EINA_UNUSED, void *event_info EINA_UNUSED) |
1130 | { | ||
1131 | evas_cache_image_drop((Image_Entry *)target); | ||
1132 | } | ||
1133 | |||
1134 | static void | ||
1135 | draw_thread_image_draw(void *data) | ||
1136 | { | ||
1137 | Evas_Thread_Command_Image *image = data; | ||
1138 | |||
1139 | if (image->smooth) | ||
1140 | evas_common_scale_rgba_smooth_draw | ||
1141 | (image->image, image->surface, | ||
1142 | image->clip.x, image->clip.y, image->clip.w, image->clip.h, | ||
1143 | image->mul_col, image->render_op, | ||
1144 | image->src.x, image->src.y, image->src.w, image->src.h, | ||
1145 | image->dst.x, image->dst.y, image->dst.w, image->dst.h); | ||
1146 | else | ||
1147 | evas_common_scale_rgba_sample_draw | ||
1148 | (image->image, image->surface, | ||
1149 | image->clip.x, image->clip.y, image->clip.w, image->clip.h, | ||
1150 | image->mul_col, image->render_op, | ||
1151 | image->src.x, image->src.y, image->src.w, image->src.h, | ||
1152 | image->dst.x, image->dst.y, image->dst.w, image->dst.h); | ||
1153 | |||
1154 | evas_async_events_put(image->image, 0, NULL, _drop_cache_ref); | ||
1155 | } | ||
1156 | |||
1157 | static void | ||
1158 | _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth) | ||
1159 | { | ||
1160 | Evas_Thread_Command_Image cr; | ||
1161 | int clip_x, clip_y, clip_w, clip_h; | ||
1162 | |||
1163 | if ((dst_region_w <= 0) || (dst_region_h <= 0)) return; | ||
1164 | if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, | ||
1165 | 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return; | ||
1166 | |||
1167 | evas_cache_image_ref((Image_Entry *)src); | ||
1168 | |||
1169 | cr.image = src; | ||
1170 | cr.surface = dst; | ||
1171 | EINA_RECTANGLE_SET(&cr.src, src_region_x, src_region_y, src_region_w, src_region_h); | ||
1172 | EINA_RECTANGLE_SET(&cr.dst, dst_region_x, dst_region_y, dst_region_w, dst_region_h); | ||
1173 | |||
1174 | if (dc->clip.use) | ||
1175 | { | ||
1176 | clip_x = dc->clip.x; | ||
1177 | clip_y = dc->clip.y; | ||
1178 | clip_w = dc->clip.w; | ||
1179 | clip_h = dc->clip.h; | ||
1180 | } | ||
1181 | else | ||
1182 | { | ||
1183 | clip_x = 0; | ||
1184 | clip_y = 0; | ||
1185 | clip_w = dst->cache_entry.w; | ||
1186 | clip_h = dst->cache_entry.h; | ||
1187 | } | ||
1188 | |||
1189 | EINA_RECTANGLE_SET(&cr.clip, clip_x, clip_y, clip_w, clip_h); | ||
1190 | |||
1191 | cr.mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; | ||
1192 | cr.render_op = dc->render_op; | ||
1193 | cr.smooth = smooth; | ||
1194 | |||
1195 | evas_thread_cmd_enqueue(draw_thread_image_draw, &cr, sizeof(cr)); | ||
1196 | } | ||
1197 | |||
1198 | static void | ||
1199 | _image_draw_thread_cmd_smooth(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) | ||
1200 | { | ||
1201 | _image_draw_thread_cmd | ||
1202 | (src, dst, dc, | ||
1203 | src_region_x, src_region_y, src_region_w, src_region_h, | ||
1204 | dst_region_x, dst_region_y, dst_region_w, dst_region_h, | ||
1205 | 1); | ||
1206 | } | ||
1207 | |||
1208 | static void | ||
1209 | _image_draw_thread_cmd_sample(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) | ||
1210 | { | ||
1211 | _image_draw_thread_cmd | ||
1212 | (src, dst, dc, | ||
1213 | src_region_x, src_region_y, src_region_w, src_region_h, | ||
1214 | dst_region_x, dst_region_y, dst_region_w, dst_region_h, | ||
1215 | 0); | ||
1216 | } | ||
1217 | |||
1218 | static void | ||
1219 | eng_image_draw(void *data EINA_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, Eina_Bool do_async) | ||
829 | { | 1220 | { |
830 | RGBA_Image *im; | 1221 | RGBA_Image *im; |
831 | 1222 | ||
832 | if (!image) return; | 1223 | if (!image) return; |
833 | im = image; | 1224 | im = image; |
1225 | |||
1226 | if (do_async) | ||
1227 | { | ||
1228 | if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) | ||
1229 | { | ||
1230 | #if EVAS_CSERVE2 | ||
1231 | if (evas_cserve2_use_get()) | ||
1232 | evas_cache2_image_load_data(&im->cache_entry); | ||
1233 | else | ||
1234 | #endif | ||
1235 | evas_cache_image_load_data(&im->cache_entry); | ||
1236 | } | ||
1237 | |||
1238 | evas_common_image_colorspace_normalize(im); | ||
1239 | |||
1240 | if (smooth) | ||
1241 | evas_common_scale_rgba_in_to_out_clip_cb | ||
1242 | (image, surface, context, | ||
1243 | src_x, src_y, src_w, src_h, | ||
1244 | dst_x, dst_y, dst_w, dst_h, | ||
1245 | _image_draw_thread_cmd_smooth); | ||
1246 | else | ||
1247 | evas_common_scale_rgba_in_to_out_clip_cb | ||
1248 | (image, surface, context, | ||
1249 | src_x, src_y, src_w, src_h, | ||
1250 | dst_x, dst_y, dst_w, dst_h, | ||
1251 | _image_draw_thread_cmd_sample); | ||
1252 | } | ||
834 | #ifdef BUILD_PIPE_RENDER | 1253 | #ifdef BUILD_PIPE_RENDER |
835 | if ((cpunum > 1)) | 1254 | else if ((cpunum > 1)) |
836 | { | 1255 | { |
837 | #ifdef EVAS_CSERVE2 | 1256 | #ifdef EVAS_CSERVE2 |
838 | if (evas_cserve2_use_get()) | 1257 | if (evas_cserve2_use_get()) |
@@ -847,8 +1266,8 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image | |||
847 | src_x, src_y, src_w, src_h, | 1266 | src_x, src_y, src_w, src_h, |
848 | dst_x, dst_y, dst_w, dst_h); | 1267 | dst_x, dst_y, dst_w, dst_h); |
849 | } | 1268 | } |
850 | else | ||
851 | #endif | 1269 | #endif |
1270 | else | ||
852 | { | 1271 | { |
853 | #if 0 | 1272 | #if 0 |
854 | #ifdef EVAS_CSERVE2 | 1273 | #ifdef EVAS_CSERVE2 |
@@ -901,7 +1320,185 @@ image_loaded: | |||
901 | } | 1320 | } |
902 | 1321 | ||
903 | static void | 1322 | static void |
904 | evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGBA_Image *im, RGBA_Map *m, int smooth, int level, int offset) | 1323 | _map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth) |
1324 | { | ||
1325 | int clip_x, clip_y, clip_w, clip_h; | ||
1326 | DATA32 mul_col; | ||
1327 | |||
1328 | if ((dst_region_w <= 0) || (dst_region_h <= 0)) return; | ||
1329 | if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, | ||
1330 | 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return; | ||
1331 | |||
1332 | if (dc->clip.use) | ||
1333 | { | ||
1334 | clip_x = dc->clip.x; | ||
1335 | clip_y = dc->clip.y; | ||
1336 | clip_w = dc->clip.w; | ||
1337 | clip_h = dc->clip.h; | ||
1338 | } | ||
1339 | else | ||
1340 | { | ||
1341 | clip_x = clip_y = 0; | ||
1342 | clip_w = dst->cache_entry.w; | ||
1343 | clip_h = dst->cache_entry.h; | ||
1344 | } | ||
1345 | |||
1346 | mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; | ||
1347 | |||
1348 | if (smooth) | ||
1349 | evas_common_scale_rgba_smooth_draw | ||
1350 | (src, dst, | ||
1351 | clip_x, clip_y, clip_w, clip_h, | ||
1352 | mul_col, dc->render_op, | ||
1353 | src_region_x, src_region_y, src_region_w, src_region_h, | ||
1354 | dst_region_x, dst_region_y, dst_region_w, dst_region_h); | ||
1355 | else | ||
1356 | evas_common_scale_rgba_sample_draw | ||
1357 | (src, dst, | ||
1358 | clip_x, clip_y, clip_w, clip_h, | ||
1359 | mul_col, dc->render_op, | ||
1360 | src_region_x, src_region_y, src_region_w, src_region_h, | ||
1361 | dst_region_x, dst_region_y, dst_region_w, dst_region_h); | ||
1362 | } | ||
1363 | |||
1364 | static void | ||
1365 | _map_image_sample_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) | ||
1366 | { | ||
1367 | _map_image_draw(src, dst, dc, | ||
1368 | src_region_x, src_region_y, src_region_w, src_region_h, | ||
1369 | dst_region_x, dst_region_y, dst_region_w, dst_region_h, | ||
1370 | 0); | ||
1371 | } | ||
1372 | |||
1373 | static void | ||
1374 | _map_image_smooth_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h) | ||
1375 | { | ||
1376 | _map_image_draw(src, dst, dc, | ||
1377 | src_region_x, src_region_y, src_region_w, src_region_h, | ||
1378 | dst_region_x, dst_region_y, dst_region_w, dst_region_h, | ||
1379 | 1); | ||
1380 | } | ||
1381 | |||
1382 | static void | ||
1383 | _draw_thread_map_draw(void *data) | ||
1384 | { | ||
1385 | Evas_Thread_Command_Map *map = data; | ||
1386 | int offset = map->offset; | ||
1387 | RGBA_Map *m = map->map; | ||
1388 | RGBA_Image *im = map->image; | ||
1389 | int dx, dy, dw, dh; | ||
1390 | |||
1391 | if (m->count - offset < 3) goto free_out; | ||
1392 | |||
1393 | do | ||
1394 | { | ||
1395 | if ((m->pts[0 + offset].x == m->pts[3 + offset].x) && | ||
1396 | (m->pts[1 + offset].x == m->pts[2 + offset].x) && | ||
1397 | (m->pts[0 + offset].y == m->pts[1 + offset].y) && | ||
1398 | (m->pts[3 + offset].y == m->pts[2 + offset].y) && | ||
1399 | (m->pts[0 + offset].x <= m->pts[1 + offset].x) && | ||
1400 | (m->pts[0 + offset].y <= m->pts[2 + offset].y) && | ||
1401 | (m->pts[0 + offset].u == 0) && | ||
1402 | (m->pts[0 + offset].v == 0) && | ||
1403 | (m->pts[1 + offset].u == (int)(im->cache_entry.w << FP)) && | ||
1404 | (m->pts[1 + offset].v == 0) && | ||
1405 | (m->pts[2 + offset].u == (int)(im->cache_entry.w << FP)) && | ||
1406 | (m->pts[2 + offset].v == (int)(im->cache_entry.h << FP)) && | ||
1407 | (m->pts[3 + offset].u == 0) && | ||
1408 | (m->pts[3 + offset].v == (int)(im->cache_entry.h << FP)) && | ||
1409 | (m->pts[0 + offset].col == 0xffffffff) && | ||
1410 | (m->pts[1 + offset].col == 0xffffffff) && | ||
1411 | (m->pts[2 + offset].col == 0xffffffff) && | ||
1412 | (m->pts[3 + offset].col == 0xffffffff)) | ||
1413 | { | ||
1414 | dx = m->pts[0 + offset].x >> FP; | ||
1415 | dy = m->pts[0 + offset].y >> FP; | ||
1416 | dw = (m->pts[2 + offset].x >> FP) - dx; | ||
1417 | dh = (m->pts[2 + offset].y >> FP) - dy; | ||
1418 | |||
1419 | if (map->smooth) | ||
1420 | evas_common_scale_rgba_in_to_out_clip_cb | ||
1421 | (im, map->surface, &map->image_ctx, | ||
1422 | 0, 0, im->cache_entry.w, im->cache_entry.h, | ||
1423 | dx, dy, dw, dh, _map_image_smooth_draw); | ||
1424 | else | ||
1425 | evas_common_scale_rgba_in_to_out_clip_cb | ||
1426 | (im, map->surface, &map->image_ctx, | ||
1427 | 0, 0, im->cache_entry.w, im->cache_entry.h, | ||
1428 | dx, dy, dw, dh, _map_image_sample_draw); | ||
1429 | } | ||
1430 | else | ||
1431 | { | ||
1432 | evas_common_map_rgba_draw | ||
1433 | (im, map->surface, | ||
1434 | map->clip.x, map->clip.y, map->clip.w, map->clip.h, | ||
1435 | map->mul_col, map->render_op, m->count - offset, &m->pts[offset], | ||
1436 | map->smooth, map->level); | ||
1437 | } | ||
1438 | |||
1439 | evas_common_cpu_end_opt(); | ||
1440 | |||
1441 | offset += 2; | ||
1442 | } | ||
1443 | while ((m->count > 4) && (m->count - offset >= 3)); | ||
1444 | |||
1445 | free_out: | ||
1446 | free(m); | ||
1447 | evas_async_events_put(map->image, 0, NULL, _drop_cache_ref); | ||
1448 | } | ||
1449 | |||
1450 | static void | ||
1451 | _map_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Map *map, int smooth, int level, int offset) | ||
1452 | { | ||
1453 | Evas_Thread_Command_Map cm; | ||
1454 | int clip_x, clip_y, clip_w, clip_h; | ||
1455 | |||
1456 | evas_cache_image_ref((Image_Entry *)src); | ||
1457 | |||
1458 | cm.image = src; | ||
1459 | memcpy(&cm.image_ctx, dc, sizeof(*dc)); | ||
1460 | cm.surface = dst; | ||
1461 | |||
1462 | if (dc->clip.use) | ||
1463 | { | ||
1464 | clip_x = dc->clip.x; | ||
1465 | clip_y = dc->clip.y; | ||
1466 | clip_w = dc->clip.w; | ||
1467 | clip_h = dc->clip.h; | ||
1468 | } | ||
1469 | else | ||
1470 | { | ||
1471 | clip_x = clip_y = 0; | ||
1472 | clip_w = dst->cache_entry.w; | ||
1473 | clip_h = dst->cache_entry.h; | ||
1474 | } | ||
1475 | |||
1476 | EINA_RECTANGLE_SET(&cm.clip, clip_x, clip_y, clip_w, clip_h); | ||
1477 | |||
1478 | cm.mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; | ||
1479 | cm.render_op = dc->render_op; | ||
1480 | |||
1481 | cm.map = calloc(1, sizeof(RGBA_Map) + | ||
1482 | sizeof(RGBA_Map_Point) * map->count); | ||
1483 | cm.map->engine_data = map->engine_data; | ||
1484 | cm.map->image.w = map->image.w; | ||
1485 | cm.map->image.h = map->image.h; | ||
1486 | cm.map->uv.w = map->uv.w; | ||
1487 | cm.map->uv.h = map->uv.h; | ||
1488 | cm.map->x = map->x; | ||
1489 | cm.map->y = map->y; | ||
1490 | cm.map->count = map->count; | ||
1491 | memcpy(&cm.map->pts[0], &map->pts[0], sizeof(RGBA_Map_Point) * map->count); | ||
1492 | |||
1493 | cm.smooth = smooth; | ||
1494 | cm.level = level; | ||
1495 | cm.offset = offset; | ||
1496 | |||
1497 | evas_thread_cmd_enqueue(_draw_thread_map_draw, &cm, sizeof(cm)); | ||
1498 | } | ||
1499 | |||
1500 | static void | ||
1501 | evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGBA_Image *im, RGBA_Map *m, int smooth, int level, int offset, Eina_Bool do_async) | ||
905 | { | 1502 | { |
906 | if (m->count - offset < 3) return; | 1503 | if (m->count - offset < 3) return; |
907 | 1504 | ||
@@ -933,7 +1530,8 @@ evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGB | |||
933 | eng_image_draw | 1530 | eng_image_draw |
934 | (data, context, surface, im, | 1531 | (data, context, surface, im, |
935 | 0, 0, im->cache_entry.w, im->cache_entry.h, | 1532 | 0, 0, im->cache_entry.w, im->cache_entry.h, |
936 | dx, dy, dw, dh, smooth); | 1533 | dx, dy, dw, dh, smooth, |
1534 | do_async); | ||
937 | } | 1535 | } |
938 | else | 1536 | else |
939 | { | 1537 | { |
@@ -953,17 +1551,22 @@ evas_software_image_map_draw(void *data, void *context, RGBA_Image *surface, RGB | |||
953 | 1551 | ||
954 | if (m->count > 4) | 1552 | if (m->count > 4) |
955 | { | 1553 | { |
956 | evas_software_image_map_draw(data, context, surface, im, m, smooth, level, offset + 2); | 1554 | evas_software_image_map_draw(data, context, surface, im, m, smooth, level, offset + 2, do_async); |
957 | } | 1555 | } |
958 | } | 1556 | } |
959 | 1557 | ||
960 | static void | 1558 | static void |
961 | eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level) | 1559 | eng_image_map_draw(void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async) |
962 | { | 1560 | { |
963 | if (!image) return; | 1561 | if (!image) return; |
964 | if (m->count < 3) return; | 1562 | if (m->count < 3) return; |
965 | 1563 | ||
966 | evas_software_image_map_draw(data, context, surface, image, m, smooth, level, 0); | 1564 | if (do_async) |
1565 | evas_common_map_thread_rgba_cb(image, surface, context, | ||
1566 | m, smooth, level, 0, _map_draw_thread_cmd); | ||
1567 | else | ||
1568 | evas_software_image_map_draw(data, context, surface, image, m, | ||
1569 | smooth, level, 0, do_async); | ||
967 | } | 1570 | } |
968 | 1571 | ||
969 | static void | 1572 | static void |
@@ -1251,13 +1854,71 @@ eng_font_run_font_end_get(void *data EINA_UNUSED, Evas_Font_Set *font, Evas_Font | |||
1251 | } | 1854 | } |
1252 | 1855 | ||
1253 | static void | 1856 | static void |
1254 | eng_font_draw(void *data EINA_UNUSED, void *context, void *surface, Evas_Font_Set *font EINA_UNUSED, int x, int y, int w EINA_UNUSED, int h EINA_UNUSED, int ow EINA_UNUSED, int oh EINA_UNUSED, Evas_Text_Props *text_props) | 1857 | _draw_thread_font_draw(void *data) |
1255 | { | 1858 | { |
1859 | Evas_Thread_Command_Font *font = data; | ||
1860 | RGBA_Draw_Context dc; | ||
1861 | |||
1862 | dc.font_ext.data = font->font_ext_data; | ||
1863 | dc.font_ext.func.gl_new = font->gl_new; | ||
1864 | dc.font_ext.func.gl_free = font->gl_free; | ||
1865 | dc.font_ext.func.gl_draw = font->gl_draw; | ||
1866 | dc.col.col = font->col; | ||
1867 | dc.clip.use = font->clip_use; | ||
1868 | dc.clip.x = font->clip_rect.x; | ||
1869 | dc.clip.y = font->clip_rect.y; | ||
1870 | dc.clip.w = font->clip_rect.w; | ||
1871 | dc.clip.h = font->clip_rect.h; | ||
1872 | |||
1873 | evas_common_font_rgba_draw | ||
1874 | (font->dst, &dc, | ||
1875 | font->x, font->y, font->glyphs, font->func, | ||
1876 | font->ext.x, font->ext.y, font->ext.w, font->ext.h, | ||
1877 | font->im_w, font->im_h); | ||
1878 | |||
1879 | evas_common_font_glyphs_unref(font->glyphs); | ||
1880 | } | ||
1881 | |||
1882 | static void | ||
1883 | _font_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas_Glyph_Array *glyphs, RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, int im_w, int im_h) | ||
1884 | { | ||
1885 | Evas_Thread_Command_Font cf; | ||
1886 | |||
1887 | cf.dst = dst; | ||
1888 | cf.x = x; | ||
1889 | cf.y = y; | ||
1890 | cf.gl_new = dc->font_ext.func.gl_new; | ||
1891 | cf.gl_free = dc->font_ext.func.gl_free; | ||
1892 | cf.gl_draw = dc->font_ext.func.gl_draw; | ||
1893 | cf.font_ext_data = dc->font_ext.data; | ||
1894 | cf.col = dc->col.col; | ||
1895 | cf.clip_use = dc->clip.use; | ||
1896 | EINA_RECTANGLE_SET(&cf.clip_rect, | ||
1897 | dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h); | ||
1898 | cf.glyphs = glyphs; | ||
1899 | cf.func = func; | ||
1900 | EINA_RECTANGLE_SET(&cf.ext, ext_x, ext_y, ext_w, ext_h); | ||
1901 | cf.im_w = im_w; | ||
1902 | cf.im_h = im_h; | ||
1903 | |||
1904 | evas_common_font_glyphs_ref(glyphs); | ||
1905 | evas_thread_cmd_enqueue(_draw_thread_font_draw, &cf, sizeof(cf)); | ||
1906 | } | ||
1907 | |||
1908 | static void | ||
1909 | eng_font_draw(void *data EINA_UNUSED, void *context, void *surface, Evas_Font_Set *font EINA_UNUSED, int x, int y, int w EINA_UNUSED, int h EINA_UNUSED, int ow EINA_UNUSED, int oh EINA_UNUSED, Evas_Text_Props *text_props, Eina_Bool do_async) | ||
1910 | { | ||
1911 | if (do_async) | ||
1912 | { | ||
1913 | evas_common_font_draw_prepare(text_props); | ||
1914 | evas_common_font_draw_cb(surface, context, x, y, text_props->glyphs, | ||
1915 | _font_draw_thread_cmd); | ||
1916 | } | ||
1256 | #ifdef BUILD_PIPE_RENDER | 1917 | #ifdef BUILD_PIPE_RENDER |
1257 | if ((cpunum > 1)) | 1918 | else if ((cpunum > 1)) |
1258 | evas_common_pipe_text_draw(surface, context, x, y, text_props); | 1919 | evas_common_pipe_text_draw(surface, context, x, y, text_props); |
1259 | else | ||
1260 | #endif | 1920 | #endif |
1921 | else | ||
1261 | { | 1922 | { |
1262 | evas_common_font_draw_prepare(text_props); | 1923 | evas_common_font_draw_prepare(text_props); |
1263 | evas_common_font_draw(surface, context, x, y, text_props->glyphs); | 1924 | evas_common_font_draw(surface, context, x, y, text_props->glyphs); |