@@ -617,18 +617,15 @@ def draw_text8x8(self, x, y, text, color, background=0,
617
617
# Confirm coordinates in boundary
618
618
if self .is_off_grid (x , y , x + 7 , y + 7 ):
619
619
return
620
- # Rearrange color
621
- r = (color & 0xF800 ) >> 8
622
- g = (color & 0x07E0 ) >> 3
623
- b = (color & 0x1F ) << 3
624
620
buf = bytearray (w * 16 )
625
621
fbuf = FrameBuffer (buf , w , h , RGB565 )
626
622
if background != 0 :
627
- bg_r = (background & 0xF800 ) >> 8
628
- bg_g = (background & 0x07E0 ) >> 3
629
- bg_b = (background & 0x1F ) << 3
630
- fbuf .fill (color565 (bg_b , bg_r , bg_g ))
631
- fbuf .text (text , 0 , 0 , color565 (b , r , g ))
623
+ # Swap background color bytes to correct for framebuf endianness
624
+ b_color = ((background & 0xFF ) << 8 ) | ((background & 0xFF00 ) >> 8 )
625
+ fbuf .fill (b_color )
626
+ # Swap text color bytes to correct for framebuf endianness
627
+ t_color = ((color & 0x00FF ) << 8 ) | ((color & 0xFF00 ) >> 8 )
628
+ fbuf .text (text , 0 , 0 , t_color )
632
629
if rotate == 0 :
633
630
self .block (x , y , x + w - 1 , y + (h - 1 ), buf )
634
631
elif rotate == 90 :
0 commit comments