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/png/png.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/png/png.c')
-rw-r--r-- | apps/plugins/imageviewer/png/png.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/apps/plugins/imageviewer/png/png.c b/apps/plugins/imageviewer/png/png.c index 29b6713585..34a8a1fd34 100644 --- a/apps/plugins/imageviewer/png/png.c +++ b/apps/plugins/imageviewer/png/png.c | |||
@@ -89,7 +89,8 @@ static int img_mem(int ds) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | static int load_image(char *filename, struct image_info *info, | 91 | static int load_image(char *filename, struct image_info *info, |
92 | unsigned char *buf, ssize_t *buf_size) | 92 | unsigned char *buf, ssize_t *buf_size, |
93 | int offset, int file_size) | ||
93 | { | 94 | { |
94 | int fd; | 95 | int fd; |
95 | long time = 0; /* measured ticks */ | 96 | long time = 0; /* measured ticks */ |
@@ -97,7 +98,7 @@ static int load_image(char *filename, struct image_info *info, | |||
97 | LodePNG_Decoder *p_decoder = &decoder; | 98 | LodePNG_Decoder *p_decoder = &decoder; |
98 | 99 | ||
99 | unsigned char *memory, *memory_max, *image; | 100 | unsigned char *memory, *memory_max, *image; |
100 | size_t memory_size, file_size; | 101 | size_t memory_size; |
101 | 102 | ||
102 | /* cleanup */ | 103 | /* cleanup */ |
103 | memset(&disp, 0, sizeof(disp)); | 104 | memset(&disp, 0, sizeof(disp)); |
@@ -113,7 +114,15 @@ static int load_image(char *filename, struct image_info *info, | |||
113 | rb->splashf(HZ, "err opening %s: %d", filename, fd); | 114 | rb->splashf(HZ, "err opening %s: %d", filename, fd); |
114 | return PLUGIN_ERROR; | 115 | return PLUGIN_ERROR; |
115 | } | 116 | } |
116 | file_size = rb->filesize(fd); | 117 | |
118 | if (offset) | ||
119 | { | ||
120 | rb->lseek(fd, offset, SEEK_SET); | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | file_size = rb->filesize(fd); | ||
125 | } | ||
117 | 126 | ||
118 | DEBUGF("reading file '%s'\n", filename); | 127 | DEBUGF("reading file '%s'\n", filename); |
119 | 128 | ||
@@ -122,7 +131,7 @@ static int load_image(char *filename, struct image_info *info, | |||
122 | rb->lcd_update(); | 131 | rb->lcd_update(); |
123 | } | 132 | } |
124 | 133 | ||
125 | if (file_size > memory_size) { | 134 | if ((size_t)file_size > memory_size) { |
126 | p_decoder->error = FILE_TOO_LARGE; | 135 | p_decoder->error = FILE_TOO_LARGE; |
127 | rb->close(fd); | 136 | rb->close(fd); |
128 | 137 | ||