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 2da60240b7ffcf3d81eb0c303a1f363fc6ea2732 (commit) via 98347287dd3bf06de205a2a06bae93e03199be41 (commit) via e0de31e98f0434cc45f637e966ed321e0d61ac7b (commit) via d2cf8145ef94d2ec28d2bb07d208922c677f6faf (commit) via 6ccbd5621cf6dd2830b9b4671b29daab05a2d993 (commit) via 567dd5699796ee769e5c2972c66e06c8f0bd77b3 (commit) from 5939be1bf4dc36290b9c20a12d743387b992725d (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/2da60240b7ffcf3d81eb0c303a1f363fc6ea2...
commit 2da60240b7ffcf3d81eb0c303a1f363fc6ea2732 Author: Cyril Hrubis metan@ucw.cz Date: Mon Sep 30 00:24:04 2013 +0200
spiv: Key S now can stop and restart slideshow.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index ebee112..4eb4433 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -866,6 +866,16 @@ int main(int argc, char *argv[]) params.show_progress_once = 1; show_image(¶ms); break; + case GP_KEY_S: + if (params.sleep_ms) { + if (GP_BackendTimersInQueue(backend)) { + GP_BackendRemTimer(backend, &timer); + } else { + timer.expires = params.sleep_ms; + GP_BackendAddTimer(backend, &timer); + } + } + break; case GP_KEY_RIGHT_BRACE: params.resampling_method++;
diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index 5455d90..f6abe41 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -43,6 +43,7 @@ static const char *keys_help[] = { "", "I - toggle show info box", "P - toggle show progress", + "S - stop/restart slideshow", "", "] - change to next resampling method", "[ - change to prev resampling method",
http://repo.or.cz/w/gfxprim.git/commit/98347287dd3bf06de205a2a06bae93e03199b...
commit 98347287dd3bf06de205a2a06bae93e03199be41 Author: Cyril Hrubis metan@ucw.cz Date: Mon Sep 30 00:15:49 2013 +0200
backends: Add GP_BackendRemTimer()
Add missing backends wrapper for removing timers from backend timers queue + update backends docs.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt index 1824e2d..d2945d1 100644 --- a/build/syms/Backend_symbols.txt +++ b/build/syms/Backend_symbols.txt @@ -22,6 +22,7 @@ GP_BackendPoll GP_BackendWaitEvent GP_BackendPollEvent GP_BackendAddTimer +GP_BackendRemTimer
GP_InputDriverX11EventPut GP_InputDriverX11Init diff --git a/doc/backends.txt b/doc/backends.txt index 7509d56..197c71e 100644 --- a/doc/backends.txt +++ b/doc/backends.txt @@ -459,6 +459,20 @@ input queue once timer has expired otherwise timer callback is called. TIP: For example usage see backend timers link:example_backend_timers.html[example].
+GP_BackendRemTimer +^^^^^^^^^^^^^^^^^^ + +[source,c] +------------------------------------------------------------------------------- +#include <backends/GP_Backend.h> +/* or */ +#include <GP.h> + +void GP_BackendRemTimer(GP_Backend *self, GP_Timer *timer); +------------------------------------------------------------------------------- + +Removes a link:input.html#Timers[timer] from the backend timer queue. + GP_BackendTimersInQueue ^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h index ec4af3b..e54f3c6 100644 --- a/include/backends/GP_Backend.h +++ b/include/backends/GP_Backend.h @@ -212,6 +212,11 @@ int GP_BackendWaitEvent(GP_Backend *self, GP_Event *ev); void GP_BackendAddTimer(GP_Backend *self, GP_Timer *timer);
/* + * Removes timer from backend timer queue. + */ +void GP_BackendRemTimer(GP_Backend *self, GP_Timer *timer); + +/* * Returns number of timers scheduled in backend. */ static inline unsigned int GP_BackendTimersInQueue(GP_Backend *self) diff --git a/libs/backends/GP_Backend.c b/libs/backends/GP_Backend.c index 9bf2f7e..9af3c63 100644 --- a/libs/backends/GP_Backend.c +++ b/libs/backends/GP_Backend.c @@ -131,6 +131,11 @@ void GP_BackendAddTimer(GP_Backend *self, GP_Timer *timer) GP_TimerQueueInsert(&self->timers, GP_GetTimeStamp(), timer); }
+void GP_BackendRemTimer(GP_Backend *self, GP_Timer *timer) +{ + GP_TimerQueueRemove(&self->timers, timer); +} + void GP_BackendPoll(GP_Backend *self) { self->Poll(self);
http://repo.or.cz/w/gfxprim.git/commit/e0de31e98f0434cc45f637e966ed321e0d61a...
commit e0de31e98f0434cc45f637e966ed321e0d61ac7b Author: Cyril Hrubis metan@ucw.cz Date: Sun Sep 29 23:57:20 2013 +0200
loaders: BMP: Make use of GP_Fill.
As the GP_Fill() is now in core, make use of it.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_BMP_RLE.h b/libs/loaders/GP_BMP_RLE.h index f1ae1f9..6f7645f 100644 --- a/libs/loaders/GP_BMP_RLE.h +++ b/libs/loaders/GP_BMP_RLE.h @@ -26,6 +26,8 @@
*/
+#include "core/GP_Fill.h" + enum RLE_state { RLE_START, /* end of RLE or bitmap was reached */ @@ -261,18 +263,13 @@ static int read_RLE8(FILE *f, struct bitmap_info_header *header,
int cnt = 0;
- uint32_t x, y; - /* * Fill the image with first palette color. * * TODO: Untouched pixels should be treated as * 1 bit transpanrency (in header3+) */ - for (y = 0; y < context->h; y++) { - for (x = 0; x < context->w; x++) - GP_PutPixel_Raw_24BPP(context, x, y, palette[0]); - } + GP_Fill(context, palette[0]);
for (;;) { if ((err = RLE8_next(f, &rle)))
http://repo.or.cz/w/gfxprim.git/commit/d2cf8145ef94d2ec28d2bb07d208922c677f6...
commit d2cf8145ef94d2ec28d2bb07d208922c677f6faf Author: Cyril Hrubis metan@ucw.cz Date: Sun Sep 29 23:56:08 2013 +0200
loaders; BMP_RLE: Whitespace cleanup.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_BMP_RLE.h b/libs/loaders/GP_BMP_RLE.h index 19c30f8..f1ae1f9 100644 --- a/libs/loaders/GP_BMP_RLE.h +++ b/libs/loaders/GP_BMP_RLE.h @@ -75,7 +75,7 @@ static void RLE8_move(struct RLE *rle) { if (!rle->move) return; - + if (++rle->x >= rle->w) { /* wrap around the end of line */ rle->x = 0; @@ -140,7 +140,7 @@ static int RLE8_offset(FILE *f, struct RLE *rle) return EIO;
GP_DEBUG(1, "RLE offset %i %i", x, y); - + if (rle->x + (uint32_t)x >= rle->w || rle->y + (uint32_t)y >= rle->h) { GP_DEBUG(1, "RLE offset out of image, stop"); rle->state = RLE_STOP; @@ -157,7 +157,7 @@ static int RLE8_next_undecoded(FILE *f, struct RLE *rle) GETC(f, rle);
RLE8_move(rle); - + //GP_DEBUG(4, "RLE unencoded %u %u -> %02x", rle->x, rle->y, rle->c);
if (--rle->rep == 0) { @@ -175,7 +175,7 @@ static int RLE8_next_undecoded(FILE *f, struct RLE *rle) static int RLE8_next_repeat(struct RLE *rle) { RLE8_move(rle); - + //GP_DEBUG(4, "RLE repeat %u %u -> %02x", rle->x, rle->y, rle->c);
if (--rle->rep == 0) @@ -228,8 +228,8 @@ static int RLE8_next(FILE *f, struct RLE *rle) for (;;) { switch (rle->state) { case RLE_START: - if ((err = RLE8_start(f, rle))) - return err; + if ((err = RLE8_start(f, rle))) + return err; break; case RLE_REPEAT: return RLE8_next_repeat(rle); @@ -255,7 +255,7 @@ static int read_RLE8(FILE *f, struct bitmap_info_header *header,
if ((err = read_bitmap_palette(f, header, palette))) return err; - + if ((err = seek_pixels_offset(header, f))) return err;
@@ -263,7 +263,7 @@ static int read_RLE8(FILE *f, struct bitmap_info_header *header,
uint32_t x, y;
- /* + /* * Fill the image with first palette color. * * TODO: Untouched pixels should be treated as @@ -291,7 +291,7 @@ static int read_RLE8(FILE *f, struct bitmap_info_header *header, } else { p = palette[idx]; } - + int32_t ry;
if (header->h < 0)
http://repo.or.cz/w/gfxprim.git/commit/6ccbd5621cf6dd2830b9b4671b29daab05a2d...
commit 6ccbd5621cf6dd2830b9b4671b29daab05a2d993 Author: Cyril Hrubis metan@ucw.cz Date: Sun Sep 29 23:25:25 2013 +0200
spiv: Two fixes for the slideshow timer.
The -s parameter takes time in seconds (floating point value).
If the timer kicked in but the previous image is not loaded yet the timer will return immediately and retry after 20 ms.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 8be792a..ebee112 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -50,6 +50,7 @@ static GP_Backend *backend = NULL; /* image loader thread */ static int abort_flag = 0; static int show_progress = 0; +static int loader_running = 0;
enum zoom_type { /* @@ -95,6 +96,9 @@ struct loader_params { /* resampling method */ int resampling_method;
+ /* slideshow sleep */ + int sleep_ms; + /* offset in pixels */ unsigned int zoom_x_offset; unsigned int zoom_y_offset; @@ -512,8 +516,10 @@ static void *image_loader(void *ptr) break; }
- if ((orig_img = load_image(0)) == NULL) + if ((orig_img = load_image(0)) == NULL) { + loader_running = 0; return NULL; + }
params->rat = calc_img_size(params, orig_img->w, orig_img->h, w, h);
@@ -528,14 +534,18 @@ static void *image_loader(void *ptr)
img = load_resized_image(params, w, h);
- if (img == NULL) + if (img == NULL) { + loader_running = 0; return NULL; + }
//image_cache_print(params->img_resized_cache); update: update_display(params, img, orig_img); cpu_timer_stop(&sum_timer);
+ loader_running = 0; + return NULL; }
@@ -558,6 +568,8 @@ static void show_image(struct loader_params *params) /* stop previous loader thread */ stop_loader();
+ loader_running = 1; + ret = pthread_create(&loader_thread, NULL, image_loader, (void*)params);
if (ret) { @@ -639,6 +651,20 @@ static int init_loader(struct loader_params *params, const char **argv) static uint32_t timer_callback(GP_Timer *self) { struct loader_params *params = self->priv; + static int retries = 0; + + /* + * If loader is still running, reschedule after 20ms + * + * If more than two seconds has passed, try load next + */ + if (loader_running && retries < 100) { + printf("Loader still running %imsn", 20 * retries); + retries++; + return 20; + } else { + retries = 0; + }
/* * We need to stop loader first because image loader seek may free @@ -648,14 +674,13 @@ static uint32_t timer_callback(GP_Timer *self) image_loader_seek(IMG_CUR, 1); show_image(params);
- return 0; + return params->sleep_ms; }
int main(int argc, char *argv[]) { GP_Context *context = NULL; const char *backend_opts = "X11"; - int sleep_ms = 0; int opt; int shift_flag; GP_PixelType emul_type = GP_PIXEL_UNKNOWN; @@ -673,6 +698,8 @@ int main(int argc, char *argv[]) .zoom = 1,
.img_resized_cache = NULL, + + .sleep_ms = 0, };
GP_TIMER_DECLARE(timer, 0, 0, "Slideshow", timer_callback, ¶ms); @@ -689,7 +716,7 @@ int main(int argc, char *argv[]) params.use_dithering = 1; break; case 's': - sleep_ms = atoi(optarg); + params.sleep_ms = 1000 * atof(optarg) + 0.5; break; case 'c': params.resampling_method = GP_INTERP_CUBIC_INT; @@ -778,8 +805,8 @@ int main(int argc, char *argv[]) params.show_progress_once = 1; show_image(¶ms);
- if (sleep_ms) { - timer.period = sleep_ms; + if (params.sleep_ms) { + timer.expires = params.sleep_ms; GP_BackendAddTimer(backend, &timer); }
diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index c45de06..5455d90 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -75,7 +75,7 @@ void print_help(void) printf(" -I show image info boxn"); printf(" -P show loading progressn"); printf(" -f use floyd-steinberg ditheringn"); - printf(" -s msec slideshow interval in milisecondsn"); + printf(" -s sec slideshow interval in seconds (floating point value)n"); printf(" -c turns on bicubic resampling (experimental)n"); printf(" -e pixel_type turns on backend type emulationn"); printf(" for example -e G1 sets 1-bit grayscalen");
http://repo.or.cz/w/gfxprim.git/commit/567dd5699796ee769e5c2972c66e06c8f0bd7...
commit 567dd5699796ee769e5c2972c66e06c8f0bd77b3 Author: Cyril Hrubis metan@ucw.cz Date: Sun Sep 29 23:23:22 2013 +0200
core: Move GP_Fill to core.
Sometimes loaders or other parts of the library needs to prefill a context with some pixel value. Now they can use GP_Fill since it has been moved to core (also optimized slightly).
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/build/syms/Core_symbols.txt b/build/syms/Core_symbols.txt index 1235998..4a45203 100644 --- a/build/syms/Core_symbols.txt +++ b/build/syms/Core_symbols.txt @@ -68,6 +68,8 @@ GP_ColorNameToColor GP_ColorToColorName GP_PixelToRGBA8888
+GP_Fill + GP_NrThreads GP_NrThreadsSet GP_ProgressCallbackMP diff --git a/include/gfx/GP_Fill.h b/include/core/GP_Fill.h similarity index 75% copy from include/gfx/GP_Fill.h copy to include/core/GP_Fill.h index 2a8ba8b..4ef179b 100644 --- a/include/gfx/GP_Fill.h +++ b/include/core/GP_Fill.h @@ -16,21 +16,16 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_FILL_H -#define GP_FILL_H - -#include "GP_Rect.h" +#ifndef CORE_GP_FILL_H +#define CORE_GP_FILL_H
-static inline void GP_Fill(GP_Context *context, GP_Pixel pixel) -{ - GP_FillRect_Raw(context, 0, 0, context->w, context->h, pixel); -} +/* + * Fills context with givel pixel value + */ +void GP_Fill(GP_Context *context, GP_Pixel val);
-#endif /* GP_FILL_H */ +#endif /* CORE_GP_FILL_H */ diff --git a/include/gfx/GP_Gfx.h b/include/gfx/GP_Gfx.h index f2a1b77..f0ed470 100644 --- a/include/gfx/GP_Gfx.h +++ b/include/gfx/GP_Gfx.h @@ -19,7 +19,7 @@ * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -36,9 +36,9 @@ #include "core/GP_Context.h" #include "core/GP_GetPutPixel.h" #include "core/GP_WritePixel.h" +#include "core/GP_Fill.h"
/* public drawing API */ -#include "GP_Fill.h" #include "GP_HLine.h" #include "GP_VLine.h" #include "GP_Line.h" diff --git a/include/gfx/GP_Gfx.h b/libs/core/GP_Fill.gen.c.t similarity index 65% copy from include/gfx/GP_Gfx.h copy to libs/core/GP_Fill.gen.c.t index f2a1b77..f2c4b8d 100644 --- a/include/gfx/GP_Gfx.h +++ b/libs/core/GP_Fill.gen.c.t @@ -16,45 +16,52 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-/* - - This is a main header for gfx part. +%% extends 'base.c.t'
- */ +{% block descr %} +Optimized fill functions. +{% endblock descr %}
-#ifndef GP_GFX_H -#define GP_GFX_H +%% block body
-/* basic definitions and structures */ #include "core/GP_Context.h" -#include "core/GP_GetPutPixel.h" #include "core/GP_WritePixel.h" +#include "core/GP_GetPutPixel.h" +#include "core/GP_FnPerBpp.h" +#include "core/GP_Fill.h" + +%% from './WritePixels.t' import optimized_writepixels + +%% for ps in pixelsizes +static void fill_{{ ps.suffix }}(GP_Context *ctx, GP_Pixel val) +{ + unsigned int y; + + for (y = 0; y < ctx->h; y++) { +%% if ps.suffix in optimized_writepixels + void *start = GP_PIXEL_ADDR(ctx, 0, y); +%% if ps.needs_bit_endian() + GP_WritePixels_{{ ps.suffix }}(start, 0, ctx->w, val); +%% else + GP_WritePixels_{{ ps.suffix }}(start, ctx->w, val); +%% endif +%% else + unsigned int x; + + for (x = 0; x < ctx->w; x++) + GP_PutPixel_Raw_{{ ps.suffix }}(ctx, x, y, val); +%% endif + } +} + +%% endfor
-/* public drawing API */ -#include "GP_Fill.h" -#include "GP_HLine.h" -#include "GP_VLine.h" -#include "GP_Line.h" -#include "GP_Rect.h" -#include "GP_Triangle.h" -#include "GP_Tetragon.h" -#include "GP_Circle.h" -#include "GP_CircleSeg.h" -#include "GP_Ellipse.h" -#include "GP_Arc.h" -#include "GP_Polygon.h" - -#include "GP_PutPixelAA.h" -#include "GP_VLineAA.h" -#include "GP_HLineAA.h" -#include "GP_LineAA.h" -#include "GP_RectAA.h" - -#endif /* GP_GFX_H */ +void GP_Fill(GP_Context *ctx, GP_Pixel val) +{ + GP_FN_PER_BPP_CONTEXT(fill, ctx, ctx, val); +} +%% endblock body diff --git a/libs/core/Makefile b/libs/core/Makefile index c392a2b..37e6170 100644 --- a/libs/core/Makefile +++ b/libs/core/Makefile @@ -2,7 +2,7 @@ TOPDIR=../.. include $(TOPDIR)/pre.mk
GENSOURCES=GP_Pixel.gen.c GP_Blit.gen.c GP_Convert.gen.c - GP_GammaCorrection.gen.c + GP_GammaCorrection.gen.c GP_Fill.gen.c
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c)) LIBNAME=core diff --git a/include/gfx/GP_Fill.h b/libs/core/WritePixels.t similarity index 75% rename from include/gfx/GP_Fill.h rename to libs/core/WritePixels.t index 2a8ba8b..ef8ba94 100644 --- a/include/gfx/GP_Fill.h +++ b/libs/core/WritePixels.t @@ -16,21 +16,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#ifndef GP_FILL_H -#define GP_FILL_H - -#include "GP_Rect.h" - -static inline void GP_Fill(GP_Context *context, GP_Pixel pixel) -{ - GP_FillRect_Raw(context, 0, 0, context->w, context->h, pixel); -} - -#endif /* GP_FILL_H */ +{# Explicit list of BPP that have optimized write pixel #} +%% set optimized_writepixels = ['1BPP_LE', '1BPP_BE', + '2BPP_LE', '2BPP_BE', + '4BPP_LE', '4BPP_BE', + '8BPP', + '16BPP', + '24BPP', + '32BPP'] diff --git a/libs/loaders/GP_GIF.c b/libs/loaders/GP_GIF.c index 59df688..688f914 100644 --- a/libs/loaders/GP_GIF.c +++ b/libs/loaders/GP_GIF.c @@ -35,7 +35,7 @@ #include "../../config.h" #include "core/GP_Pixel.h" #include "core/GP_GetPutPixel.gen.h" -#include "gfx/GP_Fill.h" +#include "core/GP_Fill.h" #include "core/GP_Debug.h"
#include "GP_GIF.h"
-----------------------------------------------------------------------
Summary of changes: build/syms/Backend_symbols.txt | 1 + build/syms/Core_symbols.txt | 2 + demos/spiv/spiv.c | 51 ++++++++++++++++--- demos/spiv/spiv_help.c | 3 +- doc/backends.txt | 14 +++++ include/backends/GP_Backend.h | 5 ++ .../bogoman_loader.h => include/core/GP_Fill.h | 13 +++-- include/gfx/GP_Fill.h | 36 ------------- include/gfx/GP_Gfx.h | 4 +- libs/backends/GP_Backend.c | 5 ++ .../GP_Cubic.gen.c.t => core/GP_Fill.gen.c.t} | 54 +++++++++++++------- libs/core/Makefile | 2 +- .../pretty_print.c => libs/core/WritePixels.t | 29 +++-------- libs/loaders/GP_BMP_RLE.h | 27 ++++------ libs/loaders/GP_GIF.c | 2 +- 15 files changed, 140 insertions(+), 108 deletions(-) copy demos/bogoman/bogoman_loader.h => include/core/GP_Fill.h (90%) delete mode 100644 include/gfx/GP_Fill.h copy libs/{filters/GP_Cubic.gen.c.t => core/GP_Fill.gen.c.t} (65%) copy demos/c_simple/pretty_print.c => libs/core/WritePixels.t (81%)
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.