1
0
Fork 0
forked from len0rd/rockbox

Lcd save function pointer to frame buffer get_address_fn before loops

Calling multiple levels of indirection in a loop slows things down

Really these need to be rewritten to take a start and end address
like most of the rest of the codebase

But this is safer without having test hardware in hand

Change-Id: Idae7b92ee779d020ed7fcc9334e2d5a9c710e64d
This commit is contained in:
William Wilgus 2022-03-21 18:54:52 -04:00
parent 60e5786b48
commit cfeeb7889d
23 changed files with 78 additions and 40 deletions

View file

@ -214,6 +214,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
int d, dinc1, dinc2;
int x, xinc1, xinc2;
int y, yinc1, yinc2;
int x_vp, y_vp, w_vp, h_vp;
lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[lcd_current_viewport->drawmode];
deltay = abs(y2 - y1);
@ -268,16 +269,23 @@ void lcd_drawline(int x1, int y1, int x2, int y2)
x = x1;
y = y1;
void *(*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn;
x_vp = lcd_current_viewport->x;
y_vp = lcd_current_viewport->y;
w_vp = lcd_current_viewport->width;
h_vp = lcd_current_viewport->height;
for (i = 0; i < numpixels; i++)
{
if ( ((unsigned)x < (unsigned)lcd_current_viewport->width)
&& ((unsigned)y < (unsigned)lcd_current_viewport->height)
if ((x >= 0 && y >= 0)
&& (x < w_vp)
&& (y < h_vp)
#if defined(HAVE_VIEWPORT_CLIP)
&& ((unsigned)x < (unsigned)LCD_WIDTH)
&& ((unsigned)y < (unsigned)LCD_HEIGHT)
&& (x < LCD_WIDTH)
&& (y < LCD_HEIGHT)
#endif
)
pfunc(FBADDR(x + lcd_current_viewport->x, y + lcd_current_viewport->y));
pfunc(fbaddr( x + x_vp, y + y_vp));
if (d < 0)
{