diff options
author | Roman Artiukhin <bahusdrive@gmail.com> | 2024-10-14 21:33:40 +0300 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2024-10-28 12:46:51 -0400 |
commit | 55a5bfe7409677a26437651798abbc6d87b56089 (patch) | |
tree | 7ab7d96f52ee15257b174e75f15abae1f09b74cf /apps/plugins/imageviewer/ppm/ppm.c | |
parent | c1bcebd9986b1e2120fd05ead67754d444dae7d3 (diff) | |
download | rockbox-55a5bfe7409677a26437651798abbc6d87b56089.tar.gz rockbox-55a5bfe7409677a26437651798abbc6d87b56089.zip |
View Album Art from WPS context menu
Add ability to imageviewer to view current track embedded/folder album art
Add "View Album Art" WPS context menu item
Change-Id: I49caebd38e5e3e2910d418bbeaa5e51da0e6bd93
Diffstat (limited to 'apps/plugins/imageviewer/ppm/ppm.c')
-rw-r--r-- | apps/plugins/imageviewer/ppm/ppm.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/plugins/imageviewer/ppm/ppm.c b/apps/plugins/imageviewer/ppm/ppm.c index 5e03f8c335..6f59b1f6b0 100644 --- a/apps/plugins/imageviewer/ppm/ppm.c +++ b/apps/plugins/imageviewer/ppm/ppm.c | |||
@@ -75,7 +75,8 @@ static int img_mem(int ds) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static int load_image(char *filename, struct image_info *info, | 77 | static int load_image(char *filename, struct image_info *info, |
78 | unsigned char *buf, ssize_t *buf_size) | 78 | unsigned char *buf, ssize_t *buf_size, |
79 | int offset, int filesize) | ||
79 | { | 80 | { |
80 | int fd; | 81 | int fd; |
81 | int rc = PLUGIN_OK; | 82 | int rc = PLUGIN_OK; |
@@ -83,7 +84,7 @@ static int load_image(char *filename, struct image_info *info, | |||
83 | int w, h; /* used to center output */ | 84 | int w, h; /* used to center output */ |
84 | 85 | ||
85 | unsigned char *memory, *memory_max; | 86 | unsigned char *memory, *memory_max; |
86 | size_t memory_size, file_size; | 87 | size_t memory_size; |
87 | 88 | ||
88 | /* cleanup */ | 89 | /* cleanup */ |
89 | memset(&disp, 0, sizeof(disp)); | 90 | memset(&disp, 0, sizeof(disp)); |
@@ -100,13 +101,20 @@ static int load_image(char *filename, struct image_info *info, | |||
100 | return PLUGIN_ERROR; | 101 | return PLUGIN_ERROR; |
101 | } | 102 | } |
102 | 103 | ||
103 | file_size = rb->filesize(fd); | 104 | if (offset) |
105 | { | ||
106 | rb->lseek(fd, offset, SEEK_SET); | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | filesize = rb->filesize(fd); | ||
111 | } | ||
104 | DEBUGF("reading file '%s'\n", filename); | 112 | DEBUGF("reading file '%s'\n", filename); |
105 | 113 | ||
106 | if (!iv->running_slideshow) | 114 | if (!iv->running_slideshow) |
107 | { | 115 | { |
108 | rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); | 116 | rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); |
109 | rb->lcd_putsf(0, 1, "loading %zu bytes", file_size); | 117 | rb->lcd_putsf(0, 1, "loading %zu bytes", filesize); |
110 | rb->lcd_update(); | 118 | rb->lcd_update(); |
111 | } | 119 | } |
112 | 120 | ||