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 6fd76586229a017bd0883e58bb9db1e79d29aca9 (commit) via 96bc5c8ddadbd2a8acd894f6c6d8f70779ed7fd0 (commit) from 62c398e8f845bbe95f0af0e64ab2d9670c6b59af (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/6fd76586229a017bd0883e58bb9db1e79d29a...
commit 6fd76586229a017bd0883e58bb9db1e79d29aca9 Author: Cyril Hrubis metan@ucw.cz Date: Fri Jun 28 01:30:14 2013 +0200
demose: Remove tralling whitespaces too.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/bogoman/bogoman.c b/demos/bogoman/bogoman.c index ea1a4a2..0f74584 100644 --- a/demos/bogoman/bogoman.c +++ b/demos/bogoman/bogoman.c @@ -42,7 +42,7 @@ static void save_png(struct bogoman_map *map, unsigned int elem_size,
if (ctx == NULL) return; - + struct bogoman_render render = { .map = map, .map_x_offset = 0, @@ -50,20 +50,20 @@ static void save_png(struct bogoman_map *map, unsigned int elem_size, .ctx = ctx, .map_elem_size = elem_size, }; - + bogoman_render(&render, BOGOMAN_RENDER_ALL);
GP_SavePNG(ctx, filename, NULL); GP_ContextFree(ctx); } - + static struct GP_Backend *backend;
static void event_loop(struct bogoman_map *map) { while (GP_BackendEventsQueued(backend)) { GP_Event ev; - + GP_BackendGetEvent(backend, &ev);
switch (ev.type) { @@ -138,10 +138,10 @@ int main(int argc, char *argv[]) for (;;) { GP_BackendPoll(backend); event_loop(map); - + bogoman_render(&render, BOGOMAN_RENDER_DIRTY); GP_BackendFlip(backend); - + usleep(50000); }
diff --git a/demos/bogoman/bogoman_debug.c b/demos/bogoman/bogoman_debug.c index d5ee213..c72c69b 100644 --- a/demos/bogoman/bogoman_debug.c +++ b/demos/bogoman/bogoman_debug.c @@ -37,7 +37,7 @@ void bogoman_dbg_print(unsigned int level, const char *file, const char *fn, fprintf(stderr, "WARNING: %s:%s:%int", file, fn, line); else fprintf(stderr, "DEBUG %i:%s:%s:%i:nt", level, file, fn, line); - + va_list va;
va_start(va, fmt); diff --git a/demos/bogoman/bogoman_loader.c b/demos/bogoman/bogoman_loader.c index e1f3eed..935bc3e 100644 --- a/demos/bogoman/bogoman_loader.c +++ b/demos/bogoman/bogoman_loader.c @@ -45,7 +45,7 @@ static void get_map_info(FILE *f, unsigned int *w, unsigned int *h) case 'n': if (*w < curw) *w = curw; - + if (curw == 0) { rewind(f); return; @@ -130,7 +130,7 @@ static void load_map(FILE *f, struct bogoman_map *map)
for (x = 0; x < line_cur->len; x++) { struct bogoman_map_elem *elem; - + elem = bogoman_get_map_elem(map, x, y);
elem->id = line_cur->line[x]; @@ -149,7 +149,7 @@ static void load_map(FILE *f, struct bogoman_map *map) if (y > 0 && bogoman_map_is_id(map, x, y-1, BOGOMAN_WALL)) elem->flags |= BOGOMAN_WALL_UP; - + if (x < line_next->len && line_next->line[x] == BOGOMAN_WALL) elem->flags |= BOGOMAN_WALL_DOWN; @@ -202,11 +202,11 @@ struct bogoman_map *bogoman_load(const char *path) w * h * sizeof(struct bogoman_map_elem);
map = malloc(map_size); - + if (map == NULL) goto err0;
- memset(map, 0, map_size); + memset(map, 0, map_size);
map->w = w; map->h = h; diff --git a/demos/bogoman/bogoman_map.c b/demos/bogoman/bogoman_map.c index 2f62c64..b911744 100644 --- a/demos/bogoman/bogoman_map.c +++ b/demos/bogoman/bogoman_map.c @@ -85,7 +85,7 @@ void bogoman_map_dump(struct bogoman_map *map) break; } } - + printf("n"); }
@@ -208,7 +208,7 @@ void bogoman_map_player_move(struct bogoman_map *map, int x, int y) player_x = px; player_y = py; } - + /* Update the map */ struct bogoman_map_elem *player, *space;
diff --git a/demos/bogoman/bogoman_map.h b/demos/bogoman/bogoman_map.h index b178dcf..fe7c1f1 100644 --- a/demos/bogoman/bogoman_map.h +++ b/demos/bogoman/bogoman_map.h @@ -40,7 +40,7 @@ enum bogoman_map_elem_id { BOGOMAN_MAX = BOGOMAN_EDIBLE, };
-/* +/* * Wall cal be applied as bitflags. Each bitflag determines wall continuation * in particular direction. */ @@ -91,7 +91,7 @@ static inline enum bogoman_map_elem_id return elem->id; }
-static inline int bogoman_map_is_id(struct bogoman_map *map, +static inline int bogoman_map_is_id(struct bogoman_map *map, unsigned int x, unsigned int y, enum bogoman_map_elem_id id) { diff --git a/demos/bogoman/bogoman_render.c b/demos/bogoman/bogoman_render.c index 43a09bd..c2ebc10 100644 --- a/demos/bogoman/bogoman_render.c +++ b/demos/bogoman/bogoman_render.c @@ -30,12 +30,12 @@ struct render_colors { /* global background */ GP_Pixel bg; - + /* player color */ GP_Pixel player;
/* frames around things */ - GP_Pixel frames; + GP_Pixel frames;
/* diamod color */ GP_Pixel diamond; @@ -79,9 +79,9 @@ static void render_player(struct bogoman_render *render, struct bogoman_map_elem *elem) { unsigned int w = render->map_elem_size; - + (void) elem; - + GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); GP_FillCircle(render->ctx, x + w/2, y + w/2, w/2 - 1, colors.player); GP_Circle(render->ctx, x + w/2, y + w/2, w/2 - 1, colors.frames); @@ -97,7 +97,7 @@ static void render_wall(struct bogoman_render *render,
if (!(elem->flags & BOGOMAN_WALL_LEFT)) GP_VLineXYH(render->ctx, x, y, w, colors.frames); - + if (!(elem->flags & BOGOMAN_WALL_RIGHT)) GP_VLineXYH(render->ctx, x + w - 1, y, w, colors.frames);
@@ -115,7 +115,7 @@ static void render_diamond(struct bogoman_render *render, unsigned int w = render->map_elem_size;
GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg); - + GP_FillTetragon(render->ctx, x + w/2, y, x + w - 1, y + w/2, x + w/2, y + w - 1, x, y + w/2, colors.diamond);
@@ -128,7 +128,7 @@ static void render_moveable(struct bogoman_render *render, struct bogoman_map_elem *elem) { unsigned int w = render->map_elem_size; - + GP_FillRectXYWH(render->ctx, x, y, w, w, colors.bg);
GP_FillRectXYWH(render->ctx, x + 1, y + 1, w - 2, w - 2, colors.moveable); @@ -148,7 +148,7 @@ static void render_edible(struct bogoman_render *render,
static void (*renders[])(struct bogoman_render *render, unsigned int x, unsigned int y, - struct bogoman_map_elem *elem) = + struct bogoman_map_elem *elem) = { render_none, render_player, diff --git a/demos/bogoman/bogoman_render.h b/demos/bogoman/bogoman_render.h index 72c6a48..f813cdc 100644 --- a/demos/bogoman/bogoman_render.h +++ b/demos/bogoman/bogoman_render.h @@ -30,7 +30,7 @@ struct bogoman_render { /* both in map elements */ unsigned int map_x_offset; unsigned int map_y_offset; - + /* current map */ struct bogoman_map *map;
diff --git a/demos/c_simple/SDL_glue.c b/demos/c_simple/SDL_glue.c index 3185b67..d5b5cb7 100644 --- a/demos/c_simple/SDL_glue.c +++ b/demos/c_simple/SDL_glue.c @@ -24,7 +24,7 @@ *****************************************************************************/
/* - + This example shows how to mix SDL with GFXprim.
*/ @@ -46,7 +46,7 @@ static GP_Pixel black_pixel, darkgray_pixel; void redraw_screen(void) { SDL_LockSurface(display); - + GP_Fill(&context, black_pixel);
GP_Line(&context, 0, 0, W-1, H-1, darkgray_pixel); @@ -90,7 +90,7 @@ int main(void) }
display = SDL_SetVideoMode(W, H, 0, SDL_SWSURFACE); - + if (display == NULL) { fprintf(stderr, "Could not open display: %sn", SDL_GetError()); goto fail; diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c index b0faf84..ecf82cc 100644 --- a/demos/c_simple/backend_example.c +++ b/demos/c_simple/backend_example.c @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) GP_BackendWaitEvent(backend, &ev);
GP_EventDump(&ev); - + switch (ev.type) { case GP_EV_KEY: switch (ev.val.val) { diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c index 1e84efd..3aaf45e 100644 --- a/demos/c_simple/blittest.c +++ b/demos/c_simple/blittest.c @@ -55,21 +55,21 @@ void redraw_screen(void) bitmap_vy = -bitmap_vy; bitmap_y += bitmap_vy; } - + if (bitmap_y < 0) { bitmap_vy = -bitmap_vy; bitmap_y += bitmap_vy; }
GP_FillRectXYWH(win->context, 20, 20, 300, 50, black); - + GP_Text(win->context, NULL, 20, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, text_buf);
GP_Print(win->context, NULL, 250, 20, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, "%c|%c|%c", bitmap->x_swap ? 'x' : ' ', bitmap->y_swap ? 'y' : ' ', bitmap->axes_swap ? 'a' : ' '); - + GP_Blit(bitmap, 0, 0, GP_ContextW(bitmap), GP_ContextH(bitmap), win->context, bitmap_x, bitmap_y);
@@ -84,7 +84,7 @@ static void change_bitmap(void) bitmap = bitmap_conv; else bitmap = bitmap_raw; - + snprintf(text_buf, sizeof(text_buf), "'%s' -> '%s'", GP_PixelTypeName(bitmap->pixel_type), GP_PixelTypeName(win->context->pixel_type)); @@ -96,12 +96,12 @@ void event_loop(void)
while (GP_BackendGetEvent(win, &ev)) { GP_EventDump(&ev); - + switch (ev.type) { case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_X: bitmap->x_swap = !bitmap->x_swap; @@ -153,14 +153,14 @@ int main(void) const char *backend_opts = "X11";
print_instructions(); - + bitmap_raw = GP_LoadImage(sprite, NULL);
if (!bitmap_raw) { fprintf(stderr, "Failed to load '%s'n", sprite); return 1; } - + win = GP_BackendInit(backend_opts, "Blit Test", stderr);
if (win == NULL) { @@ -182,7 +182,7 @@ int main(void) for (;;) { GP_BackendPoll(win); event_loop(); - + usleep(8000);
if (pause_flag) diff --git a/demos/c_simple/convolution.c b/demos/c_simple/convolution.c index bfbd06a..e0acd17 100644 --- a/demos/c_simple/convolution.c +++ b/demos/c_simple/convolution.c @@ -44,8 +44,8 @@ static int progress_callback(GP_ProgressCallback *self) printf("r%s '%s' %3.1f%%", priv->op, priv->name, self->percentage); fflush(stdout);
- /* - * It's important to return zero as non-zero return value + /* + * It's important to return zero as non-zero return value * aborts the operation. */ return 0; @@ -65,7 +65,7 @@ int main(int argc, char *argv[])
priv.op = "Loading"; priv.name = argv[1]; - + img = GP_LoadImage(argv[1], &callback);
if (img == NULL) { diff --git a/demos/c_simple/debug_handler.c b/demos/c_simple/debug_handler.c index 9623645..f514769 100644 --- a/demos/c_simple/debug_handler.c +++ b/demos/c_simple/debug_handler.c @@ -21,7 +21,7 @@ *****************************************************************************/
/* - + Example on custom debug message handler.
*/ @@ -56,7 +56,7 @@ int main(void) { /* Set custom debug handler */ GP_SetDebugHandler(debug_handler); - + /* Print some debug messages */ GP_WARN("This is a warning"); GP_FATAL("This is a fatal condition"); diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c index 26ae4e0..5091ffa 100644 --- a/demos/c_simple/fileview.c +++ b/demos/c_simple/fileview.c @@ -89,7 +89,7 @@ void redraw_screen(void)
struct FileLine *line = first_line; unsigned int i; - for (i = 0; i < win->h/GP_TextHeight(&style); i++) { + for (i = 0; i < win->h/GP_TextHeight(&style); i++) { if (line == NULL) break; GP_Text(win, &style, 16, 16 + (1.0 * GP_TextHeight(&style))*i, @@ -103,7 +103,7 @@ static void warp_up(int lines) while (lines-- > 0) if (first_line->prev != NULL) first_line = first_line->prev; - + redraw_screen(); GP_BackendFlip(backend); } @@ -113,7 +113,7 @@ static void warp_down(int lines) while (lines-- > 0) if (first_line->next != NULL) first_line = first_line->next; - + redraw_screen(); GP_BackendFlip(backend); } @@ -129,14 +129,14 @@ void event_loop(void) case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_SPACE: if (font) font_flag = (font_flag + 1) % 5; else font_flag = (font_flag + 1) % 4; - + redraw_screen(); GP_BackendFlip(backend); break; @@ -205,7 +205,7 @@ static int read_file_head(const char *filename) { FILE *f = fopen(filename, "r"); char buf[512]; - + if (f == NULL) { fprintf(stderr, "Could not open file: %sn", filename); return 0; @@ -215,7 +215,7 @@ static int read_file_head(const char *filename)
if (fgets(buf, 511, f) == NULL) break; - + struct FileLine *line = malloc(sizeof(*line)); line->text = strdup(buf); line->next = NULL; @@ -238,18 +238,18 @@ static int read_file_head(const char *filename) int main(int argc, char *argv[]) { const char *backend_opts = "X11"; - + if (argc == 1) { fprintf(stderr, "No file specifiedn"); return 1; } - + if (argc > 2) font = GP_FontFaceLoad(argv[2], 0, 16);
if (!read_file_head(argv[1])) return 1; - + backend = GP_BackendInit(backend_opts, "File View", stderr);
if (backend == NULL) { @@ -257,7 +257,7 @@ int main(int argc, char *argv[]) backend_opts); return 1; } - + win = backend->context;
white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, win); @@ -269,7 +269,7 @@ int main(int argc, char *argv[])
redraw_screen(); GP_BackendFlip(backend); - + event_loop();
return 0; diff --git a/demos/c_simple/filters_symmetry.c b/demos/c_simple/filters_symmetry.c index 3f130a4..735be56 100644 --- a/demos/c_simple/filters_symmetry.c +++ b/demos/c_simple/filters_symmetry.c @@ -42,7 +42,7 @@ static void usage_and_exit(int ret) printf("%s, ", GP_FilterSymmetryNames[i]);
printf("%s} image_in image_outn", GP_FilterSymmetryNames[i]); - + exit(ret); }
@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) usage_and_exit(1); } } - + /* Turn on debug messages */ GP_SetDebugLevel(debug);
@@ -111,6 +111,6 @@ int main(int argc, char *argv[]) /* Cleanup */ GP_ContextFree(src); GP_ContextFree(res); - + return 0; } diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c index f6516cb..4c35110 100644 --- a/demos/c_simple/fonttest.c +++ b/demos/c_simple/fonttest.c @@ -87,7 +87,7 @@ static void print_font_properties(const GP_FontFace *font) GP_FontAscend(font), GP_FontDescend(font)); fprintf(stderr, " Max advance_x: %un", GP_FontMaxAdvanceX(font)); - fprintf(stderr, " Glyph bitmap format: %sn", + fprintf(stderr, " Glyph bitmap format: %sn", glyph_bitmap_format_name(font->glyph_bitmap_format)); fprintf(stderr, " Bounding box width: %d, heigth: %dn", GP_FontMaxWidth(font), GP_FontHeight(font)); @@ -155,7 +155,7 @@ void redraw_screen(void)
GP_Text(win->context, &style, 16, SPACING*i + 16, align, white_pixel, dark_gray_pixel, test_string); - + style.pixel_xmul = 2; style.pixel_ymul = 2; style.pixel_yspace = 1; @@ -169,18 +169,18 @@ void redraw_screen(void)
style.pixel_xmul = 4; style.pixel_ymul = 2; - + style.pixel_xspace = 1; style.pixel_yspace = 1; - + if (font_flag == 2 || font_flag == 3) { style.pixel_xmul = 2; style.pixel_ymul = 5; - + style.pixel_xspace = 2; style.pixel_yspace = 2; } - + GP_Text(win->context, &style, 64, SPACING*i + 88, align, dark_gray_pixel, black_pixel, test_string); } @@ -197,14 +197,14 @@ void event_loop(void) case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_SPACE: if (font) font_flag = (font_flag + 1) % 5; else font_flag = (font_flag + 1) % 4; - + redraw_screen(); GP_BackendFlip(win); break; @@ -257,17 +257,17 @@ void print_instructions(void) int main(int argc, char *argv[]) { const char *backend_opts = "X11"; - + print_instructions();
GP_SetDebugLevel(10); - + if (argc > 1) { font_path = argv[1]; fprintf(stderr, "nLoading font '%s'n", argv[1]); font = GP_FontFaceLoad(argv[1], 0, font_h); } - + win = GP_BackendInit(backend_opts, "Font Test", stderr);
if (win == NULL) { @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) backend_opts); return 1; } - + white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, win->context); gray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, win->context); dark_gray_pixel = GP_ColorToContextPixel(GP_COL_GRAY_DARK, win->context); diff --git a/demos/c_simple/gfx_koch.c b/demos/c_simple/gfx_koch.c index dda5e80..c188f3a 100644 --- a/demos/c_simple/gfx_koch.c +++ b/demos/c_simple/gfx_koch.c @@ -35,7 +35,7 @@ /* Set to 1 to use Anti Aliased drawing */ static int aa_flag = 0;
-/* +/* * Generate color depending on distance from center * * We could do this only and only because the context @@ -51,7 +51,7 @@ static GP_Pixel do_color(int xc, int yc, float x, float y) int rmask = 0; int gmask = 0xff * sqrt(dc); int bmask = 0xff * (1 - dc); - + if (dc < 0.1) { rmask = 0xff * (1 - dc); bmask = 0x00; @@ -72,19 +72,19 @@ static void draw(GP_Context *img, int level, float x0, float y0, float x1, float GP_Pixel pixel;
pixel = do_color(img->w/2, img->h/2, 1.00 * (x0+x1)/2, 1.00 * (y0 + y1)/2); - + if (aa_flag) GP_LineAA(img, x0 * 256, y0 * 256, x1 * 256, y1 * 256, pixel); else GP_Line(img, x0, y0, x1, y1, pixel); - + return; }
/* Compute varation of Koch curve */ float x34 = (x0 + 3 * x1) / 4; float y34 = (y0 + 3 * y1) / 4; - + float x14 = (3 * x0 + x1) / 4; float y14 = (3 * y0 + y1) / 4;
@@ -107,7 +107,7 @@ static void draw(GP_Context *img, int level, float x0, float y0, float x1, float int main(void) { GP_Context *img; - + /* Create RGB 24 bit image */ img = GP_ContextAlloc(600, 600, GP_PIXEL_RGB888);
@@ -119,7 +119,7 @@ int main(void) /* Clean up the bitmap */ GP_Fill(img, 0);
- /* Draw a fractal */ + /* Draw a fractal */ draw(img, 4, 0, 0, img->w - 1, img->h - 1); draw(img, 4, 0, img->h - 1, img->w - 1, 0);
diff --git a/demos/c_simple/input_example.c b/demos/c_simple/input_example.c index 820b530..5243c82 100644 --- a/demos/c_simple/input_example.c +++ b/demos/c_simple/input_example.c @@ -40,14 +40,14 @@ static void draw_event(GP_Event *ev)
if (ev->type != GP_EV_KEY) return; - + int align = GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM;
GP_TextClear(win, NULL, 20, 20, align, black, size); size = GP_Print(win, NULL, 20, 20, align, white, black, "Key=%s", GP_EventKeyName(ev->val.key.key)); - + GP_BackendFlip(backend); }
@@ -55,7 +55,7 @@ static void event_loop(void) { for (;;) { GP_BackendWait(backend); - + while (GP_BackendEventsQueued(backend)) { GP_Event ev;
@@ -90,7 +90,7 @@ static void event_loop(void) case GP_EV_REL_POS: if (GP_EventGetKey(&ev, GP_BTN_LEFT)) { GP_PutPixel(win, ev.cursor_x, - ev.cursor_y, green); + ev.cursor_y, green); } int align = GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM;
@@ -147,7 +147,7 @@ int main(int argc, char *argv[]) backend_opts); return 1; } - + win = backend->context;
red = GP_ColorToContextPixel(GP_COL_RED, win); diff --git a/demos/c_simple/koch.c b/demos/c_simple/koch.c index e546707..6325e35 100644 --- a/demos/c_simple/koch.c +++ b/demos/c_simple/koch.c @@ -24,7 +24,7 @@ *****************************************************************************/
/* - + Simple test for triangle drawing runtime.
*/ @@ -50,7 +50,7 @@ static void sierpinsky(double x1, double y1, double x4, double y4, int iter) double x2, y2, x3, y3, x5, y5; GP_Pixel pixel; pixel = GP_RGBToPixel(0, 0, 255-16*iter, context->pixel_type); - + if (iter <= 0) { if (draw_edge) GP_Line(context, x1, y1, x4, y4, black); @@ -85,13 +85,13 @@ static void draw(int x, int y, int l, int iter) int h = context->h;
l = ((w < h ? w : h) - 20)/(5 - 1.00*iter/120); - + x1 = sin(1.00 * iter/57) * l + x; y1 = cos(1.00 * iter/57) * l + y; - + x2 = sin(1.00 * (iter+120)/57) * l + x; y2 = cos(1.00 * (iter+120)/57) * l + y; - + x3 = sin(1.00 * (iter+240)/57) * l + x; y3 = cos(1.00 * (iter+240)/57) * l + y;
@@ -114,10 +114,10 @@ void redraw(void) return;
iter += 2 * way; - + if (iter > 350) way *= -1; - + if (iter < 0) way *= -1;
@@ -127,7 +127,7 @@ void redraw(void) int main(void) { const char *backend_opts = "X11"; - + backend = GP_BackendInit(backend_opts, "Koch", stderr);
if (backend == NULL) { @@ -135,14 +135,14 @@ int main(void) backend_opts); return 1; } - + context = backend->context; - + black = GP_ColorToContextPixel(GP_COL_BLACK, context); blue = GP_ColorToContextPixel(GP_COL_BLUE, context); gray = GP_ColorToContextPixel(GP_COL_GRAY_LIGHT, context); red = GP_ColorToContextPixel(GP_COL_RED, context); - + iter = 0; draw(context->w/2, context->h/2, l, iter);
@@ -150,17 +150,17 @@ int main(void) GP_Event ev;
redraw(); - + GP_BackendPoll(backend); - + while (GP_BackendGetEvent(backend, &ev)) { GP_EventDump(&ev); - + switch (ev.type) { case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_P: paused = !paused; @@ -177,6 +177,6 @@ int main(void) } usleep(TIMER_TICK); } - + return 0; } diff --git a/demos/c_simple/linetest.c b/demos/c_simple/linetest.c index e0be94d..8c91cf5 100644 --- a/demos/c_simple/linetest.c +++ b/demos/c_simple/linetest.c @@ -47,19 +47,19 @@ void redraw_screen(void) int ycenter = h/2;
GP_Fill(win->context, black); - + for (angle = 0.0; angle < 2*M_PI; angle += 0.1) { x = (int) (w/2 * cos(start_angle + angle)); y = (int) (h/2 * sin(start_angle + angle));
int r = 127.0 + 127.0 * cos(start_angle + angle); int b = 127.0 + 127.0 * sin(start_angle + angle); - + GP_Pixel pixel; pixel = GP_RGBToPixel(r, 0, b, win->context->pixel_type); - + if (aa_flag) { - GP_LineAA_Raw(win->context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter), + GP_LineAA_Raw(win->context, GP_FP_FROM_INT(xcenter), GP_FP_FROM_INT(ycenter), GP_FP_FROM_INT(xcenter + x), GP_FP_FROM_INT(ycenter + y), pixel); } else { GP_Line(win->context, xcenter + x, ycenter + y, xcenter, ycenter, pixel); @@ -83,7 +83,7 @@ void event_loop(void) case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_A: aa_flag = !aa_flag; @@ -103,7 +103,7 @@ void event_loop(void) int main(void) { const char *backend_opts = "X11"; - + win = GP_BackendInit(backend_opts, "Line Test", stderr);
if (win == NULL) { @@ -111,7 +111,7 @@ int main(void) backend_opts); return 1; } - + white = GP_ColorToContextPixel(GP_COL_WHITE, win->context); black = GP_ColorToContextPixel(GP_COL_BLACK, win->context);
@@ -120,7 +120,7 @@ int main(void) for (;;) { GP_BackendPoll(win); event_loop(); - + usleep(20000);
if (pause_flag) @@ -128,7 +128,7 @@ int main(void)
redraw_screen(); GP_BackendFlip(win); - + start_angle += 0.01; if (start_angle > 2*M_PI) { start_angle = 0.0; diff --git a/demos/c_simple/loaders.c b/demos/c_simple/loaders.c index 8239b90..369ec48 100644 --- a/demos/c_simple/loaders.c +++ b/demos/c_simple/loaders.c @@ -44,8 +44,8 @@ static int progress_callback(GP_ProgressCallback *self) printf("r%s '%s' %3.1f%%", priv->op, priv->name, self->percentage); fflush(stdout);
- /* - * It's important to return zero as non-zero return value + /* + * It's important to return zero as non-zero return value * aborts the operation. */ return 0; @@ -65,7 +65,7 @@ int main(int argc, char *argv[])
priv.op = "Loading"; priv.name = argv[1]; - + img = GP_LoadImage(argv[1], &callback);
if (img == NULL) { diff --git a/demos/c_simple/loaders_example.c b/demos/c_simple/loaders_example.c index 76ffe07..9c0a65a 100644 --- a/demos/c_simple/loaders_example.c +++ b/demos/c_simple/loaders_example.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Takes an image as an parametern"); return 1; } - + img = GP_LoadImage(argv[1], NULL);
if (img == NULL) { diff --git a/demos/c_simple/loaders_register.c b/demos/c_simple/loaders_register.c index 2140af5..877bff9 100644 --- a/demos/c_simple/loaders_register.c +++ b/demos/c_simple/loaders_register.c @@ -73,7 +73,7 @@ static int save(const GP_Context *img, const char *dst_path, }
fprintf(f, "n"); - + if (GP_ProgressCallbackReport(callback, img->h, j, img->w)) { fclose(f); unlink(dst_path); @@ -101,7 +101,7 @@ GP_Loader loader = { int main(int argc, char *argv[]) { GP_Context *c, *gc; - + GP_LoaderRegister(&loader);
/* List all loaders */ @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "FloydSteinberg: %sn", strerror(errno)); return 1; } - + printf("Saving to test.txtn");
if (GP_SaveImage(gc, "test.txt", NULL)) { diff --git a/demos/c_simple/meta_data.c b/demos/c_simple/meta_data.c index 746f6b7..a2c9a64 100644 --- a/demos/c_simple/meta_data.c +++ b/demos/c_simple/meta_data.c @@ -46,7 +46,7 @@ int main(void) if (data == NULL) return 1;
- /* + /* * Create integer * * May fail, if there is allready record with id 'dpi' or diff --git a/demos/c_simple/meta_data_dump.c b/demos/c_simple/meta_data_dump.c index d9aacfb..8fc2526 100644 --- a/demos/c_simple/meta_data_dump.c +++ b/demos/c_simple/meta_data_dump.c @@ -44,15 +44,15 @@ int main(int argc, char *argv[]) fprintf(stderr, "Takes an image(s) as parameter(s)n"); return 1; } - + //GP_SetDebugLevel(10);
for (i = 1; i < argc; i++) { puts(SEP); printf("Opening '%s'n", argv[i]); - + GP_MetaDataClear(data); - + if (GP_LoadMetaData(argv[i], data)) { fprintf(stderr, "Failed to read '%s' meta-data: %sn", argv[1], strerror(errno)); @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) GP_MetaDataPrint(data); } } - + puts(SEP);
return 0; diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c index ef010da..82e9d08 100644 --- a/demos/c_simple/pretty_print.c +++ b/demos/c_simple/pretty_print.c @@ -21,7 +21,7 @@ *****************************************************************************/
/* - + Pretty print function for pixel and context.
*/ diff --git a/demos/c_simple/shapetest.c b/demos/c_simple/shapetest.c index 9cebdd3..6444445 100644 --- a/demos/c_simple/shapetest.c +++ b/demos/c_simple/shapetest.c @@ -86,7 +86,7 @@ void draw_testing_triangle(int x, int y, int xradius, int yradius) y1 = y; x2 = x + xradius; y2 = y + yradius; - break; + break; case 3: x0 = x - xradius; y0 = y - yradius; @@ -171,7 +171,7 @@ void draw_testing_rectangle(int x, int y, int xradius, int yradius) { int x0 = x - xradius, y0 = y - yradius; int x1 = x + xradius, y1 = y + yradius; - + if (outline == 1) GP_Rect(win, x0, y0, x1, y1, yellow);
@@ -191,7 +191,7 @@ void draw_testing_tetragon(int x, int y, int xradius, int yradius)
if (outline == 1) GP_Tetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, yellow); - + if (fill) GP_FillTetragon(win, x0, y0, x1, y1, x2, y2, x3, y3, red);
@@ -206,7 +206,7 @@ void draw_testing_polygon(int x, int y, int xradius, int yradius)
xy[0] = x + xradius; xy[1] = y; - + xy[2] = x + 3 * xradius / 4; xy[3] = y + yradius / 4;
@@ -308,7 +308,7 @@ static void xradius_add(int xradius_add) xradius + xradius_add < (int)win->w) xradius += xradius_add; } - +
static void yradius_add(int yradius_add) { @@ -316,14 +316,14 @@ static void yradius_add(int yradius_add) yradius + yradius_add < (int)win->h) yradius += yradius_add; } - + static void xcenter_add(int xcenter_add) { if (center_x + xcenter_add > 1 && center_x + xcenter_add < (int)win->w/2) center_x += xcenter_add; } - + static void ycenter_add(int ycenter_add) { if (center_y + ycenter_add > 1 && @@ -341,7 +341,7 @@ void event_loop(void) GP_BackendWaitEvent(backend, &ev);
GP_EventDump(&ev); - + shift_pressed = GP_EventGetKey(&ev, GP_KEY_LEFT_SHIFT) || GP_EventGetKey(&ev, GP_KEY_RIGHT_SHIFT);
@@ -349,7 +349,7 @@ void event_loop(void) case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_X: win->x_swap = !win->x_swap; @@ -446,7 +446,7 @@ void event_loop(void) } break; } - + redraw_screen(); } } @@ -484,7 +484,7 @@ int main(void) backend_opts); return 1; } - + win = backend->context;
center_x = win->w / 2; diff --git a/demos/c_simple/showimage.c b/demos/c_simple/showimage.c index 3394230..14873d0 100644 --- a/demos/c_simple/showimage.c +++ b/demos/c_simple/showimage.c @@ -21,7 +21,7 @@ *****************************************************************************/
/* - + Simple example that shows X11 window with image.
*/ @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) { GP_Backend *backend; GP_Context *image; - + GP_SetDebugLevel(10);
if (argc != 2) { @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Failed to load bitmap: %sn", strerror(errno)); return 1; } - + /* Initalize backend */ backend = GP_BackendX11Init(NULL, 0, 0, image->w, image->h, argv[1], 0);
diff --git a/demos/c_simple/sin_AA.c b/demos/c_simple/sin_AA.c index 80c9086..20e3202 100644 --- a/demos/c_simple/sin_AA.c +++ b/demos/c_simple/sin_AA.c @@ -21,7 +21,7 @@ *****************************************************************************/
/* - + Simple example that shows HLineAA() usage.
*/ @@ -65,11 +65,11 @@ static void redraw(GP_Context *context)
if (flag) { param -= 0.02; - + if (param <= -2.40) { flag = 0; param2 += 0.01; - + if (param2 > 0.02) param2 = 0.01; } @@ -100,9 +100,9 @@ int main(void) redraw(backend->context); GP_BackendFlip(backend); } - + GP_BackendPoll(backend); - + GP_Event ev;
while (GP_BackendGetEvent(backend, &ev)) { diff --git a/demos/c_simple/textaligntest.c b/demos/c_simple/textaligntest.c index 39391b4..99a6a3f 100644 --- a/demos/c_simple/textaligntest.c +++ b/demos/c_simple/textaligntest.c @@ -80,7 +80,7 @@ static void event_loop(void) case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) continue; - + switch (ev.val.key.key) { case GP_KEY_X: win->context->x_swap = !win->context->x_swap; @@ -118,7 +118,7 @@ static void event_loop(void) } break; } - + redraw_screen(); GP_BackendFlip(win); } diff --git a/demos/c_simple/timers.c b/demos/c_simple/timers.c index 112223a..cb8c587 100644 --- a/demos/c_simple/timers.c +++ b/demos/c_simple/timers.c @@ -21,7 +21,7 @@ *****************************************************************************/
/* - + Simple example how to use raw timer priority queue.
*/ @@ -52,7 +52,7 @@ int main(void) GP_TimerQueueInsert(&queue, 0, &oneshot); GP_TimerQueueInsert(&queue, 0, &recurrent); GP_TimerQueueInsert(&queue, 0, &random); - + for (now = 0; now < 100; now += 3) { printf("NOW %un", (unsigned int) now); printf("-------------------------------------n"); diff --git a/demos/c_simple/tmp_file.c b/demos/c_simple/tmp_file.c index 99becbc..6daf399 100644 --- a/demos/c_simple/tmp_file.c +++ b/demos/c_simple/tmp_file.c @@ -62,7 +62,7 @@ int main(int argc, char *argv[])
priv.op = "Loading"; priv.name = argv[1]; - + img = GP_LoadImage(argv[1], &callback);
if (img == NULL) { @@ -80,13 +80,13 @@ int main(int argc, char *argv[]) fprintf(stderr, "Failed to save temp file %sn", strerror(errno)); return 1; } - + printf("n");
GP_ContextFree(img); - + priv.op = "Loading"; - + img = GP_LoadTmpFile(priv.name, &callback);
if (img == NULL) { @@ -96,7 +96,7 @@ int main(int argc, char *argv[])
priv.op = "Saving"; priv.name = "out.png"; - + printf("n");
if (GP_SavePNG(img, "out.png", &callback)) { diff --git a/demos/c_simple/v4l2_grab.c b/demos/c_simple/v4l2_grab.c index 7aa8469..c43cc32 100644 --- a/demos/c_simple/v4l2_grab.c +++ b/demos/c_simple/v4l2_grab.c @@ -42,7 +42,7 @@ static int get_image(const char *filename, GP_Grabber *grabber) /* throw away first frame, it's usually wrong */ while (!GP_GrabberPoll(grabber)) usleep(100000); - + while (!GP_GrabberPoll(grabber)) usleep(100000);
@@ -52,7 +52,7 @@ static int get_image(const char *filename, GP_Grabber *grabber) filename, strerror(errno)); return 1; } - + /* turn off grabber */ if (GP_GrabberStop(grabber)) { fprintf(stderr, "Failed to start grabbern"); @@ -69,7 +69,7 @@ int main(int argc, char *argv[]) unsigned int w = 640, h = 480; int secs = 0; int opt; - + while ((opt = getopt(argc, argv, "d:hH:o:W:l:s:")) != -1) { switch (opt) { case 'o': @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) return 1; } } - + GP_Grabber *grabber = GP_GrabberV4L2Init(v4l2_device, w, h);
if (grabber == NULL) { @@ -122,12 +122,12 @@ int main(int argc, char *argv[]) }
int i = 0; - + for (;;) { char buf[128];
snprintf(buf, sizeof(buf), "frame%03i.jpg", i++); - + if (get_image(buf, grabber)) { fprintf(stderr, "Failed to get image, exitting...n"); return 1; diff --git a/demos/c_simple/v4l2_show.c b/demos/c_simple/v4l2_show.c index a65202c..a88a891 100644 --- a/demos/c_simple/v4l2_show.c +++ b/demos/c_simple/v4l2_show.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[])
/* Turn on debug messages */ //GP_SetDebugLevel(10); - + while ((opt = getopt(argc, argv, "d:hH:W:l:")) != -1) { switch (opt) { case 'd': @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) v4l2_device, strerror(errno)); return 1; } - + backend = GP_BackendX11Init(NULL, 0, 0, grabber->frame->w, grabber->frame->h, "V4L2", 0);
@@ -114,16 +114,16 @@ int main(int argc, char *argv[]) res = GP_FilterFloydSteinberg_RGB888_Alloc(img, GP_PIXEL_G2, NULL); break; } - + GP_Blit_Clipped(res, 0, 0, res->w, res->h, backend->context, 0, 0); GP_BackendFlip(backend); - + if (mode) GP_ContextFree(res); } - + usleep(1000); - + GP_BackendPoll(backend);
/* Read and parse events */ @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) while (GP_BackendGetEvent(backend, &ev)) { switch (ev.type) { case GP_EV_KEY: - + /* ignore key up events */ if (!ev.code) continue; @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) return 0; break; case GP_KEY_SPACE: - + mode++;
if (mode > 2) diff --git a/demos/c_simple/version.c b/demos/c_simple/version.c index 3f83d7e..874bf2b 100644 --- a/demos/c_simple/version.c +++ b/demos/c_simple/version.c @@ -21,7 +21,7 @@ *****************************************************************************/
/* - + Prints GFXprim version.
*/ diff --git a/demos/c_simple/virtual_backend_example.c b/demos/c_simple/virtual_backend_example.c index d1ce089..d149bc8 100644 --- a/demos/c_simple/virtual_backend_example.c +++ b/demos/c_simple/virtual_backend_example.c @@ -70,10 +70,10 @@ int main(int argc, char *argv[])
if (emul_type != GP_PIXEL_UNKNOWN) { GP_Backend *emul; - - /* + + /* * Create an emulated backend on the top of real backend. - * + * * The GP_BACKEND_CALL_EXIT says that when calling exit on * emulated backend, the real backend exit will be called as * well. @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) green_pixel = GP_ColorToContextPixel(GP_COL_GREEN, context);
GP_Fill(context, white_pixel); - + unsigned int i, j; for (i = 0; i < 40; i++) { GP_HLineXYW(context, 0, i, i, black_pixel); @@ -124,16 +124,16 @@ int main(int argc, char *argv[])
GP_Text(context, NULL, 60, 270, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, black_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - + GP_Text(context, NULL, 60, 290, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, red_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - + GP_Text(context, NULL, 60, 310, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, green_pixel, white_pixel, "Lorem Ipsum dolor sit...");
GP_Text(context, NULL, 60, 330, GP_VALIGN_BELOW|GP_ALIGN_RIGHT, blue_pixel, white_pixel, "Lorem Ipsum dolor sit..."); - + /* Update the backend screen */ GP_BackendFlip(backend);
@@ -149,7 +149,7 @@ int main(int argc, char *argv[]) while (GP_BackendGetEvent(backend, &ev)) {
GP_EventDump(&ev); - + switch (ev.type) { case GP_EV_KEY: switch (ev.val.key.key) { diff --git a/demos/c_simple/weighted_median.c b/demos/c_simple/weighted_median.c index fbbd8c5..a0b09fd 100644 --- a/demos/c_simple/weighted_median.c +++ b/demos/c_simple/weighted_median.c @@ -44,8 +44,8 @@ static int progress_callback(GP_ProgressCallback *self) printf("r%s '%s' %3.1f%%", priv->op, priv->name, self->percentage); fflush(stdout);
- /* - * It's important to return zero as non-zero return value + /* + * It's important to return zero as non-zero return value * aborts the operation. */ return 0; @@ -65,7 +65,7 @@ int main(int argc, char *argv[])
priv.op = "Loading"; priv.name = argv[1]; - + img = GP_LoadImage(argv[1], &callback);
if (img == NULL) { diff --git a/demos/c_simple/x11_windows.c b/demos/c_simple/x11_windows.c index 7ed43e4..39252ed 100644 --- a/demos/c_simple/x11_windows.c +++ b/demos/c_simple/x11_windows.c @@ -31,7 +31,7 @@ static void redraw(struct GP_Context *context) { GP_Pixel white_pixel, black_pixel; - + black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context); white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, context);
@@ -50,9 +50,9 @@ static int ev_loop(struct GP_Backend *backend, const char *name) while (GP_BackendGetEvent(backend, &ev)) {
printf("-------------------------- %sn", name); - + GP_EventDump(&ev); - + switch (ev.type) { case GP_EV_KEY: switch (ev.val.val) { @@ -75,7 +75,7 @@ static int ev_loop(struct GP_Backend *backend, const char *name) } break; } - + printf("-----------------------------n"); }
@@ -98,12 +98,12 @@ int main(void) /* Update the backend screen */ redraw(win_1->context); redraw(win_2->context); - + GP_BackendFlip(win_1); GP_BackendFlip(win_2);
for (;;) { - /* + /* * Wait for backend event. * * Either window is fine as they share connection. diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index d74eb0f..6bdf006 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -39,7 +39,7 @@ static int show_progress(GP_ProgressCallback *self) { fprintf(stderr, "r%s %3.2f%%", progress_prefix, self->percentage); - + return 0; }
@@ -51,11 +51,11 @@ static int param_err(const struct param *self, const char *val, void *priv) (char*)priv, val); return 1; } - + /* just regular error */ fprintf(stderr, "ERROR: %s: Invalid %s parameter value %s = '%s'", (char *)priv, param_type_name(self->type), self->name, val); - + if (self->type == PARAM_ENUM) { unsigned int i;
@@ -96,7 +96,7 @@ static int resize_check_ratio(const struct param *self __attribute__((unused)),
if (f <= 0) return -1; - + return 0; }
@@ -125,7 +125,7 @@ static int resize(GP_Context **c, const char *params) GP_Context *res = NULL;
res = GP_FilterResize(*c, NULL, alg, w, h, progress_callback); - + if (res == NULL) return EINVAL;
@@ -153,7 +153,7 @@ static int scale_check_size(const struct param *self __attribute__((unused)),
if (i <= 0) return 1; - + return 0; }
@@ -181,7 +181,7 @@ static int scale(GP_Context **c, const char *params)
if (w == -1) w = (*c)->w * (1.00 * h/(*c)->h) + 0.5; - + if (h == -1) h = (*c)->h * (1.00 * w/(*c)->w) + 0.5;
@@ -236,10 +236,10 @@ static int rotate(GP_Context **c, const char *params) res = GP_FilterRotate270Alloc(*c, progress_callback); break; } - + if (res == NULL) return ENOMEM; - + GP_ContextFree(*c); *c = res;
@@ -263,7 +263,7 @@ static int mirror(GP_Context **c, const char *params)
if (vert) GP_FilterMirrorV(*c, *c, progress_callback); - + if (horiz) GP_FilterMirrorH(*c, *c, progress_callback);
@@ -292,12 +292,12 @@ static int bright(GP_Context **c, const char *params) }
GP_FILTER_PARAMS((*c)->pixel_type, filter_params); - + if (chann == NULL) { GP_FilterParamSetIntAll(filter_params, bright); } else { GP_FilterParam *param = GP_FilterParamChannel(filter_params, chann); - + if (param == NULL) { print_error("bright: Invalid channel name"); return EINVAL; @@ -332,14 +332,14 @@ static int contrast(GP_Context **c, const char *params) print_error("contrast: mul parameter must be >= 0"); return EINVAL; } - + GP_FILTER_PARAMS((*c)->pixel_type, filter_params); - + if (chann == NULL) { GP_FilterParamSetFloatAll(filter_params, mul); } else { GP_FilterParam *param = GP_FilterParamChannel(filter_params, chann); - + if (param == NULL) { print_error("contrast: Invalid channel name"); return EINVAL; @@ -368,7 +368,7 @@ static int noise(GP_Context **c, const char *params) return EINVAL;
GP_FILTER_PARAMS((*c)->pixel_type, filter_params); - + GP_FilterParamSetFloatAll(filter_params, rat);
GP_FilterNoise(*c, *c, filter_params, progress_callback); @@ -458,7 +458,7 @@ static int dither(GP_Context **c, const char *params)
if (param_parse(params, dither_params, "dither", param_err, &fmt)) return EINVAL; - + if (fmt == -1) { print_error("dither: invalid format or format param missing"); return EINVAL; @@ -490,7 +490,7 @@ static int save_jpg(GP_Context **c, const char *params)
if (param_parse(params, save_jpg_params, "jpg", param_err, &file)) return EINVAL; - + if (file == NULL) { print_error("jpg: filename missing"); return EINVAL; @@ -514,7 +514,7 @@ static int save_png(GP_Context **c, const char *params)
if (param_parse(params, save_png_params, "png", param_err, &file)) return EINVAL; - + if (file == NULL) { print_error("png: filename missing"); return EINVAL; @@ -564,22 +564,22 @@ static int add_noise(GP_Context **c, const char *params)
if (param_parse(params, add_noise_params, "add_noise", param_err, &percents, &chann)) return EINVAL; - + GP_FILTER_PARAMS((*c)->pixel_type, priv); GP_FilterParamSetFloatAll(priv, percents/100); GP_FILTER_PARAMS((*c)->pixel_type, op_callbacks); - + if (chann == NULL) { GP_FilterParamSetPtrAll(op_callbacks, add_noise_op); } else { GP_FilterParam *param = GP_FilterParamChannel(op_callbacks, chann); - + if (param == NULL) { print_error("add_noise: Invalid channel name"); return EINVAL; }
- + GP_FilterParamSetPtrAll(op_callbacks, no_op); param->val.ptr = add_noise_op; } @@ -604,7 +604,7 @@ static int median(GP_Context **c, const char *params)
if (param_parse(params, median_params, "median", param_err, &rad, &rad_x, &rad_y)) return EINVAL; - + if (rad != -1) { rad_x = rad; rad_y = rad; @@ -643,7 +643,7 @@ static int sigma_mean(GP_Context **c, const char *params) if (param_parse(params, sigma_mean_params, "sigma", param_err, &rad, &min, &sigma, &rad_x, &rad_y)) return EINVAL; - + if (rad != -1) { rad_x = rad; rad_y = rad; @@ -678,7 +678,7 @@ static int sharpen(GP_Context **c, const char *params)
if (param_parse(params, sharpen_params, "sigma", param_err, &weight)) return EINVAL; - + GP_Context *ret = GP_FilterEdgeSharpeningAlloc(*c, weight, progress_callback);
if (ret == NULL) @@ -705,7 +705,7 @@ static int gauss_noise(GP_Context **c, const char *params)
if (param_parse(params, gauss_noise_params, "gaussian noise", param_err, &sigma, &mu)) return EINVAL; - + GP_FilterGaussianNoiseAdd(*c, *c, sigma, mu, progress_callback);
return 0; @@ -735,7 +735,7 @@ static int arithmetic(GP_Context **c, const char *params)
if (param_parse(params, arithmetic_params, "arithmetic", param_err, &file, &op)) return EINVAL; - + if (file == NULL) { print_error("arithmetic: Filename missing"); return EINVAL; @@ -789,7 +789,7 @@ static int histogram(GP_Context **c, const char *params)
if (param_parse(params, histogram_params, "histogram", param_err, &file)) return EINVAL; - + if (file == NULL) { print_error("histogram: Filename missing"); return EINVAL; @@ -851,7 +851,7 @@ static void print_filter_help(void) printf("%sn", filter_table[i].name);
j = strlen(filter_table[i].name); - + while (j--) putchar('-'); putchar('n'); @@ -883,7 +883,7 @@ static void add_filter(char *params) const char *name = strsep(¶ms, ":");
filters[filter_cnt] = get_filter(name); - + if (filters[filter_cnt] == NULL) { fprintf(stderr, "Invalid filter name '%s'n", name); exit(1); @@ -908,7 +908,7 @@ static void apply_filters(GP_Context **src) fprintf(stderr, "Error: %sn", strerror(ret)); exit(1); } - + if (progress_callback != NULL) fprintf(stderr, " donen"); } @@ -986,13 +986,13 @@ static void save_by_fmt(struct GP_Context *bitmap, const char *name, const char ret = GP_SaveJPG(bitmap, name, progress_callback); else if (!strcmp(fmt, "png")) ret = GP_SavePNG(bitmap, name, progress_callback); - + if (ret) { fprintf(stderr, "Failed to save bitmap: %sn", strerror(errno)); exit(1); } - + if (progress_callback != NULL) fprintf(stderr, " donen"); } @@ -1048,7 +1048,7 @@ int main(int argc, char *argv[])
for (i = optind; i < argc; i++) { char buf[255]; - + snprintf(buf, sizeof(buf), "out_%03i.%s", i - optind + 1, out_fmt); fprintf(stderr, "Processing '%s' -> '%s'n", argv[i], buf);
@@ -1058,7 +1058,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Failed to load bitmap: %sn", strerror(errno)); return 1; } - + if (progress_callback != NULL) fprintf(stderr, " donen");
@@ -1066,6 +1066,6 @@ int main(int argc, char *argv[])
save_by_fmt(bitmap, buf, out_fmt); } - + return 0; } diff --git a/demos/grinder/histogram.c b/demos/grinder/histogram.c index ab6929a..00bffbd 100644 --- a/demos/grinder/histogram.c +++ b/demos/grinder/histogram.c @@ -25,31 +25,31 @@ void histogram_to_png(const GP_Context *src, const char *filename) { GP_FILTER_PARAMS(src->pixel_type, params); - + GP_FilterHistogramAlloc(src->pixel_type, params); GP_FilterHistogram(src, params, NULL);
unsigned int i, j;
GP_Context *res = GP_ContextAlloc(257*4, 256, GP_PIXEL_RGB888); - + GP_Fill(res, 0xffffff);
GP_Histogram *hist_r; hist_r = (GP_FilterParamChannel(params, "R"))->val.ptr; - + for (i = 0; i < hist_r->len; i++) GP_VLineXYH(res, i, 256, -255.00 * hist_r->hist[i] / hist_r->max + 0.5 , 0xff0000); - + GP_Histogram *hist_g; hist_g = (GP_FilterParamChannel(params, "G"))->val.ptr; - + for (i = 0; i < hist_g->len; i++) GP_VLineXYH(res, i+257, 256, -255.00 * hist_g->hist[i] / hist_g->max + 0.5 , 0x00ff00); - + GP_Histogram *hist_b; hist_b = (GP_FilterParamChannel(params, "B"))->val.ptr; - + for (i = 0; i < hist_b->len; i++) GP_VLineXYH(res, i+514, 256, -255.00 * hist_b->hist[i] / hist_b->max + 0.5 , 0x0000ff);
@@ -60,10 +60,10 @@ void histogram_to_png(const GP_Context *src, const char *filename) for (i = 0; i < hist_r->len; i++) { for (j = 0; j < hist_r->len; j++) { GP_Pixel pix = 0; - + if (255 * hist_r->hist[i] / max + 0.5 > j) pix |= 0xff0000; - + if (255 * hist_g->hist[i] / max + 0.5 > j) pix |= 0x00ff00;
diff --git a/demos/grinder/params.c b/demos/grinder/params.c index 6d2b1aa..3f39a36 100644 --- a/demos/grinder/params.c +++ b/demos/grinder/params.c @@ -103,7 +103,7 @@ static unsigned int count_params(const char *params) char prev = ':';
for (i = 0; params[i] != '0'; i++) { - + if (params[i] == ':' && prev != ':') ret++;
@@ -119,7 +119,7 @@ static void split_params(char *params, char **names) char prev = ':';
for (i = 0; params[i] != '0'; i++) { - + if (params[i] != ':' && prev == ':') names[n++] = ¶ms[i];
@@ -137,7 +137,7 @@ static void do_split(char *param, char **value) *value = NULL;
for (i = 0; param[i] != '0'; i++) { - + if (param[i] == '=' || isspace(param[i])) { param[i] = '0'; *value = ¶m[i+1]; @@ -206,7 +206,7 @@ int set_bool(int *res, char *val) *res = 0; return 0; } - + for (i = 0; bool_true[i] != NULL; i++) if (!strcasecmp(val, bool_true[i])) { *res = 1; @@ -229,7 +229,7 @@ int set_float(float *res, char *val)
if (errno != 0) return 1; - + *res = d;
return 0; @@ -272,7 +272,7 @@ int param_parse(const char *params, const struct param *param_desc, void *priv,
if (params == NULL || *params == '0') return 0; - + par = strdup(params);
if (par == NULL) { @@ -290,7 +290,7 @@ int param_parse(const char *params, const struct param *param_desc, void *priv,
split_params(par, names); split_values(names, values, n); - + va_start(va, err);
for (i = 0; param_desc[i].name != NULL; i++) { @@ -298,12 +298,12 @@ int param_parse(const char *params, const struct param *param_desc, void *priv, int pos = 0;
while ((pos = param_pos(names, param_desc[i].name, pos, n)) >= 0) { - + if (values[pos] == NULL || *values[pos] == '0') { CALL_ERR_CALLBACK(err, ¶m_desc[i], "", priv); goto err; } - + flags[pos]++;
switch (param_desc[i].type) { diff --git a/demos/grinder/params.h b/demos/grinder/params.h index f726282..04fe00f 100644 --- a/demos/grinder/params.h +++ b/demos/grinder/params.h @@ -45,7 +45,7 @@ const char *param_type_name(enum param_type type);
void param_describe(const struct param *param_desc, const char *prefix);
-int param_parse(const char *params, const struct param *param_desc, void *priv, +int param_parse(const char *params, const struct param *param_desc, void *priv, int (*err)(const struct param *self, const char *val, void *priv), ...);
#endif /* PARAMS_H */ diff --git a/demos/particle/particle_demo.c b/demos/particle/particle_demo.c index 9b708c5..6fcc11d 100644 --- a/demos/particle/particle_demo.c +++ b/demos/particle/particle_demo.c @@ -43,7 +43,7 @@ static void sighandler(int signo) { if (backend != NULL) GP_BackendExit(backend); - + fprintf(stderr, "Got signal %in", signo);
exit(1); @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Invalid paramter '%c'n", opt); } } - + // GP_SetDebugLevel(10);
signal(SIGINT, sighandler); @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) init_backend(backend_opts);
context = backend->context; - + black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context); white_pixel = GP_ColorToContextPixel(GP_COL_WHITE, context);
@@ -107,7 +107,7 @@ int main(int argc, char *argv[]) while (GP_BackendGetEvent(backend, &ev)) {
GP_EventDump(&ev); - + switch (ev.type) { case GP_EV_KEY: if (ev.code != GP_EV_KEY_DOWN) @@ -133,7 +133,7 @@ int main(int argc, char *argv[]) break; } } - + if (!pause_flag) { space_time_tick(space, 1); space_draw_particles(context, space); diff --git a/demos/particle/space.c b/demos/particle/space.c index 928798a..c53b9e3 100644 --- a/demos/particle/space.c +++ b/demos/particle/space.c @@ -40,7 +40,7 @@ struct space *space_create(unsigned int particle_count, int min_w, int min_h,
new->gax = 0; new->gay = 0; - + new->elasticity = (1<<8) - (1<<6); new->mass_kappa = 1<<1;
@@ -70,12 +70,12 @@ void space_destroy(struct space *space) void space_draw_particles(GP_Context *context, struct space *space) { unsigned int i; - + GP_Fill(context, 0x000000);
for (i = 0; i < space->particle_count; i++) { GP_Pixel color; - + GP_Coord x = space->particles[i].x; GP_Coord y = space->particles[i].y; GP_Coord a1 = GP_FP_1 * 4; @@ -89,7 +89,7 @@ void space_draw_particles(GP_Context *context, struct space *space) */
color = GP_RGBToContextPixel(0xee, 0xee, 0xee, context); - + GP_PutPixelAA(context, x, y, color);
int val = SQUARE(space->particles[i].vx) + SQUARE(space->particles[i].vy); @@ -110,19 +110,19 @@ void space_draw_particles(GP_Context *context, struct space *space) // GP_LineAA(context, x - a2, y + a1, x - a1, y + a2, color); GP_LineAA(context, x - a1, y + a2, x - a1, y - a2, color); // GP_LineAA(context, x - a1, y - a2, x - a2, y - a1, color); -/* +/* GP_PutPixelAA(context, x + a2, y - a1, 0xffffff); GP_PutPixelAA(context, x + a1, y - a2, 0xffffff);
GP_PutPixelAA(context, x + a1, y + a2, 0xffffff); GP_PutPixelAA(context, x + a2, y + a1, 0xffffff); - + GP_PutPixelAA(context, x - a2, y + a1, 0xffffff); GP_PutPixelAA(context, x - a1, y + a2, 0xffffff); - + GP_PutPixelAA(context, x - a1, y - a2, 0xffffff); GP_PutPixelAA(context, x - a2, y - a1, 0xffffff); -*/ +*/ } }
@@ -130,9 +130,9 @@ static void central_gravity(struct space *space, int time) { unsigned int i;
- for (i = 0; i < space->particle_count; i++) { - space->particles[i].vx += space->gax * time; - space->particles[i].vy += space->gay * time; + for (i = 0; i < space->particle_count; i++) { + space->particles[i].vx += space->gax * time; + space->particles[i].vy += space->gay * time; } }
@@ -161,7 +161,7 @@ static void gravity_forces(struct space *space, int time) int a = GP_FP_DIV(space->mass_kappa, dist_squared) * time;
space->particles[i].vx -= (a * dist_x) / dist; - space->particles[i].vy -= (a * dist_y) / dist; + space->particles[i].vy -= (a * dist_y) / dist; } }
@@ -177,11 +177,11 @@ void space_time_tick(struct space *space, int time) if ((space->particles[i].x < space->min_w && space->particles[i].vx < 0) || (space->particles[i].x >= space->max_w && space->particles[i].vx > 0)) space->particles[i].vx = GP_FP_MUL(space->particles[i].vx, -space->elasticity); - + if ((space->particles[i].y < space->min_h && space->particles[i].vy < 0) || (space->particles[i].y >= space->max_h && space->particles[i].vy > 0)) space->particles[i].vy = GP_FP_MUL(space->particles[i].vy, -space->elasticity); - + space->particles[i].x += space->particles[i].vx * time; space->particles[i].y += space->particles[i].vy * time; } diff --git a/demos/particle/space.h b/demos/particle/space.h index 9b58037..7878b11 100644 --- a/demos/particle/space.h +++ b/demos/particle/space.h @@ -47,7 +47,7 @@ struct space { /* space is an rectanle */ int min_w; int min_h; - + int max_w; int max_h;
diff --git a/demos/py_simple/blit.py b/demos/py_simple/blit.py index 14fa361..2b3a694 100755 --- a/demos/py_simple/blit.py +++ b/demos/py_simple/blit.py @@ -51,7 +51,7 @@ def main(): # Load Backgroudn Image and ball sprite bg = loaders.Load(sys.argv[1]) assert(bg) - + ball1 = Ball(bg.w//2, bg.h//2, -3, -3, 'ball_red.png', bg) ball2 = Ball(bg.w//2, bg.h//2, -2, 3, 'ball_green.png', bg) ball3 = Ball(bg.w//2, bg.h//2, 2, -3, 'ball_blue.png', bg) @@ -65,7 +65,7 @@ def main():
# Event loop while True: - + while True: ev = bk.PollEvent()
@@ -79,7 +79,7 @@ def main(): elif (ev.type == input.EV_SYS): if (ev.code == input.EV_SYS_QUIT): sys.exit(0) - + sleep(0.005)
ball1.move(bk); diff --git a/demos/py_simple/cam_view.py b/demos/py_simple/cam_view.py index 4159609..6692abb 100755 --- a/demos/py_simple/cam_view.py +++ b/demos/py_simple/cam_view.py @@ -32,7 +32,7 @@ def main():
if (ev is None): continue - + input.EventDump(ev)
if (ev.type == input.EV_KEY): diff --git a/demos/py_simple/gfx.py b/demos/py_simple/gfx.py index 9d82a1b..81d78b3 100755 --- a/demos/py_simple/gfx.py +++ b/demos/py_simple/gfx.py @@ -103,33 +103,33 @@ def polygon(bk): bk.Flip()
def next(bk, i): - + if (i == 0): fill(bk)
if (i == 1): hline(bk) - + if (i == 2): vline(bk) - + if (i == 3): line(bk) - + if (i == 4): rect(bk)
if (i == 5): - triangle(bk) - + triangle(bk) + if (i == 6): - tetragon(bk) + tetragon(bk)
if (i == 7): polygon(bk)
i = i + 1; - + if (i >= 8): i = 0
diff --git a/demos/py_simple/progress_callback.py b/demos/py_simple/progress_callback.py index 4055f1a..f712faf 100755 --- a/demos/py_simple/progress_callback.py +++ b/demos/py_simple/progress_callback.py @@ -26,8 +26,8 @@ def main(): exit(1)
try: - img = filters.FilterGaussianBlurAlloc(img, 50, 50, callback) - print('') + img = filters.FilterGaussianBlurAlloc(img, 50, 50, callback) + print('') except OSError: print("Filter Aborted")
diff --git a/demos/py_simple/pygtk_example.py b/demos/py_simple/pygtk_example.py index e2ef4a0..e7b1643 100755 --- a/demos/py_simple/pygtk_example.py +++ b/demos/py_simple/pygtk_example.py @@ -23,13 +23,13 @@ class HelloWorld: self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) self.window.set_border_width(1) - + self.image = gtk.Image(); self.window.add(self.image) - + self.window.show() self.image.show() - + img = loaders.LoadImage(sys.argv[2], None) self.pixmap = gtk.gdk.Pixmap(None, img.w, img.h, 24) self.gc = gtk.gdk.Drawable.new_gc(self.pixmap) diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py index 1766087..133be6e 100755 --- a/demos/py_simple/x11_windows.py +++ b/demos/py_simple/x11_windows.py @@ -18,11 +18,11 @@ def redraw(bk, id):
align = text.C.ALIGN_CENTER | text.C.VALIGN_CENTER c.text.Text(None, c.w//2, c.h//2, align, white, black, "%s - %sx%s" % (id, c.w, c.h)) - + bk.Flip()
def parse_events(bk, id): - + print("------ Window %s -------" % (id))
while True: diff --git a/demos/spiv/cpu_timer.c b/demos/spiv/cpu_timer.c index 6c26d61..2071ada 100644 --- a/demos/spiv/cpu_timer.c +++ b/demos/spiv/cpu_timer.c @@ -38,7 +38,7 @@ static void to_time(int *sec, int *nsec, struct timespec *start, void cpu_timer_start(struct cpu_timer *self, const char *name) { self->name = name; - + clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &self->t_cpu_start); clock_gettime(CLOCK_MONOTONIC, &self->t_real_start); } diff --git a/demos/spiv/image_actions.c b/demos/spiv/image_actions.c index de35255..b153af4 100644 --- a/demos/spiv/image_actions.c +++ b/demos/spiv/image_actions.c @@ -143,7 +143,7 @@ static size_t get_name_ext(const char *path, *extension = NULL;
for (i = len; i > 0; i--) { - + if (*extension) name_len++;
@@ -222,7 +222,7 @@ static int cmd_append(const char *str, size_t len)
if (cmd_size - cmd_pos <= len) { char *new_cmd = realloc(cmd, cmd_size + 1024); - + if (new_cmd == NULL) { fprintf(stderr, "Failed to allocated command buffern"); return 1; @@ -245,7 +245,7 @@ static int cmd_append_escape(const char *str, size_t len)
while ((ret = escape(str, len, cmd + cmd_pos, cmd_size - cmd_pos)) < 0) { char *new_cmd = realloc(cmd, cmd_size + 1024); - + if (new_cmd == NULL) { fprintf(stderr, "Failed to allocated command buffern"); return 1; @@ -283,7 +283,7 @@ static int prepare_cmd(unsigned int action, const char *img_path)
if (cmd_append(prev, len - 1)) return 1; - + switch (actions[action]->params[i].type) { case 'f': cmd_append(img_path, 0); diff --git a/demos/spiv/image_actions.h b/demos/spiv/image_actions.h index b03fbb1..efff308 100644 --- a/demos/spiv/image_actions.h +++ b/demos/spiv/image_actions.h @@ -40,6 +40,6 @@
void image_action_set(unsigned int action, const char *cmd);
-int image_action_run(unsigned int action, const char *img_path); +int image_action_run(unsigned int action, const char *img_path);
#endif /* __IMAGE_ACTIONS_H__ */ diff --git a/demos/spiv/image_cache.c b/demos/spiv/image_cache.c index 496489e..22f3b70 100644 --- a/demos/spiv/image_cache.c +++ b/demos/spiv/image_cache.c @@ -42,7 +42,7 @@ struct image { struct image_cache { unsigned int max_size; unsigned int cur_size; - + struct image *root; struct image *end; }; @@ -126,7 +126,7 @@ static void remove_img_free(struct image_cache *self, { GP_DEBUG(2, "Freeing image '%s:%10li:%10li' size %zu", img->path, img->cookie1, img->cookie2, size); - + remove_img(self, img, size); GP_ContextFree(img->ctx); free(img); @@ -138,10 +138,10 @@ static void remove_img_free(struct image_cache *self, static void add_img(struct image_cache *self, struct image *img, size_t size) { img->next = self->root; - + if (img->next) img->next->prev = img; - + img->prev = NULL;
self->root = img; @@ -155,7 +155,7 @@ GP_Context *image_cache_get(struct image_cache *self, const char *path, long cookie1, long cookie2, int elevate) { struct image *i; - + if (self == NULL) return NULL;
@@ -165,7 +165,7 @@ GP_Context *image_cache_get(struct image_cache *self, const char *path, if (!strcmp(path, i->path) && i->cookie1 == cookie1 && i->cookie2 == cookie2) break; - + if (i == NULL) return NULL;
@@ -175,10 +175,10 @@ GP_Context *image_cache_get(struct image_cache *self, const char *path,
GP_DEBUG(2, "Refreshing image '%s:%10li:%10li", path, cookie1, cookie2); - + remove_img(self, i, size); add_img(self, i, size); - + i->elevated++; }
@@ -207,7 +207,7 @@ static int assert_size(struct image_cache *self, size_t size) return 0;
while (self->cur_size + size > self->max_size) { - + if (self->end == NULL) { GP_WARN("Cache too small for image size %zu", size); return 1; @@ -223,13 +223,13 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, const char *path, long cookie1, long cookie2) { size_t size; - + if (self == NULL) return 1; - + size = image_size2(ctx, path);
- /* + /* * We try to create room for the image. If this fails we add the image * anyway because we need to store it while we are showing it (and it * will be removed from cache by next image for sure). @@ -242,13 +242,13 @@ int image_cache_put(struct image_cache *self, GP_Context *ctx, const char *path, GP_WARN("Malloc failed :("); return 1; } - + img->ctx = ctx; img->cookie1 = cookie1; img->cookie2 = cookie2; img->elevated = 0; strcpy(img->path, path); - + GP_DEBUG(2, "Adding image '%s:%10li:%10li' size %zu", img->path, img->cookie1, img->cookie2, size);
@@ -261,9 +261,9 @@ void image_cache_drop(struct image_cache *self) { if (self == NULL) return; - + GP_DEBUG(1, "Dropping images in cache"); - + while (self->end != NULL) remove_img_free(self, self->end, 0);
@@ -279,6 +279,6 @@ void image_cache_destroy(struct image_cache *self)
while (self->end != NULL) remove_img_free(self, self->end, 0); - + free(self); } diff --git a/demos/spiv/image_cache.h b/demos/spiv/image_cache.h index 023ccd8..1c03545 100644 --- a/demos/spiv/image_cache.h +++ b/demos/spiv/image_cache.h @@ -43,7 +43,7 @@ struct image_cache *image_cache_create(unsigned int max_size_bytes);
/* * Returns cached image, or NULL. - * + * * If elevate set and image is found, the image is elevated to the top so * it has lesser chance of being freed. */ @@ -54,7 +54,7 @@ GP_Context *image_cache_get(struct image_cache *self, const char *path, * Puts an image into a cache. */ int image_cache_put(struct image_cache *self, GP_Context *img, - const char *path, long cookie1, long cookie2); + const char *path, long cookie1, long cookie2);
/* * Drop all image in cache. diff --git a/demos/spiv/image_list.c b/demos/spiv/image_list.c index 042ef4b..afaff25 100644 --- a/demos/spiv/image_list.c +++ b/demos/spiv/image_list.c @@ -44,7 +44,7 @@ struct image_list { /* path to the currently loaded image */ char path[1024]; int path_loaded:1; - + /* directory handling */ int in_dir:1;
@@ -63,17 +63,17 @@ static int dir_filter(const struct dirent *d) /* Ignore some filenames */ if (!strcmp(d->d_name, ".")) return 0; - + if (!strcmp(d->d_name, "..")) return 0; - + //TODO: filter out directories - + if (GP_MatchExtension(d->d_name) == NULL) return 0;
GP_DEBUG(4, "Adding file '%s'", d->d_name); - + return 1; }
@@ -100,7 +100,7 @@ static void try_load_dir(struct image_list *self) GP_WARN("Failed to scandir '%s': %s", path, strerror(errno)); return; } - + if (self->arg_file_counts[self->cur_arg] != ret) { GP_DEBUG(1, "Updating arg counter to %i", ret); self->arg_file_counts[self->cur_arg] = ret; @@ -125,7 +125,7 @@ static void exit_dir(struct image_list *self)
for (i = 0; i < self->max_file; i++) free(self->dir_files[i]); - + free(self->dir_files);
self->in_dir = 0; @@ -141,10 +141,10 @@ static void next_img(struct image_list *self) return; } } - + if (++self->cur_arg == self->max_arg) self->cur_arg = 0; - + try_load_dir(self);
self->path_loaded = 0; @@ -202,7 +202,7 @@ static void set_dir_cur_img(struct image_list *self, int img)
/* * Returns current argument from arg list we are in. - * + * * Either it's image file or directory. */ static const char *cur_arg(struct image_list *self) @@ -297,14 +297,14 @@ const char *image_list_dir_move(struct image_list *self, int direction) set_dir_cur_img(self, 0); } } - + return image_list_img_path(self); }
const char *image_list_first(struct image_list *self) { GP_DEBUG(2, "Moving to the first image in the list"); - + set_cur_arg(self, 0);
if (self->in_dir) @@ -336,7 +336,7 @@ static unsigned int count_img_to(struct image_list *self, unsigned int arg_to) if (self->arg_file_counts[i] == -1) set_cur_arg(self, i);
- /* + /* * if the counter is still at -1 * directory couldn't be loaded */ @@ -346,7 +346,7 @@ static unsigned int count_img_to(struct image_list *self, unsigned int arg_to)
/* restore the original position */ set_cur_arg(self, cur_arg); - + if (self->in_dir) set_dir_cur_img(self, cur_file);
@@ -386,7 +386,7 @@ struct image_list *image_list_create(const char *args[]) unsigned int i;
GP_DEBUG(1, "Creating image list"); - + self = malloc(sizeof(struct image_list));
if (self == NULL) { @@ -396,9 +396,9 @@ struct image_list *image_list_create(const char *args[])
self->args = args; self->cur_arg = 0; - + self->path_loaded = 0; - + self->dir_files = 0; self->in_dir = 0;
@@ -426,7 +426,7 @@ const char *image_list_img_path(struct image_list *self) { if (!self->path_loaded) load_path(self); - + GP_DEBUG(2, "Returning path '%s'", self->path);
return self->path; diff --git a/demos/spiv/image_list.h b/demos/spiv/image_list.h index 17f21d0..54dbfab 100644 --- a/demos/spiv/image_list.h +++ b/demos/spiv/image_list.h @@ -51,18 +51,18 @@ const char *image_list_move(struct image_list *self, int direction); * If we are in directory: * if direction > 0: move to its end and if allready there, to the next arg * if direction < 0: move to its begining and if allready there, to the previous arg - * + * * If we aren't in directory move by one in corresponding direction. */ const char *image_list_dir_move(struct image_list *self, int direction);
/* - * Move to the first image in the list. + * Move to the first image in the list. */ const char *image_list_first(struct image_list *self);
/* - * Move to the last image in the list. + * Move to the last image in the list. */ const char *image_list_last(struct image_list *self);
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 11b8f4b..9b34c35 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -52,17 +52,17 @@ static int abort_flag = 0; static int show_progress = 0;
enum zoom_type { - /* + /* * Resize image to fit current size of the window. */ ZOOM_FIT, - - /* + + /* * Use zoom set in zoom float and zoom offsets. */ ZOOM_FIXED, - - /* + + /* * Fixed zoom but spiv tries to change * the window size to fit the image size */ @@ -100,10 +100,10 @@ struct loader_params { /* offset in pixels */ unsigned int zoom_x_offset; unsigned int zoom_y_offset; - + /* zoom */ enum zoom_type zoom_type; - float zoom; + float zoom;
/* caches for loaded images */ struct image_cache *img_resized_cache; @@ -130,7 +130,7 @@ static int image_loader_callback(GP_ProgressCallback *self) (const char*)self->priv, self->percentage);
int align = GP_ALIGN_CENTER|GP_VALIGN_ABOVE; - + size = GP_TextWidth(NULL, buf);
int start = c->w/2 - size/2 - 10; @@ -177,7 +177,7 @@ static float calc_img_size(struct loader_params *params, { float w_rat; float h_rat; - + switch (params->zoom_type) { case ZOOM_FIT_DOWNSCALE: if (img_w <= src_w && img_h <= src_h) @@ -224,7 +224,7 @@ static GP_Context *load_image(struct loader_params *params, int elevate) { struct cpu_timer timer; GP_Context *img, *context = backend->context; - + GP_ProgressCallback callback = {.callback = image_loader_callback, .priv = "Loading image"};
@@ -236,7 +236,7 @@ static GP_Context *load_image(struct loader_params *params, int elevate)
cpu_timer_start(&timer, "Loading"); if ((img = GP_LoadImage(params->img_path, &callback)) == NULL) { - + if (errno == ECANCELED) return NULL;
@@ -245,12 +245,12 @@ static GP_Context *load_image(struct loader_params *params, int elevate) GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "'%s'", params->img_path); GP_Print(context, NULL, context->w/2, context->h/2 + 10, - GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, + GP_ALIGN_CENTER|GP_VALIGN_CENTER, white_pixel, black_pixel, "Failed to load image :( (%s)", strerror(errno)); GP_BackendFlip(backend); return NULL; } - + /* Workaround */ // if (img->pixel_type != GP_PIXEL_RGB888) { // GP_Context *tmp; @@ -260,11 +260,11 @@ static GP_Context *load_image(struct loader_params *params, int elevate) // }
image_cache_put(params->img_orig_cache, img, params->img_path, 0, 0); - + cpu_timer_stop(&timer); }
- return img; + return img; }
/* @@ -321,7 +321,7 @@ static void update_display(struct loader_params *params, GP_Context *img) img = GP_FilterRotate270Alloc(img, &callback); break; } - + if (img == NULL) return;
@@ -344,7 +344,7 @@ static void update_display(struct loader_params *params, GP_Context *img) GP_Context sub_display;
cpu_timer_start(&timer, "Blitting"); - + if (params->use_dithering) { callback.priv = "Dithering"; GP_SubContext(context, &sub_display, cx, cy, img->w, img->h); @@ -356,18 +356,18 @@ static void update_display(struct loader_params *params, GP_Context *img)
GP_Blit_Clipped(img, 0, 0, img->w, img->h, context, cx, cy); } - + cpu_timer_stop(&timer); - + if (params->rotate) GP_ContextFree(img); - + /* clean up the rest of the display */ GP_FillRectXYWH(context, 0, 0, cx, context->h, black_pixel); GP_FillRectXYWH(context, 0, 0, context->w, cy, black_pixel); - + int w = context->w - img->w - cx; - + if (w > 0) GP_FillRectXYWH(context, img->w + cx, 0, w, context->h, black_pixel);
@@ -375,8 +375,8 @@ static void update_display(struct loader_params *params, GP_Context *img)
if (h > 0) GP_FillRectXYWH(context, 0, img->h + cy, context->w, h, black_pixel); - - set_caption(params->img_path, params->rat); + + set_caption(params->img_path, params->rat);
if (!params->show_info) { GP_BackendFlip(backend); @@ -384,53 +384,53 @@ static void update_display(struct loader_params *params, GP_Context *img) }
GP_Size th = GP_TextHeight(NULL); - + GP_Print(context, NULL, 11, 11, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, black_pixel, white_pixel, "%ux%u", img->w, img->h); - + GP_Print(context, NULL, 10, 10, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white_pixel, black_pixel, "%ux%u", img->w, img->h); - + GP_Print(context, NULL, 11, 13 + th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, black_pixel, white_pixel, "1:%3.3f", params->rat); - + GP_Print(context, NULL, 10, 12 + th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white_pixel, black_pixel, "1:%3.3f", params->rat); - + GP_Print(context, NULL, 11, 15 + 2 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, black_pixel, white_pixel, "%s", img_name(params->img_path)); - + GP_Print(context, NULL, 10, 14 + 2 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white_pixel, black_pixel, "%s", img_name(params->img_path)); - + GP_Print(context, NULL, 11, 17 + 3 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, black_pixel, white_pixel, "%s%s", params->use_low_pass && params->rat < 1 ? "Gaussian LP + " : "", GP_InterpolationTypeName(params->resampling_method)); - + GP_Print(context, NULL, 10, 16 + 3 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, - white_pixel, black_pixel, "%s%s", + white_pixel, black_pixel, "%s%s", params->use_low_pass && params->rat < 1 ? "Gaussian LP + " : "", GP_InterpolationTypeName(params->resampling_method));
unsigned int count = image_list_count(params->img_list); unsigned int pos = image_list_pos(params->img_list) + 1; - + GP_Print(context, NULL, 11, 19 + 4 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, black_pixel, white_pixel, "%u of %u", pos, count); - + GP_Print(context, NULL, 10, 18 + 4 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, - white_pixel, black_pixel, "%u of %u", pos, count); - + white_pixel, black_pixel, "%u of %u", pos, count); + unsigned int dir_count = image_list_dir_count(params->img_list); unsigned int dir_pos = image_list_dir_pos(params->img_list) + 1;
if (dir_count > 1 && dir_count != count) { GP_Print(context, NULL, 11, 21 + 5 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, - black_pixel, white_pixel, "%u of %u in directory", dir_pos, dir_count); - + black_pixel, white_pixel, "%u of %u in directory", dir_pos, dir_count); + GP_Print(context, NULL, 10, 20 + 5 * th, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, - white_pixel, black_pixel, "%u of %u in directory", dir_pos, dir_count); + white_pixel, black_pixel, "%u of %u in directory", dir_pos, dir_count); }
GP_BackendFlip(backend); @@ -442,7 +442,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size GP_Context *img, *res = NULL; struct cpu_timer timer; GP_ProgressCallback callback = {.callback = image_loader_callback}; - + int key = (params->resampling_method<<1) | !!(params->use_low_pass);
/* Try to get resized cached image */ @@ -450,7 +450,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size
if (img != NULL) return img; - + /* Otherwise load image and resize it */ if ((img = load_image(params, 1)) == NULL) return NULL; @@ -468,18 +468,18 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size if (params->use_low_pass && params->rat < 1) { cpu_timer_start(&timer, "Blur"); callback.priv = "Blurring Image"; - + res = GP_FilterGaussianBlurAlloc(img, 0.3/params->rat, 0.3/params->rat, &callback);
if (res == NULL) return NULL; - + img = res; - + cpu_timer_stop(&timer); } - + // img->gamma = GP_GammaAcquire(img->pixel_type, 0.45);
cpu_timer_start(&timer, "Resampling"); @@ -510,7 +510,7 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size return NULL;
image_cache_put(params->img_resized_cache, img, params->img_path, cookie, key); - + return img; }
@@ -521,7 +521,7 @@ static void *image_loader(void *ptr) GP_Context *img, *context = backend->context;
cpu_timer_start(&sum_timer, "sum"); - + show_progress = params->show_progress || params->show_progress_once; params->show_progress_once = 0;
@@ -565,7 +565,7 @@ static void *image_loader(void *ptr) update: update_display(params, img); cpu_timer_stop(&sum_timer); - + return NULL; }
@@ -617,7 +617,7 @@ static void sighandler(int signo) { if (backend != NULL) GP_BackendExit(backend); - + fprintf(stderr, "Got signal %in", signo);
_exit(1); @@ -625,8 +625,8 @@ static void sighandler(int signo)
static void init_backend(const char *backend_opts) { - backend = GP_BackendInit(backend_opts, "Spiv", stderr); - + backend = GP_BackendInit(backend_opts, "Spiv", stderr); + if (backend == NULL) { fprintf(stderr, "Failed to initalize backend '%s'n", backend_opts); exit(1); @@ -675,8 +675,8 @@ int main(int argc, char *argv[]) GP_PixelType emul_type = GP_PIXEL_UNKNOWN;
struct loader_params params = { - .img_path = NULL, - + .img_path = NULL, + .show_progress = 0, .show_progress_once = 0, .show_info = 0, @@ -767,7 +767,7 @@ int main(int argc, char *argv[]) signal(SIGSEGV, sighandler); signal(SIGBUS, sighandler); signal(SIGABRT, sighandler); - + init_caches(¶ms);
init_backend(backend_opts); @@ -801,10 +801,10 @@ int main(int argc, char *argv[]) GP_Event ev;
while (GP_BackendGetEvent(backend, &ev)) { - + shift_flag = GP_EventGetKey(&ev, GP_KEY_LEFT_SHIFT) || GP_EventGetKey(&ev, GP_KEY_RIGHT_SHIFT); - + switch (ev.type) { case GP_EV_REL: switch (ev.code) { @@ -838,7 +838,7 @@ int main(int argc, char *argv[]) break; case GP_KEY_I: params.show_info = !params.show_info; - + params.show_progress_once = 1; show_image(¶ms, NULL); break; @@ -849,7 +849,7 @@ int main(int argc, char *argv[]) params.rotate += 90; if (params.rotate > 270) params.rotate = 0; - + params.show_progress_once = 1; show_image(¶ms, NULL); break; @@ -858,7 +858,7 @@ int main(int argc, char *argv[])
if (params.resampling_method > GP_INTERP_MAX) params.resampling_method = 0; - + if (params.resampling_method == GP_INTERP_LINEAR_LF_INT) { params.use_low_pass = 0; params.show_nn_first = 0; @@ -875,7 +875,7 @@ int main(int argc, char *argv[]) params.resampling_method = GP_INTERP_MAX; else params.resampling_method--; - + if (params.resampling_method == GP_INTERP_LINEAR_LF_INT) { params.use_low_pass = 0; params.show_nn_first = 0; @@ -883,13 +883,13 @@ int main(int argc, char *argv[]) params.use_low_pass = 1; params.show_nn_first = 1; } - + params.show_progress_once = 1; show_image(¶ms, image_list_img_path(list)); break; case GP_KEY_L: params.use_low_pass = !params.use_low_pass; - + params.show_progress_once = 1; show_image(¶ms, image_list_img_path(list)); break; @@ -926,7 +926,7 @@ int main(int argc, char *argv[]) set_zoom_offset(¶ms, 1, 0); else set_zoom_offset(¶ms, 10, 0); - + break; case GP_KEY_LEFT: if (shift_flag) diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index f8d3c40..4a80fd2 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -99,10 +99,10 @@ void print_help(void) printf(" %%N shell escaped image filename without extensionn"); printf(" %%e current image file extensionn"); puts("n"); - + for (i = 0; i < keys_help_len; i++) puts(keys_help[i]); - + puts("");
printf("Some cool options to try:nn"); @@ -114,7 +114,7 @@ void print_help(void) printf("truns spiv using X root window as backend windownn"); printf("spiv -b 'X11:CREATE_ROOT' [images]n"); printf("tSame as abowe but works in KDEn"); - + }
static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff) @@ -131,7 +131,7 @@ static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff)
if (h + 2 >= (GP_Coord)c->h) goto out; - + GP_Print(c, NULL, 20 + 10 * xoff, h, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, white, black, "%s", keys_help[i]); } @@ -154,7 +154,7 @@ void draw_help(GP_Backend *backend)
for (;;) { GP_Event ev; - + while (GP_BackendWaitEvent(backend, &ev)) { switch (ev.type) { case GP_EV_KEY: diff --git a/demos/ttf2img/ttf2img.c b/demos/ttf2img/ttf2img.c index d027139..9bc4558 100644 --- a/demos/ttf2img/ttf2img.c +++ b/demos/ttf2img/ttf2img.c @@ -73,7 +73,7 @@ int main(int argc, char *argv[]) print_help(1);
GP_SetDebugLevel(debug_level); - + GP_Context *context = GP_ContextAlloc(img_w, img_h, GP_PIXEL_RGB888);
GP_Pixel black_pixel = GP_ColorToContextPixel(GP_COL_BLACK, context); @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) black_pixel, white_pixel, string);
GP_SavePNG(context, img_path, NULL); - + GP_ContextFree(context);
return 0; diff --git a/libs/filters/GP_LinearThreads.c b/libs/filters/GP_LinearThreads.c index 554d492..218110b 100644 --- a/libs/filters/GP_LinearThreads.c +++ b/libs/filters/GP_LinearThreads.c @@ -89,7 +89,7 @@ int GP_FilterHConvolutionMP_Raw(const GP_ConvolutionParams *params) convs[i].y_dst = y_dst_2; convs[i].callback = params->callback ? &callback_mp : NULL;
- pthread_create(&threads[i], NULL, h_linear_convolution, &convs[i]); + pthread_create(&threads[i], NULL, h_linear_convolution, &convs[i]); }
int ret = 0; @@ -137,7 +137,7 @@ int GP_FilterVConvolutionMP_Raw(const GP_ConvolutionParams *params) convs[i].y_dst = y_dst_2; convs[i].callback = params->callback ? &callback_mp : NULL;
- pthread_create(&threads[i], NULL, v_linear_convolution, &convs[i]); + pthread_create(&threads[i], NULL, v_linear_convolution, &convs[i]); }
int ret = 0; @@ -184,7 +184,7 @@ int GP_FilterConvolutionMP_Raw(const GP_ConvolutionParams *params) convs[i].y_dst = y_dst_2; convs[i].callback = params->callback ? &callback_mp : NULL;
- pthread_create(&threads[i], NULL, linear_convolution, &convs[i]); + pthread_create(&threads[i], NULL, linear_convolution, &convs[i]); }
int ret = 0;
http://repo.or.cz/w/gfxprim.git/commit/96bc5c8ddadbd2a8acd894f6c6d8f70779ed7...
commit 96bc5c8ddadbd2a8acd894f6c6d8f70779ed7fd0 Author: Cyril Hrubis metan@ucw.cz Date: Fri Jun 28 01:15:44 2013 +0200
core: Straigten up the blit code a bit.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/core/GP_Blit.c b/libs/core/GP_Blit.c index 1651ca9..cb8223e 100644 --- a/libs/core/GP_Blit.c +++ b/libs/core/GP_Blit.c @@ -17,16 +17,16 @@ * Boston, MA 02110-1301 USA * * * * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * - * Copyright (C) 2011-2012 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2011-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#include "GP_Pixel.h" -#include "GP_GetPutPixel.h" -#include "GP_Context.h" -#include "GP_Convert.h" -#include "GP_Debug.h" -#include "GP_Blit.h" +#include "core/GP_Pixel.h" +#include "core/GP_GetPutPixel.h" +#include "core/GP_Context.h" +#include "core/GP_Convert.h" +#include "core/GP_Debug.h" +#include "core/GP_Blit.h"
/* Generated functions */ void GP_BlitXYXY_Raw_Fast(const GP_Context *src, @@ -37,25 +37,6 @@ void GP_BlitXYXY_Fast(const GP_Context *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Context *dst, GP_Coord x2, GP_Coord y2);
-/* -void GP_BlitXYXY_Naive(const GP_Context *src, - GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, - GP_Context *dst, GP_Coord x2, GP_Coord y2) -{ - GP_Coord x, y; - - for (y = y0; y <= y1; y++) - for (x = x0; x <= x1; x++) { - GP_Pixel p = GP_GetPixel(src, x, y); - - if (src->pixel_type != dst->pixel_type) - p = GP_ConvertContextPixel(p, src, dst); - - GP_PutPixel(dst, x2 + (x - x0), y2 + (y - y0), p); - } -} -*/ - void GP_BlitXYXY(const GP_Context *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Context *dst, GP_Coord x2, GP_Coord y2) @@ -77,10 +58,7 @@ void GP_BlitXYXY(const GP_Context *src, GP_CHECK(x2 + (x1 - x0) < (GP_Coord)GP_ContextW(dst)); GP_CHECK(y2 + (y1 - y0) < (GP_Coord)GP_ContextH(dst));
- if (GP_ContextRotationEqual(src, dst)) - GP_BlitXYXY_Raw_Fast(src, x0, y0, x1, y1, dst, x2, y2); - else - GP_BlitXYXY_Fast(src, x0, y0, x1, y1, dst, x2, y2); + GP_BlitXYXY_Fast(src, x0, y0, x1, y1, dst, x2, y2); }
void GP_BlitXYXY_Clipped(const GP_Context *src, @@ -138,10 +116,7 @@ void GP_BlitXYXY_Clipped(const GP_Context *src, x0, y0, x1, y1, GP_ContextW(src), GP_ContextH(src), x2, y2, GP_ContextW(dst), GP_ContextH(dst));
- if (GP_ContextRotationEqual(src, dst)) - GP_BlitXYXY_Raw_Fast(src, x0, y0, x1, y1, dst, x2, y2); - else - GP_BlitXYXY_Fast(src, x0, y0, x1, y1, dst, x2, y2); + GP_BlitXYXY_Fast(src, x0, y0, x1, y1, dst, x2, y2); }
void GP_BlitXYWH(const GP_Context *src, diff --git a/libs/core/GP_Blit.gen.c.t b/libs/core/GP_Blit.gen.c.t index 80c7f68..2046350 100644 --- a/libs/core/GP_Blit.gen.c.t +++ b/libs/core/GP_Blit.gen.c.t @@ -68,7 +68,7 @@ static void blitXYXY_Raw_{{ ps.suffix }}(const GP_Context *src, GP_Coord x0, GP_Coord y0, GP_Coord x1, GP_Coord y1, GP_Context *dst, GP_Coord x2, GP_Coord y2) { -%% if not ps.needs_bit_endian() +%% if not ps.needs_bit_endian() /* memcpy() each horizontal line */ GP_Coord y;
@@ -76,7 +76,7 @@ static void blitXYXY_Raw_{{ ps.suffix }}(const GP_Context *src, memcpy(GP_PIXEL_ADDR_{{ ps.suffix }}(dst, x2, y2 + y), GP_PIXEL_ADDR_{{ ps.suffix }}(src, x0, y0 + y), {{ int(ps.size/8) }} * (x1 - x0 + 1)); -%% else +%% else {# /* Rectangles may not be bit-aligned in the same way! */ /* Alignment (index) of first bits in the first byte */ //TODO: This is wrong for subcontexts where the offset @@ -111,7 +111,7 @@ static void blitXYXY_Raw_{{ ps.suffix }}(const GP_Context *src, } else /* Different bit-alignment, can't use memcpy() */ #} blitXYXY_Naive_Raw(src, x0, y0, x1, y1, dst, x2, y2); -%% endif +%% endif }
%% endfor @@ -174,24 +174,24 @@ void GP_BlitXYXY_Raw_Fast(const GP_Context *src, /* Specialized functions */ switch (src->pixel_type) { %% for src in pixeltypes -%% if not src.is_unknown() and not src.is_palette() +%% if not src.is_unknown() and not src.is_palette() case GP_PIXEL_{{ src.name }}: switch (dst->pixel_type) { -%% for dst in pixeltypes -%% if not dst.is_unknown() and not dst.is_palette() -%% if dst.name != src.name +%% for dst in pixeltypes +%% if not dst.is_unknown() and not dst.is_palette() +%% if dst.name != src.name case GP_PIXEL_{{ dst.name }}: blitXYXY_Raw_{{ src.name }}_{{ dst.name }}(src, x0, y0, x1, y1, dst, x2, y2); break; -%% endif -%% endif -%% endfor +%% endif +%% endif +%% endfor default: GP_ABORT("Invalid destination pixel %s", GP_PixelTypeName(dst->pixel_type)); } break; -%% endif +%% endif %% endfor default: GP_ABORT("Invalid source pixel %s", @@ -203,10 +203,10 @@ void GP_BlitXYXY_Raw_Fast(const GP_Context *src, * And the same for non-raw variants. */ %% for src in pixeltypes -%% if not src.is_unknown() and not src.is_palette() -%% for dst in pixeltypes -%% if not dst.is_unknown() and not dst.is_palette() -%% if dst.name != src.name +%% if not src.is_unknown() and not src.is_palette() +%% for dst in pixeltypes +%% if not dst.is_unknown() and not dst.is_palette() +%% if dst.name != src.name /* * Blits {{ src.name }} to {{ dst.name }} */ @@ -231,10 +231,10 @@ static void blitXYXY_{{ src.name }}_{{ dst.name }}(const GP_Context *src, } }
-%% endif -%% endif -%% endfor -%% endif +%% endif +%% endif +%% endfor +%% endif %% endfor
/* @@ -274,28 +274,33 @@ void GP_BlitXYXY_Fast(const GP_Context *src, src, x0, y0, x1, y1, dst, x2, y2); return; } - + + if (GP_ContextRotationEqual(src, dst)) { + GP_BlitXYXY_Raw_Fast(src, x0, y0, x1, y1, dst, x2, y2); + return; + } + /* Specialized functions */ switch (src->pixel_type) { %% for src in pixeltypes -%% if not src.is_unknown() and not src.is_palette() +%% if not src.is_unknown() and not src.is_palette() case GP_PIXEL_{{ src.name }}: switch (dst->pixel_type) { -%% for dst in pixeltypes -%% if not dst.is_unknown() and not dst.is_palette() -%% if dst.name != src.name +%% for dst in pixeltypes +%% if not dst.is_unknown() and not dst.is_palette() +%% if dst.name != src.name case GP_PIXEL_{{ dst.name }}: blitXYXY_{{ src.name }}_{{ dst.name }}(src, x0, y0, x1, y1, dst, x2, y2); break; -%% endif -%% endif -%% endfor +%% endif +%% endif +%% endfor default: GP_ABORT("Invalid destination pixel %s", GP_PixelTypeName(dst->pixel_type)); } break; -%% endif +%% endif %% endfor default: GP_ABORT("Invalid source pixel %s",
-----------------------------------------------------------------------
Summary of changes: demos/bogoman/bogoman.c | 12 ++-- demos/bogoman/bogoman_debug.c | 2 +- demos/bogoman/bogoman_loader.c | 10 +- demos/bogoman/bogoman_map.c | 4 +- demos/bogoman/bogoman_map.h | 4 +- demos/bogoman/bogoman_render.c | 16 ++-- demos/bogoman/bogoman_render.h | 2 +- demos/c_simple/SDL_glue.c | 6 +- demos/c_simple/backend_example.c | 2 +- demos/c_simple/blittest.c | 18 ++-- demos/c_simple/convolution.c | 6 +- demos/c_simple/debug_handler.c | 4 +- demos/c_simple/fileview.c | 24 +++--- demos/c_simple/filters_symmetry.c | 6 +- demos/c_simple/fonttest.c | 24 +++--- demos/c_simple/gfx_koch.c | 14 ++-- demos/c_simple/input_example.c | 10 +- demos/c_simple/koch.c | 32 ++++---- demos/c_simple/linetest.c | 18 ++-- demos/c_simple/loaders.c | 6 +- demos/c_simple/loaders_example.c | 2 +- demos/c_simple/loaders_register.c | 6 +- demos/c_simple/meta_data.c | 2 +- demos/c_simple/meta_data_dump.c | 8 +- demos/c_simple/pretty_print.c | 2 +- demos/c_simple/shapetest.c | 22 +++--- demos/c_simple/showimage.c | 6 +- demos/c_simple/sin_AA.c | 10 +- demos/c_simple/textaligntest.c | 4 +- demos/c_simple/timers.c | 4 +- demos/c_simple/tmp_file.c | 10 +- demos/c_simple/v4l2_grab.c | 12 ++-- demos/c_simple/v4l2_show.c | 16 ++-- demos/c_simple/version.c | 2 +- demos/c_simple/virtual_backend_example.c | 16 ++-- demos/c_simple/weighted_median.c | 6 +- demos/c_simple/x11_windows.c | 12 ++-- demos/grinder/grinder.c | 74 +++++++++--------- demos/grinder/histogram.c | 18 ++-- demos/grinder/params.c | 18 ++-- demos/grinder/params.h | 2 +- demos/particle/particle_demo.c | 10 +- demos/particle/space.c | 28 +++--- demos/particle/space.h | 2 +- demos/py_simple/blit.py | 6 +- demos/py_simple/cam_view.py | 2 +- demos/py_simple/gfx.py | 16 ++-- demos/py_simple/progress_callback.py | 4 +- demos/py_simple/pygtk_example.py | 6 +- demos/py_simple/x11_windows.py | 4 +- demos/spiv/cpu_timer.c | 2 +- demos/spiv/image_actions.c | 8 +- demos/spiv/image_actions.h | 2 +- demos/spiv/image_cache.c | 34 ++++---- demos/spiv/image_cache.h | 4 +- demos/spiv/image_list.c | 36 ++++---- demos/spiv/image_list.h | 6 +- demos/spiv/spiv.c | 128 +++++++++++++++--------------- demos/spiv/spiv_help.c | 10 +- demos/ttf2img/ttf2img.c | 4 +- libs/core/GP_Blit.c | 43 ++-------- libs/core/GP_Blit.gen.c.t | 61 ++++++++------- libs/filters/GP_LinearThreads.c | 6 +- 63 files changed, 437 insertions(+), 457 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.