@@ -570,15 +570,19 @@ void LCD_DrawWindowedImageFromFile(u16 x, u16 y, const char *file, s16 w, s16 h,
570570 /* Bitmap start is at lower-left corner */
571571 for (j = 0 ; j < h ; j ++ ) {
572572 u16 * color = NULL ;
573- if (transparent ) {
574- #ifdef TRANSPARENT_COLOR
575- //Display supports a transparent color
576- for (i = 0 ; i < w ; i ++ ) {
577- if (i % FILEBUF_SIZE == 0 ) {
578- fread (buf , w - i > FILEBUF_SIZE ? FILEBUF_SIZE : w - i , 2 , fh );
579- color = (u16 * )buf ;
580- }
573+ #ifndef TRANSPARENT_COLOR
574+ unsigned last_pixel_transparent = row_has_transparency ;
575+ row_has_transparency = 0 ;
576+ #endif
577+ for (i = 0 ; i < w ; i ++ ) {
578+ if (i % FILEBUF_SIZE == 0 ) {
579+ fread (buf , w - i > FILEBUF_SIZE ? FILEBUF_SIZE : w - i , 2 , fh );
580+ color = (u16 * )buf ;
581+ }
581582
583+ if (transparent ) {
584+ #ifdef TRANSPARENT_COLOR
585+ //Display supports a transparent color
582586 u32 c ;
583587 if ((* color & 0x8000 )) {
584588 //convert 1555 -> 565
@@ -588,16 +592,7 @@ void LCD_DrawWindowedImageFromFile(u16 x, u16 y, const char *file, s16 w, s16 h,
588592 }
589593 LCD_DrawPixel (c );
590594 color ++ ;
591- }
592595#else
593- unsigned last_pixel_transparent = row_has_transparency ;
594- row_has_transparency = 0 ;
595- for (i = 0 ; i < w ; i ++ ) {
596- if (i % FILEBUF_SIZE == 0 ) {
597- fread (buf , w - i > FILEBUF_SIZE ? FILEBUF_SIZE : w - i , 2 , fh );
598- color = (u16 * )buf ;
599- }
600-
601596 if ((* color & 0x8000 )) {
602597 //convert 1555 -> 565
603598 unsigned c = ((* color & 0x7fe0 ) << 1 ) | (* color & 0x1f );
@@ -614,20 +609,13 @@ void LCD_DrawWindowedImageFromFile(u16 x, u16 y, const char *file, s16 w, s16 h,
614609 last_pixel_transparent = 1 ;
615610 }
616611 color ++ ;
617- }
618612#endif
619- } else {
620- for (i = 0 ; i < w ; i ++ ) {
621- if (i % FILEBUF_SIZE == 0 ) {
622- fread (buf , w - i > FILEBUF_SIZE ? FILEBUF_SIZE : w - i , 2 , fh );
623- color = (u16 * )buf ;
624- }
625-
613+ } else {
626614 if (LCD_DEPTH == 1 )
627615 * color = (* color & 0x8410 ) == 0x8410 ? 0 : 0xffff ;
628616 LCD_DrawPixel (* color ++ );
629617 }
630- }
618+ }
631619 if ((u16 )w < img_w ) {
632620 fseek (fh , 2 * (img_w - w ), SEEK_CUR );
633621 }
0 commit comments