Skip to content
Commit 2015f707 authored by Kevin Corry's avatar Kevin Corry Committed by Ross Burton
Browse files

Fix text width calculation.



Psplash: Fix text width calculation.

Using the "psplash-write MSG <message_text>" command, you can display messages
when the splash screen is running. As part of this, psplash needs to calculate
the height and width of the box to render on the screen to hold the text (which
will appear on top of the background image), which it does in the
psplash_fb_text_size() function in psplash-fb.c.

If the message contains multiple lines (i.e. it contains one or more newline
characters), then it looks like the intention is for psplash to use the length
of the longest single line as the width of this text box. However, there's a
bug in this calculation that leads to some multi-line messages being rendered
off the left edge of the screen, instead of properly centered.

To fix this, each time a newline is encountered, if the width of the current
line (w) is greater than the maximum line width (mw), update the maximum width.
Also, reset the current line width to zero so we can correctly calculate the
width of the next line.

Signed-off-by: default avatarKevin Corry <kevin@corry.com>
Signed-off-by: default avatarRoss Burton <ross.burton@intel.com>
parent 5b3c1cc2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment