comparison Discovery/Src/gfx_engine.c @ 119:76fa42fc0b20 FlipDisplay

Cleanup writechar pointers Fill screen with 0 if a line is skipped
author Ideenmodellierer
date Sun, 06 Jan 2019 22:33:26 +0100
parents 79b19d56ab08
children 0d97971b771b
comparison
equal deleted inserted replaced
118:ee7f2cd9b9b4 119:76fa42fc0b20
2625 } 2625 }
2626 if(!found) 2626 if(!found)
2627 return cfg->Xdelta; 2627 return cfg->Xdelta;
2628 2628
2629 pSource = ((uint32_t)Font->chars[i].image->data); 2629 pSource = ((uint32_t)Font->chars[i].image->data);
2630 pDestination = (uint16_t*)(hgfx->Image->FBStartAdress+1); 2630 pDestination = (uint16_t*)(hgfx->Image->FBStartAdress);
2631 2631
2632 heightFont = Font->chars[i].image->height; 2632 heightFont = Font->chars[i].image->height;
2633 widthFont = Font->chars[i].image->width; 2633 widthFont = Font->chars[i].image->width;
2634 2634
2635 height = heightFont*2; 2635 height = heightFont*2;
2693 height /= 2; 2693 height /= 2;
2694 for(i = width; i > 0; i--) 2694 for(i = width; i > 0; i--)
2695 { 2695 {
2696 for (j = height; j > 0; j--) 2696 for (j = height; j > 0; j--)
2697 { 2697 {
2698 *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; 2698 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
2699 pDestination += stepdir; 2699 pDestination += stepdir;
2700 *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; 2700 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
2701 pDestination += stepdir; 2701 pDestination += stepdir;
2702 } 2702 }
2703 pDestination += stepdir * OffsetDestination; 2703 pDestination += stepdir * OffsetDestination;
2704 } 2704 }
2705 } 2705 }
2713 { 2713 {
2714 if(*(uint8_t*)pSource != 0x01) 2714 if(*(uint8_t*)pSource != 0x01)
2715 { 2715 {
2716 for (j = heightFont; j > 0; j--) 2716 for (j = heightFont; j > 0; j--)
2717 { 2717 {
2718 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2718 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2719 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2719 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2720 pDestination += stepdir; 2720 pDestination += stepdir;
2721 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2721 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2722 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2722 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2723 pDestination += stepdir; 2723 pDestination += stepdir;
2724 pSource++; 2724 pSource++;
2725 2725
2726 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2726 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2727 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2727 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2728 pDestination += stepdir; 2728 pDestination += stepdir;
2729 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2729 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2730 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2730 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2731 pDestination += stepdir; 2731 pDestination += stepdir;
2732 pSource++; 2732 pSource++;
2733 2733
2734 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2734 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2735 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2735 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2736 pDestination += stepdir; 2736 pDestination += stepdir;
2737 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2737 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2738 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2738 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2739 pDestination += stepdir; 2739 pDestination += stepdir;
2740 pSource++; 2740 pSource++;
2741 2741
2742 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2742 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2743 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2743 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2744 pDestination += stepdir; 2744 pDestination += stepdir;
2745 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2745 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2746 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2746 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2747 pDestination += stepdir; 2747 pDestination += stepdir;
2748 pSource++; 2748 pSource++;
2749 } 2749 }
2750 pSource += char_truncated_Height; 2750 pSource += char_truncated_Height;
2751 } 2751 }
2752 else 2752 else
2753 { 2753 {
2754 pSource++; 2754 pSource++;
2755 for (j = height; j > 0; j--) 2755 for (j = height; j > 0; j--)
2756 { 2756 {
2757 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2757 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2758 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 |0xFF; 2758 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 |0xFF;
2759 pDestination += stepdir; 2759 pDestination += stepdir;
2760 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2760 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2761 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2761 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2762 pDestination += stepdir; 2762 pDestination += stepdir;
2763 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2763 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2764 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2764 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2765 pDestination += stepdir; 2765 pDestination += stepdir;
2766 *(__IO uint16_t*)pDestination = cfg->color << 8 |0xFF; 2766 *(__IO uint16_t*)pDestination = cfg->color << 8 |0xFF;
2767 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2767 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2768 pDestination += stepdir; 2768 pDestination += stepdir;
2769 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2769 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2770 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2770 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2771 pDestination += stepdir; 2771 pDestination += stepdir;
2772 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2772 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2773 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2773 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2774 pDestination += stepdir; 2774 pDestination += stepdir;
2775 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2775 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2776 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2776 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2777 pDestination += stepdir; 2777 pDestination += stepdir;
2778 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2778 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2779 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2779 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2780 pDestination += stepdir; 2780 pDestination += stepdir;
2781 } 2781 }
2782 } 2782 }
2783 pDestination += (OffsetDestination + nextLine) * stepdir; 2783 pDestination += (OffsetDestination + nextLine) * stepdir;
2784 } 2784 }
2790 { 2790 {
2791 if(*(uint8_t*)pSource != 0x01) 2791 if(*(uint8_t*)pSource != 0x01)
2792 { 2792 {
2793 for (j = heightFont; j > 0; j--) 2793 for (j = heightFont; j > 0; j--)
2794 { 2794 {
2795 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2795 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2796 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2796 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2797 pDestination += stepdir; 2797 pDestination += stepdir;
2798 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2798 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2799 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2799 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2800 pDestination += stepdir; 2800 pDestination += stepdir;
2801 pSource++; 2801 pSource++;
2802 2802
2803 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2803 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2804 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2804 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2805 pDestination += stepdir; 2805 pDestination += stepdir;
2806 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2806 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2807 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | (0xFF - *(uint8_t*)pSource); 2807 *(__IO uint16_t*)(pDestination + nextLine) = (0xFF - *(uint8_t*)pSource) << 8 | cfg->color;
2808 pDestination += stepdir; 2808 pDestination += stepdir;
2809 pSource++; 2809 pSource++;
2810 } 2810 }
2811 pSource += char_truncated_Height; 2811 pSource += char_truncated_Height;
2812 } 2812 }
2813 else 2813 else
2814 { 2814 {
2815 pSource++; 2815 pSource++;
2816 for (j = heightFont; j > 0; j--) 2816 for (j = heightFont; j > 0; j--)
2817 { 2817 {
2818 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2818 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2819 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2819 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2820 pDestination += stepdir; 2820 pDestination += stepdir;
2821 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2821 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2822 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2822 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2823 pDestination += stepdir; 2823 pDestination += stepdir;
2824 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2824 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2825 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2825 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2826 pDestination += stepdir; 2826 pDestination += stepdir;
2827 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 2827 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
2828 *(__IO uint16_t*)(pDestination + nextLine) = cfg->color << 8 | 0xFF; 2828 *(__IO uint16_t*)(pDestination + nextLine) = 0xFF << 8 | cfg->color;
2829 pDestination += stepdir; 2829 pDestination += stepdir;
2830 } 2830 }
2831 } 2831 }
2832 pDestination += (OffsetDestination + nextLine) * stepdir; 2832 pDestination += (OffsetDestination + nextLine) * stepdir;
2833 } 2833 }
2842 { 2842 {
2843 if(*(uint8_t*)pSource != 0x01) 2843 if(*(uint8_t*)pSource != 0x01)
2844 { 2844 {
2845 for (j = heightFont; j > 0; j--) 2845 for (j = heightFont; j > 0; j--)
2846 { 2846 {
2847 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2847 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2848 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2848 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2849 pDestination += stepdir; 2849 pDestination += stepdir;
2850 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2850 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2851 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2851 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2852 pDestination += stepdir; 2852 pDestination += stepdir;
2853 pSource++; 2853 pSource++;
2854 2854
2855 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2855 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2856 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2856 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2857 pDestination += stepdir; 2857 pDestination += stepdir;
2858 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2858 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2859 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2859 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2860 pDestination += stepdir; 2860 pDestination += stepdir;
2861 pSource++; 2861 pSource++;
2862 2862
2863 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2863 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2864 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2864 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2865 pDestination += stepdir; 2865 pDestination += stepdir;
2866 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2866 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2867 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2867 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2868 pDestination += stepdir; 2868 pDestination += stepdir;
2869 pSource++; 2869 pSource++;
2870 2870
2871 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2871 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2872 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2872 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2873 pDestination += stepdir; 2873 pDestination += stepdir;
2874 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2874 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2875 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2875 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2876 pDestination += stepdir; 2876 pDestination += stepdir;
2877 pSource++; 2877 pSource++;
2878 } 2878 }
2879 pSource += char_truncated_Height; 2879 pSource += char_truncated_Height;
2880 } 2880 }
2893 { 2893 {
2894 if(*(uint8_t*)pSource != 0x01) 2894 if(*(uint8_t*)pSource != 0x01)
2895 { 2895 {
2896 for (j = heightFont; j > 0; j--) 2896 for (j = heightFont; j > 0; j--)
2897 { 2897 {
2898 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2898 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2899 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2899 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2900 pDestination += stepdir; 2900 pDestination += stepdir;
2901 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2901 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2902 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2902 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2903 pDestination += stepdir; 2903 pDestination += stepdir;
2904 pSource++; 2904 pSource++;
2905 2905
2906 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2906 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2907 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2907 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2908 pDestination += stepdir; 2908 pDestination += stepdir;
2909 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource; 2909 *(__IO uint16_t*)pDestination = *(uint8_t*)pSource << 8 | cfg->color;
2910 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = cfg->color << 8 | *(uint8_t*)pSource; 2910 *(__IO uint16_t*)(pDestination + (stepdir * nextLine)) = *(uint8_t*)pSource << 8 | cfg->color;
2911 pDestination += stepdir; 2911 pDestination += stepdir;
2912 pSource++; 2912 pSource++;
2913 } 2913 }
2914 pSource += char_truncated_Height; 2914 pSource += char_truncated_Height;
2915 } 2915 }
2965 2965
2966 uint32_t i, j; 2966 uint32_t i, j;
2967 uint32_t width, height; 2967 uint32_t width, height;
2968 uint32_t found; 2968 uint32_t found;
2969 uint16_t* pDestination; 2969 uint16_t* pDestination;
2970 uint16_t* pDestination2;
2970 uint32_t pSource; 2971 uint32_t pSource;
2971 uint32_t OffsetDestination; 2972 uint32_t OffsetDestination;
2972 uint32_t width_left; 2973 uint32_t width_left;
2973 uint32_t height_left; 2974 uint32_t height_left;
2974 uint32_t char_truncated_WidthFlag; 2975 uint32_t char_truncated_WidthFlag;
3013 */ 3014 */
3014 // ----------------------------- 3015 // -----------------------------
3015 3016
3016 3017
3017 pSource = ((uint32_t)Font->chars[i].image->data); 3018 pSource = ((uint32_t)Font->chars[i].image->data);
3018 pDestination = (uint16_t*)(hgfx->Image->FBStartAdress + 1); 3019 pDestination = (uint16_t*)(hgfx->Image->FBStartAdress);
3020
3019 3021
3020 height = Font->chars[i].image->height; 3022 height = Font->chars[i].image->height;
3021 width = Font->chars[i].image->width; 3023 width = Font->chars[i].image->width;
3022 3024
3023 OffsetDestination = hgfx->Image->ImageHeight - height; 3025 OffsetDestination = hgfx->Image->ImageHeight - height;
3078 height /= 2; 3080 height /= 2;
3079 for(i = width; i > 0; i--) 3081 for(i = width; i > 0; i--)
3080 { 3082 {
3081 for (j = height; j > 0; j--) 3083 for (j = height; j > 0; j--)
3082 { 3084 {
3083 *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; 3085 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
3084 pDestination += stepdir; 3086 pDestination += stepdir;
3085 *(__IO uint16_t*)pDestination = cfg->color << 8 | fill; 3087 *(__IO uint16_t*)pDestination = fill << 8 | cfg->color;
3086 pDestination += stepdir; 3088 pDestination += stepdir;
3087 } 3089 }
3088 pDestination += stepdir * OffsetDestination; 3090 pDestination += stepdir * OffsetDestination;
3089 } 3091 }
3090 } 3092 }
3099 if(*(uint8_t*)pSource != 0x01) 3101 if(*(uint8_t*)pSource != 0x01)
3100 { 3102 {
3101 3103
3102 for (j = height; j > 0; j--) 3104 for (j = height; j > 0; j--)
3103 { 3105 {
3104 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); 3106 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
3105 pDestination += stepdir; 3107 pDestination += stepdir;
3106 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); 3108 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
3107 pDestination += stepdir; 3109 pDestination += stepdir;
3108 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); 3110 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
3109 pDestination += stepdir; 3111 pDestination += stepdir;
3110 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); 3112 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
3111 pDestination += stepdir; 3113 pDestination += stepdir;
3112 } 3114 }
3113 pSource += char_truncated_Height; 3115 pSource += char_truncated_Height;
3114 } 3116 }
3115 else /* empty line => fast fill */ 3117 else /* empty line => fast fill */
3116 { 3118 {
3117 pSource++; 3119 pSource++;
3118 for (j = height; j > 0; j--) 3120 for (j = height; j > 0; j--)
3119 { 3121 {
3120 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 3122 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
3121 pDestination += stepdir; 3123 pDestination += stepdir;
3122 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 3124 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
3123 pDestination += stepdir; 3125 pDestination += stepdir;
3124 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 3126 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
3125 pDestination += stepdir; 3127 pDestination += stepdir;
3126 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 3128 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
3127 pDestination += stepdir; 3129 pDestination += stepdir;
3128 } 3130 }
3129 } 3131 }
3130 pDestination += stepdir * OffsetDestination; 3132 pDestination += stepdir * OffsetDestination;
3131 } 3133 }
3137 { 3139 {
3138 if(*(uint8_t*)pSource != 0x01) 3140 if(*(uint8_t*)pSource != 0x01)
3139 { 3141 {
3140 for (j = height; j > 0; j--) 3142 for (j = height; j > 0; j--)
3141 { 3143 {
3142 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); 3144 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
3143 pDestination += stepdir; 3145 pDestination += stepdir;
3144 *(__IO uint16_t*)pDestination = cfg->color << 8 | (0xFF - *(uint8_t*)pSource++); 3146 *(__IO uint16_t*)pDestination = (0xFF - *(uint8_t*)pSource++) << 8 | cfg->color;
3145 pDestination += stepdir; 3147 pDestination += stepdir;
3146 } 3148 }
3147 pSource += char_truncated_Height; 3149 pSource += char_truncated_Height;
3148 } 3150 }
3149 else 3151 else
3150 { 3152 {
3151 pSource++; 3153 pSource++;
3152 for (j = height; j > 0; j--) 3154 for (j = height; j > 0; j--)
3153 { 3155 {
3154 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 3156 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
3155 pDestination += stepdir; 3157 pDestination += stepdir;
3156 *(__IO uint16_t*)pDestination = cfg->color << 8 | 0xFF; 3158 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color;
3157 pDestination += stepdir; 3159 pDestination += stepdir;
3158 } 3160 }
3159 } 3161 }
3160 pDestination += stepdir * OffsetDestination; 3162 pDestination += stepdir * OffsetDestination;
3161 } 3163 }
3172 { 3174 {
3173 if(*(uint8_t*)pSource != 0x01) 3175 if(*(uint8_t*)pSource != 0x01)
3174 { 3176 {
3175 for (j = height; j > 0; j--) 3177 for (j = height; j > 0; j--)
3176 { 3178 {
3177 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; 3179 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
3178 pDestination += stepdir; 3180 pDestination += stepdir;
3179 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; 3181 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
3180 pDestination += stepdir; 3182 pDestination += stepdir;
3181 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; 3183 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
3182 pDestination += stepdir; 3184 pDestination += stepdir;
3183 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; 3185 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
3184 pDestination += stepdir; 3186 pDestination += stepdir;
3185 } 3187 }
3186 pSource += char_truncated_Height; 3188 pSource += char_truncated_Height;
3187 } 3189 }
3188 else 3190 else /* clear line */
3189 { 3191 {
3190 pSource++; 3192 pSource++;
3191 pDestination += stepdir * height * 4; 3193 for (j = height; j > 0; j--)
3194 {
3195 *(__IO uint16_t*)pDestination = cfg->color;
3196 pDestination += stepdir;
3197 *(__IO uint16_t*)pDestination = cfg->color;
3198 pDestination += stepdir;
3199 *(__IO uint16_t*)pDestination = cfg->color;
3200 pDestination += stepdir;
3201 *(__IO uint16_t*)pDestination = cfg->color;
3202 pDestination += stepdir;
3203 }
3192 } 3204 }
3193 pDestination += stepdir * OffsetDestination; 3205 pDestination += stepdir * OffsetDestination;
3194 } 3206 }
3195 } 3207 }
3196
3197 else 3208 else
3198 { 3209 {
3199 height /= 2; 3210 height /= 2;
3200 for(i = width; i > 0; i--) 3211 for(i = width; i > 0; i--)
3201 { 3212 {
3202 if(*(uint8_t*)pSource != 0x01) 3213 if(*(uint8_t*)pSource != 0x01)
3203 { 3214 {
3204 for (j = height; j > 0; j--) 3215 for (j = height; j > 0; j--)
3205 { 3216 {
3206 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; 3217 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
3207 pDestination += stepdir; 3218 pDestination += stepdir;
3208 *(__IO uint16_t*)pDestination = cfg->color << 8 | *(uint8_t*)pSource++; 3219 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color);
3209 pDestination += stepdir; 3220 pDestination += stepdir;
3210 } 3221 }
3211 pSource += char_truncated_Height; 3222 pSource += char_truncated_Height;
3212 } 3223 }
3213 else 3224 else /* clear line */
3214 { 3225 {
3215 pSource++; 3226 pSource++;
3216 pDestination += stepdir * height * 2; 3227 for (j = height; j > 0; j--)
3228 {
3229 *(__IO uint16_t*)pDestination = cfg->color;
3230 pDestination += stepdir;
3231 *(__IO uint16_t*)pDestination = cfg->color;
3232 pDestination += stepdir;
3233 }
3217 } 3234 }
3218 pDestination += stepdir * OffsetDestination; 3235 pDestination += stepdir * OffsetDestination;
3219 } 3236 }
3220 } 3237 }
3221 } 3238 }