| 772 | //=======================================================stack_blur_rgba32 |
| 773 | template<class Img> |
| 774 | void stack_blur_rgba32(Img& img, unsigned rx, unsigned ry) |
| 775 | { |
| 776 | typedef typename Img::color_type color_type; |
| 777 | typedef typename Img::order_type order_type; |
| 778 | enum order_e |
| 779 | { |
| 780 | R = order_type::R, |
| 781 | G = order_type::G, |
| 782 | B = order_type::B, |
| 783 | A = order_type::A |
| 784 | }; |
| 785 | |
| 786 | unsigned x, y, xp, yp, i; |
| 787 | unsigned stack_ptr; |
| 788 | unsigned stack_start; |
| 789 | |
| 790 | const int8u* src_pix_ptr; |
| 791 | int8u* dst_pix_ptr; |
| 792 | color_type* stack_pix_ptr; |
| 793 | |
| 794 | unsigned sum_r; |
| 795 | unsigned sum_g; |
| 796 | unsigned sum_b; |
| 797 | unsigned sum_a; |
| 798 | unsigned sum_in_r; |
| 799 | unsigned sum_in_g; |
| 800 | unsigned sum_in_b; |
| 801 | unsigned sum_in_a; |
| 802 | unsigned sum_out_r; |
| 803 | unsigned sum_out_g; |
| 804 | unsigned sum_out_b; |
| 805 | unsigned sum_out_a; |
| 806 | |
| 807 | unsigned w = img.width(); |
| 808 | unsigned h = img.height(); |
| 809 | unsigned wm = w - 1; |
| 810 | unsigned hm = h - 1; |
| 811 | |
| 812 | unsigned div; |
| 813 | unsigned mul_sum; |
| 814 | unsigned shr_sum; |
| 815 | |
| 816 | pod_vector<color_type> stack; |
| 817 | |
| 818 | if(rx > 0) |
| 819 | { |
| 820 | if(rx > 254) rx = 254; |
| 821 | div = rx * 2 + 1; |
| 822 | mul_sum = stack_blur_tables<int>::g_stack_blur8_mul[rx]; |
| 823 | shr_sum = stack_blur_tables<int>::g_stack_blur8_shr[rx]; |
| 824 | stack.allocate(div); |
| 825 | |
| 826 | for(y = 0; y < h; y++) |
| 827 | { |
| 828 | sum_r = |
| 829 | sum_g = |
| 830 | sum_b = |
| 831 | sum_a = |