diff options
Diffstat (limited to '')
-rw-r--r-- | po/sv.po | 16 | ||||
-rw-r--r-- | src/kern-linux.c | 14 | ||||
-rw-r--r-- | src/kern.h | 14 | ||||
-rw-r--r-- | src/png.c | 6 | ||||
-rw-r--r-- | src/png.h | 4 | ||||
-rw-r--r-- | src/pnm.c | 6 | ||||
-rw-r--r-- | src/pnm.h | 4 | ||||
-rw-r--r-- | src/scrotty.c | 12 |
8 files changed, 50 insertions, 26 deletions
@@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: scrotty 1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-12-11 13:21+0100\n" +"POT-Creation-Date: 2015-12-11 16:12+0100\n" "PO-Revision-Date: 2015-12-07 18:50+0100\n" "Last-Translator: Mattias Andrée <maandree@member.fsf.org>\n" "Language-Team: none\n" @@ -17,34 +17,34 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: src/scrotty.c:225 +#: src/scrotty.c:229 #, c-format msgid "Saved framebuffer %i to %s.\n" msgstr "Bildrutebuffert %i sparad till %s.\n" -#: src/scrotty.c:357 src/scrotty.c:361 src/scrotty.c:367 +#: src/scrotty.c:361 src/scrotty.c:365 src/scrotty.c:371 #, c-format msgid "%s: %s. Type '%s --help' for help.\n" msgstr "%s: %s. Kör '%s --help' för hjälp.\n" -#: src/scrotty.c:357 +#: src/scrotty.c:361 msgid "--exec is used twice." msgstr "--exec förkommer mer än en gång." -#: src/scrotty.c:361 +#: src/scrotty.c:365 msgid "Invalid input." msgstr "Ogiltig indata." -#: src/scrotty.c:367 +#: src/scrotty.c:371 msgid "FILENAME-PATTERN is used twice." msgstr "FILNAMNSMÖNSTER förekommer mer än en gång" -#: src/scrotty.c:380 +#: src/scrotty.c:384 #, c-format msgid "%s: It looks like you are inside a display server. If this is correct, what you see is probably not what you get.\n" msgstr "%s: Det ser ut som att du är innan för en grafikserver. Om detta är korrect, vad de ser är troligtvis inte vad du får.\n" -#: src/scrotty.c:390 +#: src/scrotty.c:394 #, c-format msgid "%s: %s: %s\n" msgstr "%s: %s: %s\n" 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; @@ -58,9 +58,12 @@ char *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); +int measure (int fbno, char *restrict fbpath, long *restrict width, + long *restrict height, void **restrict data); /** * Convert read data from a framebuffer to PNM pixel data. @@ -72,10 +75,11 @@ int measure (int fbno, char *restrict fbpath, long *restrict width, long *restri * (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); +int convert_fb_to_pnm (FILE *restrict file, const char *restrict buf, size_t n, + size_t *restrict adjustment, void *restrict data); /** * Convert read data from a framebuffer to PNG pixel data. @@ -90,8 +94,10 @@ int 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); @@ -37,10 +37,12 @@ * @param width The width of the image. * @param height The height of the image. * @param imgfd The file descriptor connected to conversion process's stdin. + * @param data Additional data for `convert_fb_to_pnm` + * and `convert_fb_to_png`. * @return Zero on success, -1 on error. */ int -save_png (int fbfd, long width, long height, int imgfd) +save_png (int fbfd, long width, long height, int imgfd, void *restrict data) { char buf[8 << 10]; FILE *file = NULL; @@ -94,7 +96,7 @@ save_png (int fbfd, long width, long height, int imgfd) /* Convert read pixels. */ if (convert_fb_to_png (pngbuf, pixbuf, buf, (size_t)got, - width3, &adjustment, &state) < 0) + width3, &adjustment, &state, data) < 0) goto fail; /* If we read a whole number of pixels, reset the buffer, otherwise, @@ -58,8 +58,10 @@ * @param width The width of the image. * @param height The height of the image. * @param imgfd The file descriptor connected to conversion process's stdin. + * @param data Additional data for `convert_fb_to_pnm` + * and `convert_fb_to_png`. * @return Zero on success, -1 on error. */ int -save_png (int fbfd, long width, long height, int imgfd); +save_png (int fbfd, long width, long height, int imgfd, void *restrict data); @@ -55,10 +55,12 @@ const char* inttable[] = * @param width The width of the image. * @param height The height of the image. * @param imgfd The file descriptor connected to conversion process's stdin. + * @param data Additional data for `convert_fb_to_pnm` + * and `convert_fb_to_png`. * @return Zero on success, -1 on error. */ int -save_pnm (int fbfd, long width, long height, int imgfd) +save_pnm (int fbfd, long width, long height, int imgfd, void *restrict data) { char buf[8 << 10]; FILE *file = NULL; @@ -88,7 +90,7 @@ save_pnm (int fbfd, long width, long height, int imgfd) got += off; /* Convert read pixels. */ - if (convert_fb_to_pnm (file, buf, (size_t)got, &adjustment) < 0) + if (convert_fb_to_pnm (file, buf, (size_t)got, &adjustment, data) < 0) goto fail; /* If we read a whole number of pixels, reset the buffer, otherwise, @@ -54,7 +54,9 @@ extern const char* inttable[]; * @param width The width of the image. * @param height The height of the image. * @param imgfd The file descriptor connected to conversion process's stdin. + * @param data Additional data for `convert_fb_to_pnm` + * and `convert_fb_to_png`. * @return Zero on success, -1 on error. */ -int save_pnm (int fbfd, long width, long height, int imgfd); +int save_pnm (int fbfd, long width, long height, int imgfd, void *restrict data); diff --git a/src/scrotty.c b/src/scrotty.c index 4bc6982..32b2168 100644 --- a/src/scrotty.c +++ b/src/scrotty.c @@ -71,10 +71,13 @@ static int try_alt_fbpath = 0; * @param width The width of the image. * @param height The height of the image. * @param raw Save in PNM? + * @param data Additional data for `convert_fb_to_pnm` + * and `convert_fb_to_png`. * @return Zero on success, -1 on error. */ static int -save (const char *fbpath, const char *imgpath, long width, long height, int raw) +save (const char *fbpath, const char *imgpath, long width, + long height, int raw, void *restrict data) { int imgfd = -1, fbfd; int saved_errno; @@ -91,7 +94,7 @@ save (const char *fbpath, const char *imgpath, long width, long height, int raw) FILE_FAILURE (fbpath); /* Save image. */ - if ((raw ? save_pnm : save_png) (fbfd, width, height, imgfd) < 0) + if ((raw ? save_pnm : save_png) (fbfd, width, height, imgfd, data) < 0) goto fail; close (fbfd); @@ -194,6 +197,7 @@ save_fb (int fbno, int raw, const char *filepattern, const char *execpattern) char *fbpath; /* Statically allocate string is returned. */ char *execargs = NULL; long width, height; + void *data = NULL; int i, rc = 0, saved_errno = 0; /* Get pathname for framebuffer, and stop if we have read all existing ones. */ @@ -202,7 +206,7 @@ save_fb (int fbno, int raw, const char *filepattern, const char *execpattern) return 1; /* Get the size of the framebuffer. */ - if (measure (fbno, fbpath, &width, &height) < 0) + if (measure (fbno, fbpath, &width, &height, &data) < 0) goto fail; /* Get output pathname. */ @@ -220,7 +224,7 @@ save_fb (int fbno, int raw, const char *filepattern, const char *execpattern) } /* Take a screenshot of the current framebuffer. */ - if (save (fbpath, imgpath, width, height, raw) < 0) + if (save (fbpath, imgpath, width, height, raw, data) < 0) goto fail; fprintf (stderr, _("Saved framebuffer %i to %s.\n"), fbno, imgpath); |