From 50da9e696d7be359cdbeaf22bd643f3885827a55 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 11 Dec 2015 16:13:45 +0100 Subject: the kernel-specific functions can fetch and use additional data it may need MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/kern-linux.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/kern-linux.c') diff --git a/src/kern-linux.c b/src/kern-linux.c index 00930f1..7e31d1b 100644 --- a/src/kern-linux.c +++ b/src/kern-linux.c @@ -71,10 +71,13 @@ get_fbpath (int altpath, int fbno) * @param fbpath The path to the framebuffer device.. * @param width Output parameter for the width of the image. * @param height Output parameter for the height of the image. + * @parma data Additional data to pass to `convert_fb_to_pnm` + * and `convert_fb_to_png`. * @return Zero on success, -1 on error. */ int -measure (int fbno, char *restrict fbpath, long *restrict width, long *restrict height) +measure (int fbno, char *restrict fbpath, long *restrict width, + long *restrict height, void **restrict data) { static char buf[sizeof (SYSDIR "/class/graphics/fb/virtual_size") + 3 * sizeof(int)]; /* The string "/class/graphics/fb/virtual_size" is large enought for the call (*) "*/ @@ -126,11 +129,12 @@ measure (int fbno, char *restrict fbpath, long *restrict width, long *restrict h * (a whole number of pixels where available,) * otherwise, set to the number of bytes a * pixel is encoded. + * @param data Data from `measure`. * @return Zero on success, -1 on error. */ int -convert_fb_to_pnm (FILE *restrict file, const char *restrict buf, - size_t n, size_t *restrict adjustment) +convert_fb_to_pnm (FILE *restrict file, const char *restrict buf, size_t n, + size_t *restrict adjustment, void *restrict data) { const uint32_t *restrict pixel; int r, g, b; @@ -169,10 +173,12 @@ convert_fb_to_pnm (FILE *restrict file, const char *restrict buf, * pixel is encoded. * @param state Use this to keep track of where in the you * stopped. It will be 0 on the first call. + * @param data Data from `measure`. * @return Zero on success, -1 on error. */ int convert_fb_to_png (png_struct *pngbuf, png_byte *restrict pixbuf, const char *restrict buf, - size_t n, long width3, size_t *restrict adjustment, long *restrict state) + size_t n, long width3, size_t *restrict adjustment, long *restrict state, + void *restrict data) { const uint32_t *restrict pixel; int r, g, b; -- cgit v1.2.3-70-g09d2