summaryrefslogtreecommitdiff
path: root/drivers/video/console_rotate.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-02 21:12:17 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-07-09 12:33:24 +0800
commit9beb364a2844605ae664c048853bcfef769f9464 (patch)
tree265096bade1fda7186b34428a429e515f758ed52 /drivers/video/console_rotate.c
parenta254d11dda3064489eeffa5cb935b212986627f3 (diff)
video: Adjust rotated console to start at right edge
At present when the console is rotated 180 degrees it starts almost a whole character to the left of the right edge (typically 7 pixels with an 8-pixel-wide font). On a display which aligns with the font width, this just wastes space. On a display that does not this can result in x_frac going negative for the final character (the one on the left side) and the overflow -EAGAIN check at the start of the function failing. Change the function to start at the rightmost pixel to fix these problems. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de> Tested-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/video/console_rotate.c')
-rw-r--r--drivers/video/console_rotate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c
index 8bb05ae02c..da0ce7b9ce 100644
--- a/drivers/video/console_rotate.c
+++ b/drivers/video/console_rotate.c
@@ -212,7 +212,7 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch)
if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
return -EAGAIN;
linenum = vid_priv->ysize - y - 1;
- x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - VIDEO_FONT_WIDTH - 1;
+ x = vid_priv->xsize - VID_TO_PIXEL(x_frac) - 1;
line = vid_priv->fb + linenum * vid_priv->line_length + x * pbytes;
for (row = 0; row < VIDEO_FONT_HEIGHT; row++) {