1
0
Fork 0
forked from len0rd/rockbox

prevent useless file reads

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15695 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marcoen Hirschberg 2007-11-19 16:46:39 +00:00
parent 51923703fd
commit cb62c97054

View file

@ -974,10 +974,14 @@ static void viewer_top(void)
{ {
/* Read top of file into buffer /* Read top of file into buffer
and point screen pointer to top */ and point screen pointer to top */
file_pos = 0; if (file_pos != 0)
buffer_end = BUFFER_END(); /* Update whenever file_pos changes */ {
file_pos = 0;
buffer_end = BUFFER_END(); /* Update whenever file_pos changes */
fill_buffer(0, buffer, BUFFER_SIZE);
}
screen_top_ptr = buffer; screen_top_ptr = buffer;
fill_buffer(0, buffer, BUFFER_SIZE);
} }
static void viewer_bottom(void) static void viewer_bottom(void)
@ -995,10 +999,15 @@ static void viewer_bottom(void)
else { else {
last_sectors = 0; last_sectors = 0;
} }
file_pos = last_sectors;
buffer_end = BUFFER_END(); /* Update whenever file_pos changes */ if (file_pos != last_sectors)
{
file_pos = last_sectors;
buffer_end = BUFFER_END(); /* Update whenever file_pos changes */
fill_buffer(last_sectors, buffer, BUFFER_SIZE);
}
screen_top_ptr = buffer_end-1; screen_top_ptr = buffer_end-1;
fill_buffer(last_sectors, buffer, BUFFER_SIZE);
} }
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP