Mercurial > public > ostc4
comparison Discovery/Src/gfx_engine.c @ 121:0d97971b771b FlipDisplay
Use 32bit operations for buffer fills
author | Ideenmodellierer |
---|---|
date | Sun, 13 Jan 2019 18:58:23 +0100 |
parents | 76fa42fc0b20 |
children | 87f83879cecb |
comparison
equal
deleted
inserted
replaced
120:6347a86caa18 | 121:0d97971b771b |
---|---|
811 | 811 |
812 | 812 |
813 void GFX_clear_frame_immediately(uint32_t pDestination) | 813 void GFX_clear_frame_immediately(uint32_t pDestination) |
814 { | 814 { |
815 uint32_t i; | 815 uint32_t i; |
816 uint32_t* pfill = (uint32_t*) pDestination; | |
817 | |
816 | 818 |
817 for(i = 200*480; i > 0; i--) | 819 for(i = 200*480; i > 0; i--) |
818 { | 820 { |
819 *(__IO uint16_t*)pDestination = 0; | 821 *pfill++ = 0; |
820 pDestination += 2; | 822 *pfill++ = 0; |
821 *(__IO uint16_t*)pDestination = 0; | |
822 pDestination += 2; | |
823 *(__IO uint16_t*)pDestination = 0; | |
824 pDestination += 2; | |
825 *(__IO uint16_t*)pDestination = 0; | |
826 pDestination += 2; | |
827 } | 823 } |
828 } | 824 } |
829 | 825 |
830 | 826 |
831 void GFX_clear_window_immediately(GFX_DrawCfgWindow* hgfx) | 827 void GFX_clear_window_immediately(GFX_DrawCfgWindow* hgfx) |
870 | 866 |
871 | 867 |
872 void GFX_fill_buffer(uint32_t pDestination, uint8_t alpha, uint8_t color) | 868 void GFX_fill_buffer(uint32_t pDestination, uint8_t alpha, uint8_t color) |
873 { | 869 { |
874 | 870 |
875 union al88_u | 871 union al88_u |
876 { | 872 { |
877 uint8_t al8[2]; | 873 uint8_t al8[2]; |
878 uint16_t al88; | 874 uint16_t al88; |
879 }; | 875 }; |
880 | |
881 union al88_u colorcombination; | 876 union al88_u colorcombination; |
882 uint32_t i; | 877 uint32_t i; |
878 uint32_t* pfill = (uint32_t*) pDestination; | |
879 uint32_t fillpattern; | |
883 | 880 |
884 colorcombination.al8[0] = color; | 881 colorcombination.al8[0] = color; |
885 colorcombination.al8[1] = alpha; | 882 colorcombination.al8[1] = alpha; |
886 | 883 |
887 for(i = 800*480; i > 0; i--) | 884 fillpattern = (colorcombination.al88 << 16) | colorcombination.al88; |
888 { | 885 for(i = 800*480/2; i > 0; i--) |
889 *(__IO uint16_t*)pDestination = colorcombination.al88; | 886 { |
890 pDestination += 2; | 887 *pfill++ = fillpattern; |
891 } | 888 } |
892 } | 889 } |
893 | 890 |
894 | 891 |
895 void gfx_flip(point_t *p1, point_t *p2) | 892 void gfx_flip(point_t *p1, point_t *p2) |
1141 pDestination += (hgfx->ImageHeight - start.y) + (stop.x * hgfx->ImageHeight); | 1138 pDestination += (hgfx->ImageHeight - start.y) + (stop.x * hgfx->ImageHeight); |
1142 pDestination -= (xx - start.x) * hgfx->ImageHeight; | 1139 pDestination -= (xx - start.x) * hgfx->ImageHeight; |
1143 | 1140 |
1144 for(int yy = start.y; yy < stop.y; yy++) | 1141 for(int yy = start.y; yy < stop.y; yy++) |
1145 { | 1142 { |
1146 // *(__IO uint16_t*)pDestination-- = image->data[j++] << 8 | 0xFF; | |
1147 *(__IO uint16_t*)pDestination-- = 0xFF << 8 | image->data[j++]; | 1143 *(__IO uint16_t*)pDestination-- = 0xFF << 8 | image->data[j++]; |
1148 } | 1144 } |
1149 } | 1145 } |
1150 } | 1146 } |
1151 else | 1147 else |
2965 | 2961 |
2966 uint32_t i, j; | 2962 uint32_t i, j; |
2967 uint32_t width, height; | 2963 uint32_t width, height; |
2968 uint32_t found; | 2964 uint32_t found; |
2969 uint16_t* pDestination; | 2965 uint16_t* pDestination; |
2970 uint16_t* pDestination2; | |
2971 uint32_t pSource; | 2966 uint32_t pSource; |
2972 uint32_t OffsetDestination; | 2967 uint32_t OffsetDestination; |
2973 uint32_t width_left; | 2968 uint32_t width_left; |
2974 uint32_t height_left; | 2969 uint32_t height_left; |
2975 uint32_t char_truncated_WidthFlag; | 2970 uint32_t char_truncated_WidthFlag; |
2976 uint32_t char_truncated_Height; | 2971 uint32_t char_truncated_Height; |
2977 uint8_t fill; | 2972 uint8_t fill; |
2973 uint32_t fillpattern; | |
2978 int16_t stepdir; | 2974 int16_t stepdir; |
2979 | 2975 |
2980 SSettings* pSettings; | 2976 SSettings* pSettings; |
2981 pSettings = settingsGetPointer(); | 2977 pSettings = settingsGetPointer(); |
2982 | 2978 |
3115 pSource += char_truncated_Height; | 3111 pSource += char_truncated_Height; |
3116 } | 3112 } |
3117 else /* empty line => fast fill */ | 3113 else /* empty line => fast fill */ |
3118 { | 3114 { |
3119 pSource++; | 3115 pSource++; |
3116 fillpattern = (( 0xFF << 8 | cfg->color) << 16) | ( 0xFF << 8 | cfg->color); | |
3117 if(pSettings->FlipDisplay) pDestination--; /* address fill from high to low */ | |
3120 for (j = height; j > 0; j--) | 3118 for (j = height; j > 0; j--) |
3121 { | 3119 { |
3122 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color; | 3120 *(__IO uint32_t*)pDestination = fillpattern; |
3123 pDestination += stepdir; | 3121 pDestination += stepdir; |
3124 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color; | 3122 pDestination += stepdir; |
3125 pDestination += stepdir; | 3123 *(__IO uint32_t*)pDestination = fillpattern; |
3126 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color; | 3124 pDestination += stepdir; |
3127 pDestination += stepdir; | |
3128 *(__IO uint16_t*)pDestination = 0xFF << 8 | cfg->color; | |
3129 pDestination += stepdir; | 3125 pDestination += stepdir; |
3130 } | 3126 } |
3127 if(pSettings->FlipDisplay) pDestination++; | |
3131 } | 3128 } |
3132 pDestination += stepdir * OffsetDestination; | 3129 pDestination += stepdir * OffsetDestination; |
3133 } | 3130 } |
3134 } | 3131 } |
3135 else | 3132 else |
3183 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color); | 3180 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color); |
3184 pDestination += stepdir; | 3181 pDestination += stepdir; |
3185 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color); | 3182 *(__IO uint16_t*)pDestination = ( *(uint8_t*)pSource++ << 8) | (cfg->color); |
3186 pDestination += stepdir; | 3183 pDestination += stepdir; |
3187 } | 3184 } |
3185 | |
3188 pSource += char_truncated_Height; | 3186 pSource += char_truncated_Height; |
3189 } | 3187 } |
3190 else /* clear line */ | 3188 else /* clear line */ |
3191 { | 3189 { |
3192 pSource++; | 3190 pSource++; |
3191 fillpattern = (cfg->color << 16) | cfg->color; | |
3192 if(pSettings->FlipDisplay) pDestination--; /* address fill from high to low */ | |
3193 | |
3193 for (j = height; j > 0; j--) | 3194 for (j = height; j > 0; j--) |
3194 { | 3195 { |
3195 *(__IO uint16_t*)pDestination = cfg->color; | 3196 *(__IO uint32_t*)pDestination = fillpattern; |
3196 pDestination += stepdir; | 3197 pDestination += stepdir; |
3197 *(__IO uint16_t*)pDestination = cfg->color; | 3198 pDestination += stepdir; |
3198 pDestination += stepdir; | 3199 *(__IO uint32_t*)pDestination = fillpattern; |
3199 *(__IO uint16_t*)pDestination = cfg->color; | 3200 pDestination += stepdir; |
3200 pDestination += stepdir; | |
3201 *(__IO uint16_t*)pDestination = cfg->color; | |
3202 pDestination += stepdir; | 3201 pDestination += stepdir; |
3203 } | 3202 } |
3203 if(pSettings->FlipDisplay) pDestination++; | |
3204 } | 3204 } |
3205 pDestination += stepdir * OffsetDestination; | 3205 pDestination += stepdir * OffsetDestination; |
3206 } | 3206 } |
3207 } | 3207 } |
3208 else | 3208 else |