]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: Skip bitmaps which do not fit into the screen in cfb_console
authorVadim Bendebury <vbendeb@chromium.org>
Fri, 28 Sep 2012 15:11:17 +0000 (15:11 +0000)
committerAnatolij Gustschin <agust@denx.de>
Tue, 6 Nov 2012 23:57:27 +0000 (00:57 +0100)
The cfb console driver is trying to prevent bitmaps to spill over the
screen, but the calculations assume that at least part of the bitmap
fits into the screen area. In reality there could be bitmap elements
which are completely out of the screen area, they just need to be
discarded.

Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/video/cfb_console.c

index 6f5d4f295749862e655754fc47c37760c0aa41bd..9388859da7e07f52ca324adfabdd49f9fbadbe08 100644 (file)
@@ -1515,6 +1515,13 @@ int video_display_bitmap(ulong bmp_image, int x, int y)
 
        padded_line = (((width * bpp + 7) / 8) + 3) & ~0x3;
 
+       /*
+        * Just ignore elements which are completely beyond screen
+        * dimensions.
+        */
+       if ((x >= VIDEO_VISIBLE_COLS) || (y >= VIDEO_VISIBLE_ROWS))
+               return 0;
+
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
        if (x == BMP_ALIGN_CENTER)
                x = max(0, (VIDEO_VISIBLE_COLS - width) / 2);