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 4b617848e0d959af89531911192a376442bc30a1 (commit) via 9d86b8f15fced851b346d6778bf575199671fc92 (commit) via 4d361f3de0eafe0a60d5b96a4051e58e28bf9be0 (commit) via 84c99346779e46b0cc9b86cd0c230002b99d3b7a (commit) via b977a0c7137a1c6725b84ceb4a1514513f6049bb (commit) via 34f2dc55eb9de6087d495cecf94669be47451ead (commit) via 752688c98757d2c59dac433cfdfebc645d9a360c (commit) via 8a5b220d6f33c0d69f32b1d9566c32909667278b (commit) from a75d7240e0224f992b9cb7895af24aeae8409728 (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/4b617848e0d959af89531911192a376442bc3...
commit 4b617848e0d959af89531911192a376442bc30a1 Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 18:35:31 2013 +0200
spiv: Add scrolling to help.
The help page can be scrolled both horizontally and vertically now.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c index 38ae582..701b5ae 100644 --- a/demos/spiv/spiv_help.c +++ b/demos/spiv/spiv_help.c @@ -117,7 +117,7 @@ void print_help(void) }
-void draw_help(GP_Backend *backend) +static int redraw_help(GP_Backend *backend, unsigned int loff, GP_Coord xoff) { GP_Context *c = backend->context; GP_Pixel black = GP_ColorToContextPixel(GP_COL_BLACK, c); @@ -126,12 +126,31 @@ void draw_help(GP_Backend *backend)
GP_Fill(c, black);
- for (i = 0; i < keys_help_len; i++) { - GP_Print(c, NULL, 20, 2 + i * 15, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + for (i = loff; i < keys_help_len; i++) { + GP_Coord h = 2 + (i - loff) * 15; + + 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]); }
+out: GP_BackendFlip(backend); + return i; +} + +static int max_lines(GP_Backend *backend) +{ + return (backend->context->h - 4) / 15; +} + +void draw_help(GP_Backend *backend) +{ + int loff = 0, last, xoff = 0; + + last = redraw_help(backend, loff, xoff);
for (;;) { GP_Event ev; @@ -143,10 +162,52 @@ void draw_help(GP_Backend *backend) continue;
switch (ev.val.key.key) { + case GP_KEY_DOWN: + if (last < keys_help_len) + last = redraw_help(backend, ++loff, xoff); + break; + case GP_KEY_UP: + if (loff > 0) + last = redraw_help(backend, --loff, xoff); + break; + case GP_KEY_LEFT: + last = redraw_help(backend, loff, --xoff); + break; + case GP_KEY_RIGHT: + last = redraw_help(backend, loff, ++xoff); + break; + case GP_KEY_PAGE_DOWN: + if (last < keys_help_len) { + if (loff + max_lines(backend) >= keys_help_len) + break; + + loff += max_lines(backend); + + last = redraw_help(backend, loff, xoff); + } + break; + case GP_KEY_PAGE_UP: + if (loff > 0) { + loff -= max_lines(backend); + if (loff < 0) + loff = 0; + last = redraw_help(backend, loff, xoff); + } + break; default: return; } break; + case GP_EV_SYS: + switch (ev.code) { + case GP_EV_SYS_RESIZE: + GP_BackendResizeAck(backend); + last = redraw_help(backend, loff, xoff); + break; + case GP_EV_SYS_QUIT: + GP_BackendPutEventBack(backend, &ev); + return; + } } } }
http://repo.or.cz/w/gfxprim.git/commit/9d86b8f15fced851b346d6778bf575199671f...
commit 9d86b8f15fced851b346d6778bf575199671fc92 Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 19:14:06 2013 +0200
pywrap: backends: Add PeekEvent and PutEventBack.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/pylib/gfxprim/backends/_extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py index 7ab8d07..efd010f 100644 --- a/pylib/gfxprim/backends/_extend_backend.py +++ b/pylib/gfxprim/backends/_extend_backend.py @@ -59,11 +59,26 @@ def extend_backend(_backend): ev = c_input.GP_Event()
if c_backends.GP_BackendGetEvent(self, ev) != 0: - return ev + return ev
return None
@extend(_backend) + def PeekEvent(self): + "Returns, but not removes, the top of the backend event queue." + ev = c_input.GP_Event() + + if c_backends.GP_BackendPeekEvent(self, ev) != 0: + return ev + + return None + + @extend(_backend) + def PutEventBack(self, ev): + "Puts back event removed from the top of the backend event queue." + c_backends.GP_BackendPutEventBack(self, ev) + + @extend(_backend) def EventsQueued(self): "Returns the number of events queued in the backend event queue." return c_backends.GP_BackendEventsQueued(self)
http://repo.or.cz/w/gfxprim.git/commit/4d361f3de0eafe0a60d5b96a4051e58e28bf9...
commit 4d361f3de0eafe0a60d5b96a4051e58e28bf9be0 Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 19:07:58 2013 +0200
doc: Update backends docs.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/backends.txt b/doc/backends.txt index 481a425..ff8cffb 100644 --- a/doc/backends.txt +++ b/doc/backends.txt @@ -452,6 +452,36 @@ TIP: For more information on events see link:input.html[input events] documentation.
+GP_BackendPeekEvent +^^^^^^^^^^^^^^^^^^^ + +[source,c] +------------------------------------------------------------------------------- +#include <backends/GP_Backend.h> +/* or */ +#include <GP.h> + +int GP_BackendPeekEvent(GP_Backend *self, GP_Event *ev); +------------------------------------------------------------------------------- + +Same as +GP_BackendPeekEvent()+ but the top event is not removed from the +queue. + +GP_BackendPutEventBack +^^^^^^^^^^^^^^^^^^^^^^ + +[source,c] +------------------------------------------------------------------------------- +#include <backends/GP_Backend.h> +/* or */ +#include <GP.h> + +void GP_BackendPutEventBack(GP_Backend *self, GP_Event *ev); +------------------------------------------------------------------------------- + +Puts event to the top of the queue. May be useful for putting back events that +were removed from the queue. + GP_BackendSetCaption ^^^^^^^^^^^^^^^^^^^^
http://repo.or.cz/w/gfxprim.git/commit/84c99346779e46b0cc9b86cd0c230002b99d3...
commit 84c99346779e46b0cc9b86cd0c230002b99d3b7a Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 19:02:53 2013 +0200
doc: Update and fix GP_EventQueue docs.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/event_queue.txt b/doc/event_queue.txt index 7f786bc..5b476bd 100644 --- a/doc/event_queue.txt +++ b/doc/event_queue.txt @@ -54,7 +54,7 @@ failed 'NULL' is returned. /* or */ #include <input/GP_EventQueue.h>
-unsigned int GP_EventsQueueEventsQueued(void); +unsigned int GP_EventsQueueEventsQueued(GP_EventQueue *self); -------------------------------------------------------------------------------
This function returns number of queued events. @@ -65,7 +65,7 @@ This function returns number of queued events. /* or */ #include <input/GP_EventQueue.h>
-int GP_EventQueueGet(struct GP_Event *ev); +int GP_EventQueueGet(GP_EventQueue *self, GP_Event *ev); -------------------------------------------------------------------------------
In case there are any events queued, the top event is removed from the @@ -80,6 +80,29 @@ If there are no events queued the call returns immediately with zero. /* or */ #include <input/GP_EventQueue.h>
+int GP_EventQueuePeek(GP_EventQueue *self, GP_Event *ev); +------------------------------------------------------------------------------- + +Same as +GP_EventQueueGet()+ but the top event is not removed from the queue. + +[source,c] +------------------------------------------------------------------------------- +#include <GP.h> +/* or */ +#include <input/GP_EventQueue.h> + +void GP_EventQueuePutBack(GP_EventQueue *self, GP_Event *ev); +------------------------------------------------------------------------------- + +Puts event to the top of the queue. Useful for putting back event that has +been removed from the queue. + +[source,c] +------------------------------------------------------------------------------- +#include <GP.h> +/* or */ +#include <input/GP_EventQueue.h> + /* * Inject event that moves cursor by rx and ry. *
http://repo.or.cz/w/gfxprim.git/commit/b977a0c7137a1c6725b84ceb4a1514513f604...
commit b977a0c7137a1c6725b84ceb4a1514513f6049bb Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 18:56:09 2013 +0200
input, backends: Add EventPeek and EventPushBack.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/backends/GP_Backend.h b/include/backends/GP_Backend.h index 712f156..792d603 100644 --- a/include/backends/GP_Backend.h +++ b/include/backends/GP_Backend.h @@ -256,4 +256,14 @@ static inline int GP_BackendGetEvent(GP_Backend *self, GP_Event *ev) return GP_EventQueueGet(&self->event_queue, ev); }
+static inline int GP_BackendPeekEvent(GP_Backend *self, GP_Event *ev) +{ + return GP_EventQueuePeek(&self->event_queue, ev); +} + +static inline void GP_BackendPutEventBack(GP_Backend *self, GP_Event *ev) +{ + GP_EventQueuePutBack(&self->event_queue, ev); +} + #endif /* BACKENDS_GP_BACKEND_H */ diff --git a/include/input/GP_EventQueue.h b/include/input/GP_EventQueue.h index 030742a..df25159 100644 --- a/include/input/GP_EventQueue.h +++ b/include/input/GP_EventQueue.h @@ -107,6 +107,11 @@ unsigned int GP_EventQueueEventsQueued(struct GP_EventQueue *self); int GP_EventQueueGet(struct GP_EventQueue *self, struct GP_Event *ev);
/* + * Same as GP_EventQueueGet but the event is not removed from the queue. + */ +int GP_EventQueuePeek(struct GP_EventQueue *self, struct GP_Event *ev); + +/* * Puts the event in the queue. * * This is bare call that just copies the event into the queue. Use the calls @@ -114,6 +119,11 @@ int GP_EventQueueGet(struct GP_EventQueue *self, struct GP_Event *ev); */ void GP_EventQueuePut(struct GP_EventQueue *self, struct GP_Event *ev);
+/* + * Puts event to the top of the queue. + */ +void GP_EventQueuePutBack(struct GP_EventQueue *self, struct GP_Event *ev); + struct timeval;
/* diff --git a/libs/input/GP_EventQueue.c b/libs/input/GP_EventQueue.c index 5cf38c8..a3732f1 100644 --- a/libs/input/GP_EventQueue.c +++ b/libs/input/GP_EventQueue.c @@ -116,6 +116,16 @@ int GP_EventQueueGet(struct GP_EventQueue *self, struct GP_Event *ev) return 1; }
+int GP_EventQueuePeek(struct GP_EventQueue *self, struct GP_Event *ev) +{ + if (self->queue_first == self->queue_last) + return 0; + + *ev = self->events[self->queue_first]; + + return 1; +} + static void event_put(struct GP_EventQueue *self, struct GP_Event *ev) { unsigned int next = (self->queue_last + 1) % self->queue_size; @@ -129,11 +139,34 @@ static void event_put(struct GP_EventQueue *self, struct GP_Event *ev) self->queue_last = next; }
+static void event_put_back(struct GP_EventQueue *self, struct GP_Event *ev) +{ + unsigned int prev; + + if (self->queue_first == 0) + prev = self->queue_last - 1; + else + prev = self->queue_first - 1; + + if (prev == self->queue_last) { + GP_WARN("Event queue full, dropping event."); + return; + } + + self->events[prev] = *ev; + self->queue_first = prev; +} + void GP_EventQueuePut(struct GP_EventQueue *self, struct GP_Event *ev) { event_put(self, ev); }
+void GP_EventQueuePutBack(struct GP_EventQueue *self, struct GP_Event *ev) +{ + event_put_back(self, ev); +} + static void set_time(struct GP_EventQueue *self, struct timeval *time) { if (time == NULL)
http://repo.or.cz/w/gfxprim.git/commit/34f2dc55eb9de6087d495cecf94669be47451...
commit 34f2dc55eb9de6087d495cecf94669be47451ead Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 16:59:23 2013 +0200
spiv: Move help to separate source file.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/spiv/Makefile b/demos/spiv/Makefile index 52ba4ec..10bac03 100644 --- a/demos/spiv/Makefile +++ b/demos/spiv/Makefile @@ -10,7 +10,7 @@ LDLIBS+=$(LDLIBS_LOADERS) $(LDLIBS_BACKENDS)
APPS=spiv
-spiv: cpu_timer.o image_cache.o image_list.o image_actions.o +spiv: cpu_timer.o image_cache.o image_list.o image_actions.o spiv_help.o
include $(TOPDIR)/pre.mk include $(TOPDIR)/app.mk diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 8c77fff..6f48840 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -39,6 +39,7 @@ #include "image_cache.h" #include "image_list.h" #include "image_actions.h" +#include "spiv_help.h" #include "cpu_timer.h"
static GP_Pixel black_pixel; @@ -712,121 +713,13 @@ static void init_caches(struct loader_params *params) // params->img_orig_cache = NULL; }
-static const char *keys_help[] = { - "Keyboard control:", - "", - "Esc, Enter, Q - quit spiv", - "", - "< or KP Minus - zoom out by 1.5", - "> or KP Plus - zoom in by 1.5", - "R - rotate by 90 degrees clockwise", - "Up, Down, Left, Right - move image by 1px", - " (by 10 with Shift)", - "", - "Space - move to the next image", - "BackSpace - move to the prev image", - "PgDown - move to the start of directory", - "PgUp - move to the end of directory", - "Home - move to the first image", - "End - move to the last image", - "", - "I - toggle show info box", - "P - toggle show progress", - "", - "] - change to next resampling method", - "[ - change to prev resampling method", - " (current method is shown in info box)", - "L - toggle low pass filter", - "D - drop image cache", - "H - toggle help", - "", - "F1-F10 - execute action 0 - 9", - "", - "1 - resize spiv window to the image size", - "1 - resize spiv window to the image size", - "2 - resize spiv window to the half of the image size", - "3 - resize spiv window to the third of the image size", - "...", - "9 - resize spiv window to the ninth of the image size", - "", - "Shift 2 - resize spiv window twice of the image size", - "Shift 3 - resize spiv window three times of the image size", - "...", -}; - -static const int keys_help_len = sizeof(keys_help) / sizeof(char*); - -static void print_help(void) -{ - int i; - - printf("Usage: spiv [opts] images or dirs with imagesnn"); - printf(" -I show image info boxn"); - printf(" -P show loading progressn"); - printf(" -f use floyd-steinberg ditheringn"); - printf(" -s sec sleep interval in secondsn"); - 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"); - printf(" -r angle rotate display 90,180 or 270 degreesn"); - printf(" -z moden"); - printf(" -zf zoom is set and modified by usern"); - printf(" -zw zoom is fixed to window size (currently default)n"); - printf(" -b pass backend init string to backend initn"); - printf(" pass -b help for more infon"); - puts("n"); - printf("Actions:nn"); - printf(" -0 'cmd' sets first actionn"); - printf(" -1 'cmd' sets second actionn"); - printf(" ...n"); - printf(" -9 'cmd' sets tenth actionn"); - puts(""); - printf(" actions are shell commands with following modifiers:n"); - printf(" %%f path to current imagen"); - printf(" %%F shell escaped path to current imagen"); - printf(" %%n current image filename without extensionn"); - 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"); - printf("spiv -0 'cp %%F sorted' [images]n"); - printf("tcopies current image into directory 'sorted/' on F1n"); - printf("spiv -e G1 -f [images]n"); - printf("truns spiv in 1-bit bitmap mode and turns on ditheringnn"); - printf("spiv -b 'X11:ROOT_WIN' [images]n"); - 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 void show_help(void) -{ - GP_Context *c = backend->context; - int i; - - GP_Fill(c, black_pixel); - - for (i = 0; i < keys_help_len; i++) { - GP_Print(c, NULL, 20, 2 + i * 15, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, - white_pixel, black_pixel, "%s", keys_help[i]); - } - - GP_BackendFlip(backend); -} - int main(int argc, char *argv[]) { GP_Context *context = NULL; const char *backend_opts = "X11"; int sleep_sec = -1; int opt; - int shift_flag, help_flag = 0; + int shift_flag; GP_PixelType emul_type = GP_PIXEL_UNKNOWN;
struct loader_params params = { @@ -980,13 +873,8 @@ int main(int argc, char *argv[])
switch (ev.val.key.key) { case GP_KEY_H: - if (help_flag) - show_image(¶ms, NULL); - else - show_help(); - - //TODO: remove help_flag on any other action done - help_flag = !help_flag; + draw_help(backend); + show_image(¶ms, NULL); break; case GP_KEY_F: if (GP_BackendIsX11(backend)) diff --git a/demos/spiv/spiv_help.c b/demos/spiv/spiv_help.c new file mode 100644 index 0000000..38ae582 --- /dev/null +++ b/demos/spiv/spiv_help.c @@ -0,0 +1,153 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#include <stdio.h> +#include <GP.h> + +static const char *keys_help[] = { + "Keyboard control:", + "", + "Esc, Enter, Q - quit spiv", + "", + "< or KP Minus - zoom out by 1.5", + "> or KP Plus - zoom in by 1.5", + "R - rotate by 90 degrees clockwise", + "Up, Down, Left, Right - move image by 1px", + " (by 10 with Shift)", + "", + "Space - move to the next image", + "BackSpace - move to the prev image", + "PgDown - move to the start of directory", + "PgUp - move to the end of directory", + "Home - move to the first image", + "End - move to the last image", + "", + "I - toggle show info box", + "P - toggle show progress", + "", + "] - change to next resampling method", + "[ - change to prev resampling method", + " (current method is shown in info box)", + "L - toggle low pass filter", + "D - drop image cache", + "H - toggle help", + "", + "F1-F10 - execute action 0 - 9", + "", + "1 - resize spiv window to the image size", + "1 - resize spiv window to the image size", + "2 - resize spiv window to the half of the image size", + "3 - resize spiv window to the third of the image size", + "...", + "9 - resize spiv window to the ninth of the image size", + "", + "Shift 2 - resize spiv window twice of the image size", + "Shift 3 - resize spiv window three times of the image size", + "...", +}; + +static const int keys_help_len = sizeof(keys_help) / sizeof(char*); + +void print_help(void) +{ + int i; + + printf("Usage: spiv [opts] images or dirs with imagesnn"); + printf(" -I show image info boxn"); + printf(" -P show loading progressn"); + printf(" -f use floyd-steinberg ditheringn"); + printf(" -s sec sleep interval in secondsn"); + 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"); + printf(" -r angle rotate display 90,180 or 270 degreesn"); + printf(" -z moden"); + printf(" -zf zoom is set and modified by usern"); + printf(" -zw zoom is fixed to window size (currently default)n"); + printf(" -b pass backend init string to backend initn"); + printf(" pass -b help for more infon"); + puts("n"); + printf("Actions:nn"); + printf(" -0 'cmd' sets first actionn"); + printf(" -1 'cmd' sets second actionn"); + printf(" ...n"); + printf(" -9 'cmd' sets tenth actionn"); + puts(""); + printf(" actions are shell commands with following modifiers:n"); + printf(" %%f path to current imagen"); + printf(" %%F shell escaped path to current imagen"); + printf(" %%n current image filename without extensionn"); + 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"); + printf("spiv -0 'cp %%F sorted' [images]n"); + printf("tcopies current image into directory 'sorted/' on F1n"); + printf("spiv -e G1 -f [images]n"); + printf("truns spiv in 1-bit bitmap mode and turns on ditheringnn"); + printf("spiv -b 'X11:ROOT_WIN' [images]n"); + 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"); + +} + +void draw_help(GP_Backend *backend) +{ + GP_Context *c = backend->context; + GP_Pixel black = GP_ColorToContextPixel(GP_COL_BLACK, c); + GP_Pixel white = GP_ColorToContextPixel(GP_COL_WHITE, c); + int i; + + GP_Fill(c, black); + + for (i = 0; i < keys_help_len; i++) { + GP_Print(c, NULL, 20, 2 + i * 15, GP_ALIGN_RIGHT|GP_VALIGN_BOTTOM, + white, black, "%s", keys_help[i]); + } + + GP_BackendFlip(backend); + + for (;;) { + GP_Event ev; + + while (GP_BackendWaitEvent(backend, &ev)) { + switch (ev.type) { + case GP_EV_KEY: + if (ev.code != GP_EV_KEY_DOWN) + continue; + + switch (ev.val.key.key) { + default: + return; + } + break; + } + } + } +} diff --git a/demos/spiv/spiv_help.h b/demos/spiv/spiv_help.h new file mode 100644 index 0000000..ed8c6b6 --- /dev/null +++ b/demos/spiv/spiv_help.h @@ -0,0 +1,36 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#ifndef __SPIV_HELP_H__ +#define __SPIV_HELP_H__ + +/* + * Prints help into stderr + */ +void print_help(void); + +/* + * Draws help, waits for keypress. + */ +void draw_help(GP_Backend *backend); + +#endif /* __SPIV_HELP_H__ */
http://repo.or.cz/w/gfxprim.git/commit/752688c98757d2c59dac433cfdfebc645d9a3...
commit 752688c98757d2c59dac433cfdfebc645d9a360c Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 16:15:59 2013 +0200
tests: core: Convert: Remove the gray code.
It's not working and parts of the code causes python errors with floating point vs. int params to hex().
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/core/Convert.gen.c.t b/tests/core/Convert.gen.c.t index cc58162..3c418b0 100644 --- a/tests/core/Convert.gen.c.t +++ b/tests/core/Convert.gen.c.t @@ -102,58 +102,6 @@ static GP_Pixel get_white(GP_PixelType pixel_type) }
/* - * Returns 50% gray color for particular pixel type. - */ -GP_Pixel get_gray(GP_PixelType pixel_type) -{ - switch (pixel_type) { -%% for pt in pixeltypes - case {{ pt.C_enum }}: -%% if pt.is_cmyk() -%% set K = pt.chans['K'] - /* Gray in CMYK modifies K */ - return {{ hex(round(K.max / 2.00)) }}{{ K.C_shift }}; -%% elif pt.is_rgb() -%% set R = pt.chans['R'] -%% set G = pt.chans['G'] -%% set B = pt.chans['B'] -%% if pt.is_alpha() -%% set A = pt.chans['A'] - /* Gray in RGBA */ - return {{ A.C_mask }} | - ({{ hex(round(R.max / 2.00)) }}{{ R.C_shift }}) | - ({{ hex(round(G.max / 2.00)) }}{{ G.C_shift }}) | - ({{ hex(round(B.max / 2.00)) }}{{ B.C_shift }}); -%% else - /* Gray Plain old RGB */ - return ({{ hex(round(R.max / 2.00)) }}{{ R.C_shift }}) | - ({{ hex(round(G.max / 2.00)) }}{{ G.C_shift }}) | - ({{ hex(round(B.max / 2.00)) }}{{ B.C_shift }}); -%% endif -%% elif pt.is_gray() -%% set V = pt.chans['V'] -%% if pt.is_alpha() -%% set A = pt.chans['A'] - /* Gray in Grayscale with Alpha */ - return {{ A.C_mask }} | - ({{ hex(round(V.max / 2.00)) }}{{ V.C_shift }}); -%% else - /* Grayscale */ - return {{ hex(round(V.max / 2.00)) }}{{ V.C_shift }}; -%% endif -%% else - tst_msg("FIXME: Unsupported conversion to %s", - GP_PixelTypeName(pixel_type)); - exit(TST_INTERR); -%% endif -%% endfor - default: - tst_msg("Invalid pixel type %i", pixel_type); - exit(TST_INTERR); - } -} - -/* * Returns red color for particular pixel type. */ static GP_Pixel get_red(GP_PixelType pixel_type) @@ -233,15 +181,6 @@ static int convert_and_check_{{ test_name }}_{{ in_name }}_to_{{ out_name }}(voi {{ gen_convert_and_check('black', pt1.name, 'RGBA8888') }} {{ gen_convert_and_check('black', 'RGB888', pt1.name) }} {{ gen_convert_and_check('black', 'RGBA8888', pt1.name) }} -{#- Grayscale -#} -{# -%% if pt1.name not in ['G1'] -{{ gen_convert_and_check('gray', pt1.name, 'RGB888') }} -{{ gen_convert_and_check('gray', pt1.name, 'RGBA8888') }} -%% endif -{{ gen_convert_and_check('gray', 'RGB888', pt1.name) }} -{{ gen_convert_and_check('gray', 'RGBA8888', pt1.name) }} -#} {#- Red -#} %% if not pt1.is_gray() {{ gen_convert_and_check('red', pt1.name, 'RGB888') }} @@ -277,15 +216,6 @@ const struct tst_suite tst_suite = { {{ gen_suite_entry('black', pt1.name, 'RGBA8888') }} {{ gen_suite_entry('black', 'RGB888', pt1.name) }} {{ gen_suite_entry('black', 'RGBA8888', pt1.name) }} -{#- Gray -#} -{# -%% if pt1.name not in ['G1'] -{{ gen_suite_entry('gray', pt1.name, 'RGB888') }} -{{ gen_suite_entry('gray', pt1.name, 'RGBA8888') }} -%% endif -{{ gen_suite_entry('gray', 'RGB888', pt1.name) }} -{{ gen_suite_entry('gray', 'RGBA8888', pt1.name) }} -#} {#- Red -#} %% if not pt1.is_gray() {{ gen_suite_entry('red', pt1.name, 'RGB888') }}
http://repo.or.cz/w/gfxprim.git/commit/8a5b220d6f33c0d69f32b1d9566c329096672...
commit 8a5b220d6f33c0d69f32b1d9566c32909667278b Author: Cyril Hrubis metan@ucw.cz Date: Sun May 26 16:12:05 2013 +0200
core: Convert: Fix swig syntax error.
Rewrite the code not to include the "/" string which breaks some swig versions with syntax error on input (although the code is correct).
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/core/GP_Convert.gen.h.t b/include/core/GP_Convert.gen.h.t index 6f1c123..22a3795 100644 --- a/include/core/GP_Convert.gen.h.t +++ b/include/core/GP_Convert.gen.h.t @@ -90,8 +90,7 @@ %% endif GP_SET_BITS({{ c2.off }}+o2, {{ c2.size }}, p2, (({{ c2.C_max }} * ({{ K.C_max }} - GP_GET_BITS({{ K.off }}+o1, {{ K.size }}, p1)) * - ({{ V.C_max }} - GP_GET_BITS({{ V.off }}+o1, {{ V.size }}, p1)))) /- ({{ K.C_max }} * {{ V.C_max }})); + ({{ V.C_max }} - GP_GET_BITS({{ V.off }}+o1, {{ V.size }}, p1)))) / ({{ K.C_max }} * {{ V.C_max }})); {# case 7: invalid mapping -#} %% else {{ error('Channel conversion ' + pt1.name + ' to ' + pt2.name + ' not supported.') }}
-----------------------------------------------------------------------
Summary of changes: demos/spiv/Makefile | 2 +- demos/spiv/spiv.c | 120 +------------- demos/spiv/spiv_help.c | 214 ++++++++++++++++++++++++ demos/{c_simple/version.c => spiv/spiv_help.h} | 21 +-- doc/backends.txt | 30 ++++ doc/event_queue.txt | 27 +++- include/backends/GP_Backend.h | 10 + include/core/GP_Convert.gen.h.t | 3 +- include/input/GP_EventQueue.h | 10 + libs/input/GP_EventQueue.c | 33 ++++ pylib/gfxprim/backends/_extend_backend.py | 17 ++- tests/core/Convert.gen.c.t | 70 -------- 12 files changed, 354 insertions(+), 203 deletions(-) create mode 100644 demos/spiv/spiv_help.c copy demos/{c_simple/version.c => spiv/spiv_help.h} (89%)
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.