This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via f13f4d07dae989e9db0a670f5e8bfa7dc78e197d (commit) via 40d6efca4f442ebc55954f7a71d3aa31d32a5c0b (commit) via ee6a6e989763d44e3561c49b8712a3c712883c5c (commit) from 0de5472415c0c4e5031b1dfbd0bc3bdb995fb334 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/f13f4d07dae989e9db0a670f5e8bfa7dc78e1...
commit f13f4d07dae989e9db0a670f5e8bfa7dc78e197d Author: Cyril Hrubis metan@ucw.cz Date: Fri Jul 12 18:44:05 2013 +0200
spiv: Map the actions better to the F keys.
Now action triggered by F1 has cmdline switch -1 etc. and the -0 is mapped to action 10 and F10.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/image_actions.c b/demos/spiv/image_actions.c index b153af4..afeebe6 100644 --- a/demos/spiv/image_actions.c +++ b/demos/spiv/image_actions.c @@ -313,7 +313,7 @@ static int prepare_cmd(unsigned int action, const char *img_path) int image_action_run(unsigned int action, const char *img_path) { if (!actions[action]) { - fprintf(stderr, "Undefined action %un", action); + fprintf(stderr, "Undefined action %un", action+1); return 1; }
@@ -323,7 +323,8 @@ int image_action_run(unsigned int action, const char *img_path) printf("Executing cmd "%s"n", cmd);
if (system(cmd)) { - fprintf(stderr, "Failed to execute cmd '%s': %s", cmd, strerror(errno)); + fprintf(stderr, "Failed to execute cmd '%s': %s", + cmd, strerror(errno)); return 1; }
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index bd3194c..245412a 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -746,8 +746,12 @@ int main(int argc, char *argv[]) break; } break; - case '0' ... '9': - image_action_set(opt - '0', optarg); + case '0': + /* -0 is mapped to action 10 */ + image_action_set(9, optarg); + break; + case '1' ... '9': + image_action_set(opt - '1', optarg); break; default: fprintf(stderr, "Invalid paramter '%c'n", opt); diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index ca00a70..43cbaa1 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -51,7 +51,7 @@ static const char *keys_help[] = { "D - drop image cache", "H - toggle help", "", - "F1-F10 - execute action 0 - 9", + "F1-F10 - execute action 1 - 10", "", "1 - resize spiv window to the image size", "2 - resize spiv window to the half of the image size", @@ -86,10 +86,10 @@ void print_help(void) printf(" pass -b help for more infon"); puts("n"); printf("Actions:nn"); - printf(" -0 'cmd' sets first actionn"); - printf(" -1 'cmd' sets second actionn"); + printf(" -1 'cmd' sets first actionn"); printf(" ...n"); - printf(" -9 'cmd' sets tenth actionn"); + printf(" -9 'cmd' sets ninth actionn"); + printf(" -0 'cmd' sets tenth actionn"); puts(""); printf(" actions are shell commands with following modifiers:n"); printf(" %%f path to current imagen");
http://repo.or.cz/w/gfxprim.git/commit/40d6efca4f442ebc55954f7a71d3aa31d32a5...
commit 40d6efca4f442ebc55954f7a71d3aa31d32a5c0b Author: Cyril Hrubis metan@ucw.cz Date: Fri Jul 12 18:32:15 2013 +0200
loaders: pnm: Avoid fgetc() in inner loops.
The fgetc() is guarded by lock to be thread safe which slows things down more than hundred times.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_PNM.c b/libs/loaders/GP_PNM.c index 8ce5497..dc29a7c 100644 --- a/libs/loaders/GP_PNM.c +++ b/libs/loaders/GP_PNM.c @@ -257,7 +257,7 @@ static int get_ascii_int(FILE *f, int *val) *val = 0;
for (;;) { - c = fgetc(f); + c = getc_unlocked(f);
switch (c) { case EOF: @@ -529,24 +529,17 @@ static int load_ascii_rgb888(FILE *f, GP_Context *ctx, GP_ProgressCallback *cb)
static int load_bin_rgb888(FILE *f, GP_Context *ctx, GP_ProgressCallback *cb) { - uint32_t x, y; - int r, g, b, err; + uint32_t y, x;
for (y = 0; y < ctx->h; y++) { - for (x = 0; x < ctx->w; x++) { - r = fgetc(f); - g = fgetc(f); - b = fgetc(f); + uint8_t *addr = GP_PIXEL_ADDR(ctx, 0, y);
- if (r == EOF || g == EOF || b == EOF) { - err = errno; - GP_DEBUG(1, "Unexpected end of PBM file"); - return err; - } + if (fread(addr, ctx->w * 3, 1, f) != 1) + return errno; + + for (x = 0; x < ctx->w; x++) + GP_SWAP(addr[3*x], addr[3*x + 2]);
- GP_PutPixel_Raw_24BPP(ctx, x, y, - GP_Pixel_CREATE_RGB888(r, g, b)); - } if (GP_ProgressCallbackReport(cb, y, ctx->h, ctx->w)) { GP_DEBUG(1, "Operation aborted"); return ECANCELED;
http://repo.or.cz/w/gfxprim.git/commit/ee6a6e989763d44e3561c49b8712a3c712883...
commit ee6a6e989763d44e3561c49b8712a3c712883c5c Author: Cyril Hrubis metan@ucw.cz Date: Fri Jul 12 14:55:33 2013 +0200
loaders: PNM: Add support for binary G8.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_PNM.c b/libs/loaders/GP_PNM.c index a0b5fab..8ce5497 100644 --- a/libs/loaders/GP_PNM.c +++ b/libs/loaders/GP_PNM.c @@ -461,6 +461,26 @@ static int load_ascii_g8(FILE *f, GP_Context *ctx, GP_ProgressCallback *cb) return 0; }
+static int load_bin_g8(FILE *f, GP_Context *ctx, GP_ProgressCallback *cb) +{ + uint32_t y; + + for (y = 0; y < ctx->h; y++) { + uint8_t *addr = GP_PIXEL_ADDR(ctx, 0, y); + + if (fread(addr, ctx->w, 1, f) != 1) + return errno; + + if (GP_ProgressCallbackReport(cb, y, ctx->h, ctx->w)) { + GP_DEBUG(1, "Operation aborted"); + return ECANCELED; + } + } + + GP_ProgressCallbackDone(cb); + return 0; +} + static int load_ascii_rgb888(FILE *f, GP_Context *ctx, GP_ProgressCallback *cb) { uint32_t x, y; @@ -689,6 +709,43 @@ static GP_Pixel depth_to_pixel(int depth) } }
+static int load_ascii_graymap(FILE *f, struct pnm_header *header, + GP_Context *ret, GP_ProgressCallback *callback) +{ + int err = ENOSYS; + + switch (header->depth) { + case 1: + err = load_ascii_g1(f, ret, callback); + break; + case 3: + err = load_ascii_g2(f, ret, callback); + break; + case 15: + err = load_ascii_g4(f, ret, callback); + break; + case 255: + err = load_ascii_g8(f, ret, callback); + break; + } + + return err; +} + +static int load_bin_graymap(FILE *f, struct pnm_header *header, + GP_Context *ret, GP_ProgressCallback *callback) +{ + int err = ENOSYS; + + switch (header->depth) { + case 255: + err = load_bin_g8(f, ret, callback); + break; + } + + return err; +} + static GP_Context *read_graymap(FILE *f, struct pnm_header *header, int flag, GP_ProgressCallback *callback) { @@ -715,24 +772,13 @@ static GP_Context *read_graymap(FILE *f, struct pnm_header *header, int flag, goto err1; }
- switch (header->depth) { - case 1: - if ((err = load_ascii_g1(f, ret, callback))) - goto err1; - break; - case 3: - if ((err = load_ascii_g2(f, ret, callback))) - goto err1; - break; - case 15: - if ((err = load_ascii_g4(f, ret, callback))) - goto err1; - break; - case 255: - if ((err = load_ascii_g8(f, ret, callback))) - goto err1; - break; - } + if (header->magic == '5') + err = load_bin_graymap(f, header, ret, callback); + else + err = load_ascii_graymap(f, header, ret, callback); + + if (err) + goto err1;
if (flag) fclose(f);
-----------------------------------------------------------------------
Summary of changes: demos/spiv/image_actions.c | 5 +- demos/spiv/spiv.c | 8 +++- demos/spiv/spiv_help.c | 8 ++-- libs/loaders/GP_PNM.c | 105 ++++++++++++++++++++++++++++++-------------- 4 files changed, 85 insertions(+), 41 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.