]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: Support truetype fonts on a 32-bit display
authorSimon Glass <sjg@chromium.org>
Mon, 3 Feb 2020 14:35:48 +0000 (07:35 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 6 Feb 2020 02:33:46 +0000 (19:33 -0700)
At present only a 16bpp display is supported for Truetype fonts. Add
support for 32bpp also since this is quite common.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anatolij Gustschin <agust@denx.de>
drivers/video/console_truetype.c

index 30086600fb1fd973b5b7b094c4494e7498f254c3..0a725c5c15a31b3e667ae77f181e6fecc93d775d 100644 (file)
@@ -286,6 +286,27 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y,
                        }
                        break;
                }
+#endif
+#ifdef CONFIG_VIDEO_BPP32
+               case VIDEO_BPP32: {
+                       u32 *dst = (u32 *)line + xoff;
+                       int i;
+
+                       for (i = 0; i < width; i++) {
+                               int val = *bits;
+                               int out;
+
+                               if (vid_priv->colour_bg)
+                                       val = 255 - val;
+                               out = val | val << 8 | val << 16;
+                               if (vid_priv->colour_fg)
+                                       *dst++ |= out;
+                               else
+                                       *dst++ &= out;
+                               bits++;
+                       }
+                       break;
+               }
 #endif
                default:
                        free(data);