Skip to content

Commit d950e8e

Browse files
committed
fixup! imageviewer: Support cancelling long decoding operations
Change-Id: I9285949c4e94d9930c620c2737b1ae8986c50c5c
1 parent c1f77d8 commit d950e8e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

apps/plugins/imageviewer/jpeg/jpeg_decoder.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,7 +1565,7 @@ int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[3],
15651565

15661566
/* a JPEG decoder specialized in decoding only the luminance (b&w) */
15671567
int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[1], int downscale,
1568-
void (*pf_progress)(int current, int total))
1568+
bool (*pf_progress)(int current, int total))
15691569
{
15701570
struct bitstream bs; /* bitstream "object" */
15711571
int block[64]; /* decoded DCT coefficients */
@@ -1722,7 +1722,8 @@ int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[1], int downscale,
17221722
}
17231723
} /* for x */
17241724
if (pf_progress != NULL)
1725-
pf_progress(y, p_jpeg->y_mbl-1); /* notify about decoding progress */
1725+
if (!pf_progress(y, p_jpeg->y_mbl-1)) /* notify about decoding progress */
1726+
return -1;
17261727
} /* for y */
17271728

17281729
return 0; /* success */

apps/plugins/imageviewer/jpeg/jpeg_decoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[3],
9494
int downscale, bool (*pf_progress)(int current, int total));
9595
#else
9696
int jpeg_decode(struct jpeg* p_jpeg, unsigned char* p_pixel[1], int downscale,
97-
void (*pf_progress)(int current, int total));
97+
bool (*pf_progress)(int current, int total));
9898
#endif
9999

100100

0 commit comments

Comments
 (0)