summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2007-11-19 16:46:39 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2007-11-19 16:46:39 +0000
commitcb62c9705421a57b8da60cd0032ac5ef1b0291ca (patch)
tree771494690453f5f3360ecc297324b52baac7ebcf /apps/plugins
parent51923703fd455088255c52123c7d230772d077ed (diff)
downloadrockbox-cb62c9705421a57b8da60cd0032ac5ef1b0291ca.zip
rockbox-cb62c9705421a57b8da60cd0032ac5ef1b0291ca.tar.gz
rockbox-cb62c9705421a57b8da60cd0032ac5ef1b0291ca.tar.bz2
rockbox-cb62c9705421a57b8da60cd0032ac5ef1b0291ca.tar.xz
prevent useless file reads
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15695 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/viewer.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index 0628e7a..75ecd60 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -974,10 +974,14 @@ static void viewer_top(void)
{
/* Read top of file into buffer
and point screen pointer to top */
- file_pos = 0;
- buffer_end = BUFFER_END(); /* Update whenever file_pos changes */
+ if (file_pos != 0)
+ {
+ file_pos = 0;
+ buffer_end = BUFFER_END(); /* Update whenever file_pos changes */
+ fill_buffer(0, buffer, BUFFER_SIZE);
+ }
+
screen_top_ptr = buffer;
- fill_buffer(0, buffer, BUFFER_SIZE);
}
static void viewer_bottom(void)
@@ -995,10 +999,15 @@ static void viewer_bottom(void)
else {
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;
- fill_buffer(last_sectors, buffer, BUFFER_SIZE);
}
#ifdef HAVE_LCD_BITMAP