From patchwork Mon Feb 3 14:35:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 235835 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Mon, 3 Feb 2020 07:35:48 -0700 Subject: [PATCH v2 02/32] video: Support truetype fonts on a 32-bit display In-Reply-To: <20200203143618.74619-1-sjg@chromium.org> References: <20200203143618.74619-1-sjg@chromium.org> Message-ID: <20200203073614.v2.2.I25364ae19a2d5679c51aa1cdeebea29d805fbe68@changeid> 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 Reviewed-by: Anatolij Gustschin --- Changes in v2: None drivers/video/console_truetype.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 30086600fb..0a725c5c15 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -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);