forked from len0rd/rockbox
lcd_framebuffer bugfixes, sanity checks
several issues I saw that could pontentially cause problems scroll engine doesn't take text height into account when checking bounds NBELEMS was one whole row too large hopefully I got them right this time Change-Id: If303da8320429c3964fc675351cb088d46303745
This commit is contained in:
parent
202f9df0c1
commit
60f642ba4f
7 changed files with 55 additions and 24 deletions
|
|
@ -456,26 +456,26 @@ typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits);
|
|||
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
|
||||
#define LCD_FBSTRIDE(w, h) ((w+7)/8)
|
||||
#define LCD_FBWIDTH LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
||||
#define LCD_NBELEMS(w, h) (((h*LCD_FBSTRIDE(w, h)) + w) / sizeof(fb_data))
|
||||
#define LCD_NBELEMS(w, h) ((((h-1)*LCD_FBSTRIDE(w, h)) + w) / sizeof(fb_data))
|
||||
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
|
||||
#define LCD_FBSTRIDE(w, h) ((h+7)/8)
|
||||
#define LCD_FBHEIGHT LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
||||
#define LCD_NBELEMS(w, h) (((w*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
||||
#define LCD_NBELEMS(w, h) ((((w-1)*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
||||
#endif /* LCD_PIXELFORMAT */
|
||||
#elif LCD_DEPTH == 2
|
||||
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
|
||||
#define LCD_FBSTRIDE(w, h) ((w+3)>>2)
|
||||
#define LCD_NATIVE_STRIDE(s) LCD_FBSTRIDE(s, s)
|
||||
#define LCD_FBWIDTH LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
||||
#define LCD_NBELEMS(w, h) (((h*LCD_FBSTRIDE(w, h)) + w) / sizeof(fb_data))
|
||||
#define LCD_NBELEMS(w, h) ((((h-1)*LCD_FBSTRIDE(w, h)) + w) / sizeof(fb_data))
|
||||
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
|
||||
#define LCD_FBSTRIDE(w, h) ((h+3)/4)
|
||||
#define LCD_FBHEIGHT LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
||||
#define LCD_NBELEMS(w, h) (((w*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
||||
#define LCD_NBELEMS(w, h) ((((w-1)*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
||||
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
|
||||
#define LCD_FBSTRIDE(w, h) ((h+7)/8)
|
||||
#define LCD_FBHEIGHT LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
||||
#define LCD_NBELEMS(w, h) (((w*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
||||
#define LCD_NBELEMS(w, h) ((((w-1)*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
||||
#endif /* LCD_PIXELFORMAT */
|
||||
#endif /* LCD_DEPTH */
|
||||
/* Set defaults if not defined different yet. The defaults apply to both
|
||||
|
|
@ -494,9 +494,9 @@ typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits);
|
|||
|
||||
#ifndef LCD_NBELEMS
|
||||
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||
#define LCD_NBELEMS(w, h) ((w*STRIDE_MAIN(w, h)) + h)
|
||||
#define LCD_NBELEMS(w, h) (((w-1)*STRIDE_MAIN(w, h)) + h)
|
||||
#else
|
||||
#define LCD_NBELEMS(w, h) ((h*STRIDE_MAIN(w, h)) + w)
|
||||
#define LCD_NBELEMS(w, h) (((h-1)*STRIDE_MAIN(w, h)) + w)
|
||||
#endif
|
||||
#define LCD_FBSTRIDE(w, h) STRIDE_MAIN(w, h)
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue