summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUlisses Furquim <ulisses@profusion.mobi>2013-01-16 16:07:46 +0000
committerUlisses Furquim <ulisses@profusion.mobi>2013-01-16 16:07:46 +0000
commit09f342fdebd1889c3c6e401cb2a6c5799a6c20ed (patch)
tree6aa36636d5fda8285d3379c204669759a06f902d /src
parent73667b025cc8f5b2b0610646bcdb76a6aae8e4f5 (diff)
evas/async_render: use image scalecache
SVN revision: 82890
Diffstat (limited to '')
-rw-r--r--src/lib/evas/common/evas_image.h9
-rw-r--r--src/lib/evas/common/evas_image_scalecache.c196
-rw-r--r--src/lib/evas/common/evas_scale_main.h4
-rw-r--r--src/lib/evas/common/evas_scale_sample.c4
-rw-r--r--src/lib/evas/common/evas_scale_smooth.c14
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c120
6 files changed, 194 insertions, 153 deletions
diff --git a/src/lib/evas/common/evas_image.h b/src/lib/evas/common/evas_image.h
index 766c90c680..804019afc1 100644
--- a/src/lib/evas/common/evas_image.h
+++ b/src/lib/evas/common/evas_image.h
@@ -55,6 +55,15 @@ EAPI void
55 int src_region_w, int src_region_h, 55 int src_region_w, int src_region_h,
56 int dst_region_x, int dst_region_y, 56 int dst_region_x, int dst_region_y,
57 int dst_region_w, int dst_region_h); 57 int dst_region_w, int dst_region_h);
58EAPI Eina_Bool
59 evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
60 RGBA_Draw_Context *dc, int smooth,
61 int src_region_x, int src_region_y,
62 int src_region_w, int src_region_h,
63 int dst_region_x, int dst_region_y,
64 int dst_region_w, int dst_region_h,
65 Evas_Common_Scale_In_To_Out_Clip_Cb cb_sample,
66 Evas_Common_Scale_In_To_Out_Clip_Cb cb_smooth);
58 67
59 68
60EAPI int evas_common_load_rgba_image_module_from_file (Image_Entry *im); 69EAPI int evas_common_load_rgba_image_module_from_file (Image_Entry *im);
diff --git a/src/lib/evas/common/evas_image_scalecache.c b/src/lib/evas/common/evas_image_scalecache.c
index 606509a721..41c0b82fdb 100644
--- a/src/lib/evas/common/evas_image_scalecache.c
+++ b/src/lib/evas/common/evas_image_scalecache.c
@@ -495,19 +495,22 @@ evas_common_rgba_image_scalecache_prepare(Image_Entry *ie, RGBA_Image *dst EINA_
495//static int noscales = 0; 495//static int noscales = 0;
496#endif 496#endif
497 497
498EAPI void 498EAPI Eina_Bool
499evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst, 499evas_common_rgba_image_scalecache_do_cbs(Image_Entry *ie, RGBA_Image *dst,
500 RGBA_Draw_Context *dc, int smooth, 500 RGBA_Draw_Context *dc, int smooth,
501 int src_region_x, int src_region_y, 501 int src_region_x, int src_region_y,
502 int src_region_w, int src_region_h, 502 int src_region_w, int src_region_h,
503 int dst_region_x, int dst_region_y, 503 int dst_region_x, int dst_region_y,
504 int dst_region_w, int dst_region_h) 504 int dst_region_w, int dst_region_h,
505 Evas_Common_Scale_In_To_Out_Clip_Cb cb_sample,
506 Evas_Common_Scale_In_To_Out_Clip_Cb cb_smooth)
505{ 507{
506#ifdef SCALECACHE 508#ifdef SCALECACHE
507 RGBA_Image *im = (RGBA_Image *)ie; 509 RGBA_Image *im = (RGBA_Image *)ie;
508 Scaleitem *sci; 510 Scaleitem *sci;
509 int didpop = 0; 511 int didpop = 0;
510 int dounload = 0; 512 int dounload = 0;
513 Eina_Bool ret = EINA_FALSE;
511/* 514/*
512 static int i = 0; 515 static int i = 0;
513 516
@@ -520,7 +523,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
520 } 523 }
521 */ 524 */
522 if ((dst_region_w == 0) || (dst_region_h == 0) || 525 if ((dst_region_w == 0) || (dst_region_h == 0) ||
523 (src_region_w == 0) || (src_region_h == 0)) return; 526 (src_region_w == 0) || (src_region_h == 0)) return EINA_FALSE;
524 LKL(im->cache.lock); 527 LKL(im->cache.lock);
525 if ((src_region_w == dst_region_w) && (src_region_h == dst_region_h)) 528 if ((src_region_w == dst_region_w) && (src_region_h == dst_region_h))
526 { 529 {
@@ -539,13 +542,13 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
539 LKU(im->cache.lock); 542 LKU(im->cache.lock);
540 if (im->image.data) 543 if (im->image.data)
541 { 544 {
542 evas_common_scale_rgba_in_to_out_clip_sample(im, dst, dc, 545 return cb_sample(im, dst, dc,
543 src_region_x, src_region_y, 546 src_region_x, src_region_y,
544 src_region_w, src_region_h, 547 src_region_w, src_region_h,
545 dst_region_x, dst_region_y, 548 dst_region_x, dst_region_y,
546 dst_region_w, dst_region_h); 549 dst_region_w, dst_region_h);
547 } 550 }
548 return; 551 return EINA_FALSE;
549 } 552 }
550 LKL(cache_lock); 553 LKL(cache_lock);
551 sci = _sci_find(im, dc, smooth, 554 sci = _sci_find(im, dc, smooth,
@@ -570,24 +573,24 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
570 if (im->image.data) 573 if (im->image.data)
571 { 574 {
572 if (smooth) 575 if (smooth)
573 evas_common_scale_rgba_in_to_out_clip_smooth(im, dst, dc, 576 return cb_smooth(im, dst, dc,
574 src_region_x, src_region_y, 577 src_region_x, src_region_y,
575 src_region_w, src_region_h, 578 src_region_w, src_region_h,
576 dst_region_x, dst_region_y, 579 dst_region_x, dst_region_y,
577 dst_region_w, dst_region_h); 580 dst_region_w, dst_region_h);
578 else 581 else
579 evas_common_scale_rgba_in_to_out_clip_sample(im, dst, dc, 582 return cb_sample(im, dst, dc,
580 src_region_x, src_region_y, 583 src_region_x, src_region_y,
581 src_region_w, src_region_h, 584 src_region_w, src_region_h,
582 dst_region_x, dst_region_y, 585 dst_region_x, dst_region_y,
583 dst_region_w, dst_region_h); 586 dst_region_w, dst_region_h);
584 } 587 }
585 return; 588 return EINA_FALSE;
586 } 589 }
587 if (sci->populate_me) 590 if (sci->populate_me)
588 { 591 {
589 int size, osize, used; 592 int size, osize, used;
590 593
591 size = dst_region_w * dst_region_h; 594 size = dst_region_w * dst_region_h;
592 if (((((dst_region_w > 640) || (dst_region_h > 640)) && 595 if (((((dst_region_w > 640) || (dst_region_h > 640)) &&
593 (size > (480 * 480))) || 596 (size > (480 * 480))) ||
@@ -596,7 +599,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
596 { 599 {
597 Eina_List *l; 600 Eina_List *l;
598 Scaleitem *sci2; 601 Scaleitem *sci2;
599 602
600 dounload = 1; 603 dounload = 1;
601 osize = sci->parent_im->cache_entry.w * sci->parent_im->cache_entry.h; 604 osize = sci->parent_im->cache_entry.w * sci->parent_im->cache_entry.h;
602 used = 0; 605 used = 0;
@@ -611,7 +614,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
611 osize -= used; 614 osize -= used;
612 if (osize < 0) osize = 0; 615 if (osize < 0) osize = 0;
613 size -= osize; 616 size -= osize;
614 sci->size_adjust = size * 4; 617 sci->size_adjust = size * 4;
615 } 618 }
616 } 619 }
617 else 620 else
@@ -632,7 +635,7 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
632 if (sci->im) 635 if (sci->im)
633 { 636 {
634 static RGBA_Draw_Context *ct = NULL; 637 static RGBA_Draw_Context *ct = NULL;
635 638
636 LKL(cache_lock); 639 LKL(cache_lock);
637 im->cache.orig_usage++; 640 im->cache.orig_usage++;
638 im->cache.usage_count = use_counter; 641 im->cache.usage_count = use_counter;
@@ -658,29 +661,27 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
658 if (im->image.data) 661 if (im->image.data)
659 { 662 {
660 if (smooth) 663 if (smooth)
661 evas_common_scale_rgba_in_to_out_clip_smooth 664 ret = cb_smooth(im, sci->im, ct,
662 (im, sci->im, ct, 665 src_region_x, src_region_y,
663 src_region_x, src_region_y, 666 src_region_w, src_region_h,
664 src_region_w, src_region_h, 667 0, 0,
665 0, 0, 668 dst_region_w, dst_region_h);
666 dst_region_w, dst_region_h);
667 else 669 else
668 evas_common_scale_rgba_in_to_out_clip_sample 670 ret = cb_sample(im, sci->im, ct,
669 (im, sci->im, ct, 671 src_region_x, src_region_y,
670 src_region_x, src_region_y, 672 src_region_w, src_region_h,
671 src_region_w, src_region_h, 673 0, 0,
672 0, 0, 674 dst_region_w, dst_region_h);
673 dst_region_w, dst_region_h);
674 sci->populate_me = 0; 675 sci->populate_me = 0;
675#if 0 // visual debug of cached images 676#if 0 // visual debug of cached images
676 { 677 {
677 int xx, yy; 678 int xx, yy;
678 DATA32 *pp; 679 DATA32 *pp;
679 680
680 pp = sci->im->image.data; 681 pp = sci->im->image.data;
681 for (yy = 0; yy < dst_region_h; yy++) 682 for (yy = 0; yy < dst_region_h; yy++)
682 { 683 {
683 684
684 for (xx = 0; xx < dst_region_w; xx++) 685 for (xx = 0; xx < dst_region_w; xx++)
685 { 686 {
686 if (yy & 0x1) 687 if (yy & 0x1)
@@ -688,14 +689,14 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
688 if (xx & 0x1) *pp = 0x882288ff; 689 if (xx & 0x1) *pp = 0x882288ff;
689 } 690 }
690 else 691 else
691 { 692 {
692 if (!(xx & 0x1)) *pp = 0x882288ff; 693 if (!(xx & 0x1)) *pp = 0x882288ff;
693 } 694 }
694 pp++; 695 pp++;
695 } 696 }
696 } 697 }
697 } 698 }
698#endif 699#endif
699 } 700 }
700 if (dounload) 701 if (dounload)
701 { 702 {
@@ -706,8 +707,8 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
706 { 707 {
707 cache_size += sci->dst_w * sci->dst_h * 4; 708 cache_size += sci->dst_w * sci->dst_h * 4;
708 } 709 }
709// INF(" + %i @ flop: %i (%ix%i)", 710// INF(" + %i @ flop: %i (%ix%i)",
710// sci->dst_w * sci->dst_h * 4, sci->flop, 711// sci->dst_w * sci->dst_h * 4, sci->flop,
711// sci->dst_w, sci->dst_h); 712// sci->dst_w, sci->dst_h);
712 cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci); 713 cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci);
713 _cache_prune(sci, 0); 714 _cache_prune(sci, 0);
@@ -730,39 +731,38 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
730 } 731 }
731// INF("use cached!"); 732// INF("use cached!");
732 LKU(im->cache.lock); 733 LKU(im->cache.lock);
733 evas_common_scale_rgba_in_to_out_clip_sample 734 ret |= cb_sample(sci->im, dst, dc,
734 (sci->im, dst, dc, 735 0, 0,
735 0, 0, 736 dst_region_w, dst_region_h,
736 dst_region_w, dst_region_h, 737 dst_region_x, dst_region_y,
737 dst_region_x, dst_region_y, 738 dst_region_w, dst_region_h);
738 dst_region_w, dst_region_h);
739// hits++; 739// hits++;
740// INF("check %p %i < %i", 740// INF("check %p %i < %i",
741// im, 741// im,
742// (int)im->cache.orig_usage, 742// (int)im->cache.orig_usage,
743// (int)im->cache.newest_usage); 743// (int)im->cache.newest_usage);
744 /* while framequeuing is applied, 744 /* while framequeuing is applied,
745 * original image data is loaded by the main thread 745 * original image data is loaded by the main thread
746 * just before enqueuing the rendering op into the pipe. 746 * just before enqueuing the rendering op into the pipe.
747 * so unloading the original image data here 747 * so unloading the original image data here
748 * causes only speed-down side-effect and no memory usage gain; 748 * causes only speed-down side-effect and no memory usage gain;
749 * it will be loaded again for the very next rendering for this image. 749 * it will be loaded again for the very next rendering for this image.
750 */ 750 */
751 if (ie->scale_hint != EVAS_IMAGE_SCALE_HINT_DYNAMIC) 751 if (ie->scale_hint != EVAS_IMAGE_SCALE_HINT_DYNAMIC)
752 { 752 {
753 if ((dounload) || 753 if ((dounload) ||
754 ((im->cache_entry.flags.loaded) && 754 ((im->cache_entry.flags.loaded) &&
755 ((!im->cs.no_free) 755 ((!im->cs.no_free)
756#ifdef EVAS_CSERVE 756#ifdef EVAS_CSERVE
757 || (ie->data1) 757 || (ie->data1)
758#endif 758#endif
759#ifdef EVAS_CSERVE2 759#ifdef EVAS_CSERVE2
760 || (ie->data1) 760 || (ie->data1)
761#endif 761#endif
762 ) && 762 ) &&
763 (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888))) 763 (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)))
764 { 764 {
765 if ((dounload) || (im->cache.orig_usage < 765 if ((dounload) || (im->cache.orig_usage <
766 (im->cache.newest_usage / 20))) 766 (im->cache.newest_usage / 20)))
767 { 767 {
768 //FIXME: imagedataunload - inform owners 768 //FIXME: imagedataunload - inform owners
@@ -793,21 +793,26 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
793 if (im->image.data) 793 if (im->image.data)
794 { 794 {
795 if (smooth) 795 if (smooth)
796 evas_common_scale_rgba_in_to_out_clip_smooth(im, dst, dc, 796 ret |= cb_smooth(im, dst, dc,
797 src_region_x, src_region_y, 797 src_region_x, src_region_y,
798 src_region_w, src_region_h, 798 src_region_w, src_region_h,
799 dst_region_x, dst_region_y, 799 dst_region_x, dst_region_y,
800 dst_region_w, dst_region_h); 800 dst_region_w, dst_region_h);
801 else 801 else
802 evas_common_scale_rgba_in_to_out_clip_sample(im, dst, dc, 802 ret |= cb_sample(im, dst, dc,
803 src_region_x, src_region_y, 803 src_region_x, src_region_y,
804 src_region_w, src_region_h, 804 src_region_w, src_region_h,
805 dst_region_x, dst_region_y, 805 dst_region_x, dst_region_y,
806 dst_region_w, dst_region_h); 806 dst_region_w, dst_region_h);
807 } 807 }
808 } 808 }
809#else 809
810 return ret;
811
812#else
813
810 RGBA_Image *im = (RGBA_Image *)ie; 814 RGBA_Image *im = (RGBA_Image *)ie;
815
811 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) 816 if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
812 { 817 {
813#ifdef EVAS_CSERVE2 818#ifdef EVAS_CSERVE2
@@ -821,17 +826,36 @@ evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
821 if (im->image.data) 826 if (im->image.data)
822 { 827 {
823 if (smooth) 828 if (smooth)
824 evas_common_scale_rgba_in_to_out_clip_smooth(im, dst, dc, 829 return cb_smooth(im, dst, dc,
825 src_region_x, src_region_y, 830 src_region_x, src_region_y,
826 src_region_w, src_region_h, 831 src_region_w, src_region_h,
827 dst_region_x, dst_region_y, 832 dst_region_x, dst_region_y,
828 dst_region_w, dst_region_h); 833 dst_region_w, dst_region_h);
829 else 834 else
830 evas_common_scale_rgba_in_to_out_clip_sample(im, dst, dc, 835 return cb_sample(im, dst, dc,
831 src_region_x, src_region_y, 836 src_region_x, src_region_y,
832 src_region_w, src_region_h, 837 src_region_w, src_region_h,
833 dst_region_x, dst_region_y, 838 dst_region_x, dst_region_y,
834 dst_region_w, dst_region_h); 839 dst_region_w, dst_region_h);
835 } 840 }
841
842 return EINA_FALSE;
836#endif 843#endif
837} 844}
845
846
847EAPI void
848evas_common_rgba_image_scalecache_do(Image_Entry *ie, RGBA_Image *dst,
849 RGBA_Draw_Context *dc, int smooth,
850 int src_region_x, int src_region_y,
851 int src_region_w, int src_region_h,
852 int dst_region_x, int dst_region_y,
853 int dst_region_w, int dst_region_h)
854{
855 evas_common_rgba_image_scalecache_do_cbs(
856 ie, dst, dc, smooth,
857 src_region_x, src_region_y, src_region_w, src_region_h,
858 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
859 evas_common_scale_rgba_in_to_out_clip_sample,
860 evas_common_scale_rgba_in_to_out_clip_smooth);
861}
diff --git a/src/lib/evas/common/evas_scale_main.h b/src/lib/evas/common/evas_scale_main.h
index 93fb9bc9d3..1967f422eb 100644
--- a/src/lib/evas/common/evas_scale_main.h
+++ b/src/lib/evas/common/evas_scale_main.h
@@ -6,8 +6,8 @@ typedef Eina_Bool (*Evas_Common_Scale_In_To_Out_Clip_Cb)(RGBA_Image *src, RGBA_I
6EAPI void evas_common_scale_init (void); 6EAPI void evas_common_scale_init (void);
7 7
8EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_cb (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, Evas_Common_Scale_In_To_Out_Clip_Cb cb); 8EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_cb (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, Evas_Common_Scale_In_To_Out_Clip_Cb cb);
9EAPI void evas_common_scale_rgba_in_to_out_clip_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); 9EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_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);
10EAPI void evas_common_scale_rgba_in_to_out_clip_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); 10EAPI Eina_Bool evas_common_scale_rgba_in_to_out_clip_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);
11 11
12EAPI void evas_common_rgba_image_scalecache_dump(void); 12EAPI void evas_common_rgba_image_scalecache_dump(void);
13 13
diff --git a/src/lib/evas/common/evas_scale_sample.c b/src/lib/evas/common/evas_scale_sample.c
index 5e699dc0bb..44b388e7d9 100644
--- a/src/lib/evas/common/evas_scale_sample.c
+++ b/src/lib/evas/common/evas_scale_sample.c
@@ -3,7 +3,7 @@
3 3
4static Eina_Bool scale_rgba_in_to_out_clip_sample_internal(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); 4static Eina_Bool scale_rgba_in_to_out_clip_sample_internal(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);
5 5
6EAPI void 6EAPI Eina_Bool
7evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst, 7evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
8 RGBA_Draw_Context *dc, 8 RGBA_Draw_Context *dc,
9 int src_region_x, int src_region_y, 9 int src_region_x, int src_region_y,
@@ -11,7 +11,7 @@ evas_common_scale_rgba_in_to_out_clip_sample(RGBA_Image *src, RGBA_Image *dst,
11 int dst_region_x, int dst_region_y, 11 int dst_region_x, int dst_region_y,
12 int dst_region_w, int dst_region_h) 12 int dst_region_w, int dst_region_h)
13{ 13{
14 evas_common_scale_rgba_in_to_out_clip_cb 14 return evas_common_scale_rgba_in_to_out_clip_cb
15 (src, dst, dc, 15 (src, dst, dc,
16 src_region_x, src_region_y, src_region_w, src_region_h, 16 src_region_x, src_region_y, src_region_w, src_region_h,
17 dst_region_x, dst_region_y, dst_region_w, dst_region_h, 17 dst_region_x, dst_region_y, dst_region_w, dst_region_h,
diff --git a/src/lib/evas/common/evas_scale_smooth.c b/src/lib/evas/common/evas_scale_smooth.c
index 3e0e7e2da0..c9c51a7f86 100644
--- a/src/lib/evas/common/evas_scale_smooth.c
+++ b/src/lib/evas/common/evas_scale_smooth.c
@@ -180,7 +180,7 @@ evas_common_scale_rgba_in_to_out_clip_smooth_c(RGBA_Image *src, RGBA_Image *dst,
180 return EINA_TRUE; 180 return EINA_TRUE;
181} 181}
182 182
183EAPI void 183EAPI Eina_Bool
184evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst, 184evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
185 RGBA_Draw_Context *dc, 185 RGBA_Draw_Context *dc,
186 int src_region_x, int src_region_y, 186 int src_region_x, int src_region_y,
@@ -199,12 +199,12 @@ evas_common_scale_rgba_in_to_out_clip_smooth(RGBA_Image *src, RGBA_Image *dst,
199#endif 199#endif
200 cb = evas_common_scale_rgba_in_to_out_clip_smooth_c; 200 cb = evas_common_scale_rgba_in_to_out_clip_smooth_c;
201 201
202 evas_common_scale_rgba_in_to_out_clip_cb(src, dst, dc, 202 return evas_common_scale_rgba_in_to_out_clip_cb(src, dst, dc,
203 src_region_x, src_region_y, 203 src_region_x, src_region_y,
204 src_region_w, src_region_h, 204 src_region_w, src_region_h,
205 dst_region_x, dst_region_y, 205 dst_region_x, dst_region_y,
206 dst_region_w, dst_region_h, 206 dst_region_w, dst_region_h,
207 cb); 207 cb);
208} 208}
209 209
210EAPI void 210EAPI void
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 7c00d541f9..b35a9a100c 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -1187,13 +1187,13 @@ _draw_thread_image_draw(void *data)
1187} 1187}
1188 1188
1189static Eina_Bool 1189static Eina_Bool
1190_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) 1190_image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, 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)
1191{ 1191{
1192 Evas_Thread_Command_Image *cr; 1192 Evas_Thread_Command_Image *cr;
1193 int clip_x, clip_y, clip_w, clip_h; 1193 int clip_x, clip_y, clip_w, clip_h;
1194 1194
1195 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return EINA_FALSE; 1195 if ((dst_w <= 0) || (dst_h <= 0)) return EINA_FALSE;
1196 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 1196 if (!(RECTS_INTERSECT(dst_x, dst_y, dst_w, dst_h,
1197 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return EINA_FALSE; 1197 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return EINA_FALSE;
1198 1198
1199 cr = eina_mempool_malloc(_mp_command_image, sizeof (Evas_Thread_Command_Image)); 1199 cr = eina_mempool_malloc(_mp_command_image, sizeof (Evas_Thread_Command_Image));
@@ -1201,8 +1201,8 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
1201 1201
1202 cr->image = src; 1202 cr->image = src;
1203 cr->surface = dst; 1203 cr->surface = dst;
1204 EINA_RECTANGLE_SET(&cr->src, src_region_x, src_region_y, src_region_w, src_region_h); 1204 EINA_RECTANGLE_SET(&cr->src, src_x, src_y, src_w, src_h);
1205 EINA_RECTANGLE_SET(&cr->dst, dst_region_x, dst_region_y, dst_region_w, dst_region_h); 1205 EINA_RECTANGLE_SET(&cr->dst, dst_x, dst_y, dst_w, dst_h);
1206 1206
1207 if (dc->clip.use) 1207 if (dc->clip.use)
1208 { 1208 {
@@ -1231,23 +1231,39 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
1231} 1231}
1232 1232
1233static Eina_Bool 1233static Eina_Bool
1234_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) 1234_image_draw_thread_cmd_smooth(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
1235{ 1235{
1236 return _image_draw_thread_cmd 1236 return _image_draw_thread_cmd(src, dst, dc,
1237 (src, dst, dc, 1237 src_x, src_y, src_w, src_h,
1238 src_region_x, src_region_y, src_region_w, src_region_h, 1238 dst_x, dst_y, dst_w, dst_h,
1239 dst_region_x, dst_region_y, dst_region_w, dst_region_h, 1239 1);
1240 1);
1241} 1240}
1242 1241
1243static Eina_Bool 1242static Eina_Bool
1244_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) 1243_image_draw_thread_cmd_sample(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
1245{ 1244{
1246 return _image_draw_thread_cmd 1245 return _image_draw_thread_cmd(src, dst, dc,
1247 (src, dst, dc, 1246 src_x, src_y, src_w, src_h,
1248 src_region_x, src_region_y, src_region_w, src_region_h, 1247 dst_x, dst_y, dst_w, dst_h,
1249 dst_region_x, dst_region_y, dst_region_w, dst_region_h, 1248 0);
1250 0); 1249}
1250
1251static Eina_Bool
1252_image_thr_cb_smooth(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
1253{
1254 return evas_common_scale_rgba_in_to_out_clip_cb(src, dst, dc,
1255 src_x, src_y, src_w, src_h,
1256 dst_x, dst_y, dst_w, dst_h,
1257 _image_draw_thread_cmd_smooth);
1258}
1259
1260static Eina_Bool
1261_image_thr_cb_sample(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
1262{
1263 return evas_common_scale_rgba_in_to_out_clip_cb(src, dst, dc,
1264 src_x, src_y, src_w, src_h,
1265 dst_x, dst_y, dst_w, dst_h,
1266 _image_draw_thread_cmd_sample);
1251} 1267}
1252 1268
1253static Eina_Bool 1269static Eina_Bool
@@ -1272,20 +1288,16 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
1272 if (!im->cache_entry.flags.loaded) return EINA_FALSE; 1288 if (!im->cache_entry.flags.loaded) return EINA_FALSE;
1273 } 1289 }
1274 1290
1275 evas_common_image_colorspace_normalize(im); 1291 evas_common_rgba_image_scalecache_prepare(image, surface, context, smooth,
1292 src_x, src_y, src_w, src_h,
1293 dst_x, dst_y, dst_w, dst_h);
1276 1294
1277 if (smooth) 1295 return evas_common_rgba_image_scalecache_do_cbs(image, surface,
1278 return evas_common_scale_rgba_in_to_out_clip_cb 1296 context, smooth,
1279 (image, surface, context, 1297 src_x, src_y, src_w, src_h,
1280 src_x, src_y, src_w, src_h, 1298 dst_x, dst_y, dst_w, dst_h,
1281 dst_x, dst_y, dst_w, dst_h, 1299 _image_thr_cb_sample,
1282 _image_draw_thread_cmd_smooth); 1300 _image_thr_cb_smooth);
1283 else
1284 return evas_common_scale_rgba_in_to_out_clip_cb
1285 (image, surface, context,
1286 src_x, src_y, src_w, src_h,
1287 dst_x, dst_y, dst_w, dst_h,
1288 _image_draw_thread_cmd_sample);
1289 } 1301 }
1290#ifdef BUILD_PIPE_RENDER 1302#ifdef BUILD_PIPE_RENDER
1291 else if ((cpunum > 1)) 1303 else if ((cpunum > 1))
@@ -1294,11 +1306,11 @@ eng_image_draw(void *data EINA_UNUSED, void *context, void *surface, void *image
1294 if (evas_cserve2_use_get()) 1306 if (evas_cserve2_use_get())
1295 evas_cache2_image_load_data(&im->cache_entry); 1307 evas_cache2_image_load_data(&im->cache_entry);
1296#endif 1308#endif
1297 evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im), 1309 evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im),
1298 surface, context, smooth, 1310 surface, context, smooth,
1299 src_x, src_y, src_w, src_h, 1311 src_x, src_y, src_w, src_h,
1300 dst_x, dst_y, dst_w, dst_h); 1312 dst_x, dst_y, dst_w, dst_h);
1301 1313
1302 evas_common_pipe_image_draw(im, surface, context, smooth, 1314 evas_common_pipe_image_draw(im, surface, context, smooth,
1303 src_x, src_y, src_w, src_h, 1315 src_x, src_y, src_w, src_h,
1304 dst_x, dst_y, dst_w, dst_h); 1316 dst_x, dst_y, dst_w, dst_h);
@@ -1359,13 +1371,13 @@ image_loaded:
1359} 1371}
1360 1372
1361static void 1373static void
1362_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) 1374_map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, 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)
1363{ 1375{
1364 int clip_x, clip_y, clip_w, clip_h; 1376 int clip_x, clip_y, clip_w, clip_h;
1365 DATA32 mul_col; 1377 DATA32 mul_col;
1366 1378
1367 if ((dst_region_w <= 0) || (dst_region_h <= 0)) return; 1379 if ((dst_w <= 0) || (dst_h <= 0)) return;
1368 if (!(RECTS_INTERSECT(dst_region_x, dst_region_y, dst_region_w, dst_region_h, 1380 if (!(RECTS_INTERSECT(dst_x, dst_y, dst_w, dst_h,
1369 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return; 1381 0, 0, dst->cache_entry.w, dst->cache_entry.h))) return;
1370 1382
1371 if (dc->clip.use) 1383 if (dc->clip.use)
@@ -1385,38 +1397,34 @@ _map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src
1385 mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; 1397 mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
1386 1398
1387 if (smooth) 1399 if (smooth)
1388 evas_common_scale_rgba_smooth_draw 1400 evas_common_scale_rgba_smooth_draw(src, dst,
1389 (src, dst, 1401 clip_x, clip_y, clip_w, clip_h,
1390 clip_x, clip_y, clip_w, clip_h, 1402 mul_col, dc->render_op,
1391 mul_col, dc->render_op, 1403 src_x, src_y, src_w, src_h,
1392 src_region_x, src_region_y, src_region_w, src_region_h, 1404 dst_x, dst_y, dst_w, dst_h);
1393 dst_region_x, dst_region_y, dst_region_w, dst_region_h);
1394 else 1405 else
1395 evas_common_scale_rgba_sample_draw 1406 evas_common_scale_rgba_sample_draw(src, dst,
1396 (src, dst, 1407 clip_x, clip_y, clip_w, clip_h,
1397 clip_x, clip_y, clip_w, clip_h, 1408 mul_col, dc->render_op,
1398 mul_col, dc->render_op, 1409 src_x, src_y, src_w, src_h,
1399 src_region_x, src_region_y, src_region_w, src_region_h, 1410 dst_x, dst_y, dst_w, dst_h);
1400 dst_region_x, dst_region_y, dst_region_w, dst_region_h);
1401} 1411}
1402 1412
1403static Eina_Bool 1413static Eina_Bool
1404_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) 1414_map_image_sample_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
1405{ 1415{
1406 _map_image_draw(src, dst, dc, 1416 _map_image_draw(src, dst, dc,
1407 src_region_x, src_region_y, src_region_w, src_region_h, 1417 src_x, src_y, src_w, src_h,
1408 dst_region_x, dst_region_y, dst_region_w, dst_region_h, 1418 dst_x, dst_y, dst_w, dst_h, 0);
1409 0);
1410 return EINA_TRUE; 1419 return EINA_TRUE;
1411} 1420}
1412 1421
1413static Eina_Bool 1422static Eina_Bool
1414_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) 1423_map_image_smooth_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h)
1415{ 1424{
1416 _map_image_draw(src, dst, dc, 1425 _map_image_draw(src, dst, dc,
1417 src_region_x, src_region_y, src_region_w, src_region_h, 1426 src_x, src_y, src_w, src_h,
1418 dst_region_x, dst_region_y, dst_region_w, dst_region_h, 1427 dst_x, dst_y, dst_w, dst_h, 1);
1419 1);
1420 return EINA_TRUE; 1428 return EINA_TRUE;
1421} 1429}
1422 1430
@@ -1484,7 +1492,7 @@ _draw_thread_map_draw(void *data)
1484 while ((m->count > 4) && (m->count - offset >= 3)); 1492 while ((m->count > 4) && (m->count - offset >= 3));
1485 1493
1486 free_out: 1494 free_out:
1487 free(m); // FIXME: allocating and destroying map do have perf impact... ref counting would be better 1495 free(m);
1488 eina_mempool_free(_mp_command_map, map); 1496 eina_mempool_free(_mp_command_map, map);
1489} 1497}
1490 1498