summaryrefslogtreecommitdiff
path: root/legacy/evas/src/lib/engines/common/evas_draw_main.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-12-11 04:55:20 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-12-11 04:55:20 +0000
commita0ceee8b51cb79da364f37ca34559c2b57bee829 (patch)
treec611cbfc73221d2a068917092e0f963722d8a7e5 /legacy/evas/src/lib/engines/common/evas_draw_main.c
parente270ac86eb41f44ae1b1e508871cff9ddbd94d95 (diff)
i have to back out all of jose's blend changes - musch faster than
debugging/fixing and likely int he end the exact same result of fixing them. yes - we lose performance - but it actually is correct now :) if we want to do such radical changes- i sugegst moving to premultiplied alpha and makign a tonne of externally tested routines in a test harness first to compare correctness and speed in an isolated environment. SVN revision: 18947
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/lib/engines/common/evas_draw_main.c337
1 files changed, 334 insertions, 3 deletions
diff --git a/legacy/evas/src/lib/engines/common/evas_draw_main.c b/legacy/evas/src/lib/engines/common/evas_draw_main.c
index fab8cb795a..b3fcb23fe5 100644
--- a/legacy/evas/src/lib/engines/common/evas_draw_main.c
+++ b/legacy/evas/src/lib/engines/common/evas_draw_main.c
@@ -578,6 +578,164 @@ evas_common_draw_context_set_color_interpolation(RGBA_Draw_Context *dc, int colo
578 dc->interpolation.color_space = color_space; 578 dc->interpolation.color_space = color_space;
579} 579}
580 580
581Gfx_Func_Blend_Src_Dst
582evas_common_draw_func_blend_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
583{
584 if (src->flags & RGBA_IMAGE_HAS_ALPHA)
585 {
586 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
587 {
588 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
589 return evas_common_blend_pixels_rgba_to_rgba_c;
590 }
591 else
592 {
593#ifdef BUILD_MMX
594# ifdef BUILD_C
595 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
596# endif
597 return evas_common_blend_pixels_rgba_to_rgb_mmx;
598# ifdef BUILD_C
599 else
600# endif
601#endif
602#ifdef BUILD_C
603 return evas_common_blend_pixels_rgba_to_rgb_c;
604#endif
605 }
606 }
607 else
608 {
609 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
610 {
611 return evas_common_copy_pixels_rgb_to_rgba_c;
612 }
613 else
614 {
615#if 1
616
617# ifdef BUILD_MMX
618# ifdef BUILD_C
619 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2))
620# endif
621 return evas_common_copy_pixels_rgba_to_rgba_mmx2;
622# ifdef BUILD_SSE
623 else
624# endif
625#endif
626#ifdef BUILD_SSE
627# ifdef BUILD_C
628 if (evas_common_cpu_has_feature(CPU_FEATURE_SSE) && (pixels > 64 * 64))
629# endif
630 return evas_common_copy_pixels_rgba_to_rgba_sse;
631# ifdef BUILD_MMX
632 else
633# endif
634#endif
635#ifdef BUILD_MMX
636# ifdef BUILD_C
637 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
638# endif
639 return evas_common_copy_pixels_rgba_to_rgba_mmx;
640# ifdef BUILD_C
641 else
642# endif
643#endif
644#ifdef BUILD_C
645 return evas_common_copy_pixels_rgba_to_rgba_c;
646#endif
647
648#else
649
650# ifdef BUILD_SSE
651 if (evas_common_cpu_has_feature(CPU_FEATURE_SSE) && (pixels > 256 * 256))
652 return evas_common_copy_pixels_rgba_to_rgba_sse;
653# ifdef BUILD_MMX
654 else
655# endif
656#endif
657#ifdef BUILD_MMX
658# ifdef BUILD_C
659 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2))
660# endif
661 return evas_common_copy_pixels_rgba_to_rgba_mmx2;
662# ifdef BUILD_C
663 else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
664# endif
665 return evas_common_copy_pixels_rgba_to_rgba_mmx;
666# ifdef BUILD_C
667 else
668# endif
669#endif
670#ifdef BUILD_C
671 return evas_common_copy_pixels_rgba_to_rgba_c;
672#endif
673
674#endif
675 }
676 }
677 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
678 return evas_common_blend_pixels_rgba_to_rgba_c;
679 pixels = 0;
680}
681
682Gfx_Func_Blend_Color_Dst
683evas_common_draw_func_blend_color_get(DATA32 src, RGBA_Image *dst, int pixels)
684{
685 if (A_VAL(&src) != 0xff)
686 {
687 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
688 {
689 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
690 return evas_common_blend_color_rgba_to_rgba_c;
691 }
692 else
693 {
694#ifdef BUILD_MMX
695 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
696 return evas_common_blend_color_rgba_to_rgb_mmx;
697#endif
698#ifdef BUILD_C
699# ifdef BUILD_MMX
700 else
701# endif
702 return evas_common_blend_color_rgba_to_rgb_c;
703#endif
704 }
705 }
706 else
707 {
708 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
709 {
710 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
711 return evas_common_copy_color_rgb_to_rgba_c;
712 }
713 else
714 {
715#ifdef BUILD_SSE
716 if (evas_common_cpu_has_feature(CPU_FEATURE_SSE) && (pixels > 64 * 64))
717 return evas_common_copy_color_rgba_to_rgba_sse;
718#endif
719#ifdef BUILD_MMX
720# ifdef BUILD_SSE
721 else
722# endif
723 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
724 return evas_common_copy_color_rgba_to_rgba_mmx;
725#endif
726#ifdef BUILD_C
727# ifdef BUILD_MMX
728 else
729# endif
730 return evas_common_copy_color_rgba_to_rgba_c;
731#endif
732 }
733 }
734 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
735 return evas_common_blend_color_rgba_to_rgba_c;
736 pixels = 0;
737}
738
581Gfx_Func_Blend_Src_Cmod_Dst 739Gfx_Func_Blend_Src_Cmod_Dst
582evas_common_draw_func_blend_cmod_get(RGBA_Image *src, RGBA_Image *dst, int pixels) 740evas_common_draw_func_blend_cmod_get(RGBA_Image *src, RGBA_Image *dst, int pixels)
583{ 741{
@@ -585,7 +743,7 @@ evas_common_draw_func_blend_cmod_get(RGBA_Image *src, RGBA_Image *dst, int pixel
585 { 743 {
586 if (dst->flags & RGBA_IMAGE_HAS_ALPHA) 744 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
587 { 745 {
588// evas_common_blend_init_evas_pow_lut(); 746 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
589 return evas_common_blend_pixels_cmod_rgba_to_rgba_c; 747 return evas_common_blend_pixels_cmod_rgba_to_rgba_c;
590 } 748 }
591 else 749 else
@@ -597,7 +755,7 @@ evas_common_draw_func_blend_cmod_get(RGBA_Image *src, RGBA_Image *dst, int pixel
597 { 755 {
598 if (dst->flags & RGBA_IMAGE_HAS_ALPHA) 756 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
599 { 757 {
600// evas_common_blend_init_evas_pow_lut(); 758 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
601 return evas_common_copy_pixels_cmod_rgb_to_rgba_c; 759 return evas_common_copy_pixels_cmod_rgb_to_rgba_c;
602 } 760 }
603 else 761 else
@@ -605,9 +763,182 @@ evas_common_draw_func_blend_cmod_get(RGBA_Image *src, RGBA_Image *dst, int pixel
605 return evas_common_copy_pixels_cmod_rgba_to_rgba_c; 763 return evas_common_copy_pixels_cmod_rgba_to_rgba_c;
606 } 764 }
607 } 765 }
608// evas_common_blend_init_evas_pow_lut(); 766 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
609 return evas_common_blend_pixels_cmod_rgba_to_rgba_c; 767 return evas_common_blend_pixels_cmod_rgba_to_rgba_c;
610 pixels = 0; 768 pixels = 0;
611} 769}
612 770
771Gfx_Func_Blend_Src_Mul_Dst
772evas_common_draw_func_blend_mul_get(RGBA_Image *src, DATA32 col, RGBA_Image *dst, int pixels)
773{
774 if (src->flags & RGBA_IMAGE_HAS_ALPHA)
775 {
776 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
777 {
778 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
779 return evas_common_blend_pixels_mul_color_rgba_to_rgba_c;
780 }
781 else
782 {
783#ifdef BUILD_MMX
784 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
785 return evas_common_blend_pixels_mul_color_rgba_to_rgb_mmx;
786#endif
787#ifdef BUILD_C
788# ifdef BUILD_MMX
789 else
790# endif
791 return evas_common_blend_pixels_mul_color_rgba_to_rgb_c;
792#endif
793 }
794 }
795 else
796 {
797 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
798 {
799 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
800 return evas_common_blend_pixels_mul_color_rgba_to_rgba_c;
801 }
802 else
803 {
804#ifdef BUILD_MMX
805 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
806 return evas_common_blend_pixels_mul_color_rgba_to_rgb_mmx;
807#endif
808#ifdef BUILD_C
809# ifdef BUILD_MMX
810 else
811# endif
812 return evas_common_blend_pixels_mul_color_rgba_to_rgb_c;
813#endif
814 }
815 }
816 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
817 return evas_common_blend_pixels_mul_color_rgba_to_rgba_c;
818 col = 0;
819 pixels = 0;
820}
821
822Gfx_Func_Blend_Src_Alpha_Mul_Dst
823evas_common_draw_func_blend_alpha_get(RGBA_Image *dst)
824{
825 if (dst->flags & RGBA_IMAGE_HAS_ALPHA)
826 {
827 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
828 return evas_common_blend_alpha_color_rgba_to_rgba_c;
829 }
830 else
831 {
832#ifdef BUILD_MMX
833 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
834 return evas_common_blend_alpha_color_rgba_to_rgb_mmx;
835#endif
836#ifdef BUILD_C
837# ifdef BUILD_MMX
838 else
839# endif
840 return evas_common_blend_alpha_color_rgba_to_rgb_c;
841#endif
842 }
843#ifdef BUILD_C
844 return evas_common_blend_alpha_color_rgba_to_rgba_c;
845#else
846 return NULL;
847#endif
848}
849
850Gfx_Func_Blend_Src_Dst
851evas_common_draw_func_copy_get(int pixels, int reverse)
852{
853 if (reverse)
854 {
855#ifdef BUILD_SSE
856 if (evas_common_cpu_has_feature(CPU_FEATURE_SSE) && (pixels > 256 * 256))
857 return evas_common_copy_pixels_rev_rgba_to_rgba_sse;
858#endif
859#ifdef BUILD_MMX
860# ifdef BUILD_SSE
861 else
862# endif
863 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
864 return evas_common_copy_pixels_rev_rgba_to_rgba_mmx;
865#endif
866#ifdef BUILD_C
867# ifdef BUILD_MMX
868 else
869# endif
870 return evas_common_copy_pixels_rev_rgba_to_rgba_c;
871#endif
872 }
873 else
874 {
875#if 1
876
877# ifdef BUILD_MMX
878# ifdef BUILD_C
879 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2))
880# endif
881 return evas_common_copy_pixels_rgba_to_rgba_mmx2;
882# ifdef BUILD_SSE
883 else
884# endif
885#endif
886#ifdef BUILD_SSE
887# ifdef BUILD_C
888 if (evas_common_cpu_has_feature(CPU_FEATURE_SSE) && (pixels > 64 * 64))
889# endif
890 return evas_common_copy_pixels_rgba_to_rgba_sse;
891# ifdef BUILD_MMX
892 else
893# endif
894#endif
895#ifdef BUILD_MMX
896# ifdef BUILD_C
897 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
898# endif
899 return evas_common_copy_pixels_rgba_to_rgba_mmx;
900# ifdef BUILD_C
901 else
902# endif
903#endif
904#ifdef BUILD_C
905 return evas_common_copy_pixels_rgba_to_rgba_c;
906#endif
907
908#else
909
910# ifdef BUILD_SSE
911 if (evas_common_cpu_has_feature(CPU_FEATURE_SSE) && (pixels > 256 * 256))
912 return evas_common_copy_pixels_rgba_to_rgba_sse;
913# ifdef BUILD_MMX
914 else
915# endif
916#endif
917#ifdef BUILD_MMX
918# ifdef BUILD_C
919 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2))
920# endif
921 return evas_common_copy_pixels_rgba_to_rgba_mmx2;
922# ifdef BUILD_C
923 else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
924# endif
925 return evas_common_copy_pixels_rgba_to_rgba_mmx;
926# ifdef BUILD_C
927 else
928# endif
929#endif
930#ifdef BUILD_C
931 return evas_common_copy_pixels_rgba_to_rgba_c;
932#endif
933
934#endif
935 }
936 if (!_evas_pow_lut) evas_common_blend_init_evas_pow_lut();
937#ifdef BUILD_C
938 return evas_common_copy_pixels_rgba_to_rgba_c;
939#else
940 return NULL;
941#endif
942 pixels = 0;
943}
613 944