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 4439632f9d4310733582659f9463f979de583b4a (commit) via 0aced3a1a7a5e7031959a0ef904974ed1a06c4a4 (commit) from 5f214b37219110e2e9051b3bfffbbd65498002b7 (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/4439632f9d4310733582659f9463f979de583...
commit 4439632f9d4310733582659f9463f979de583b4a Author: Cyril Hrubis metan@ucw.cz Date: Tue Dec 18 17:05:08 2012 +0100
doc: Add basic docs for templating engine.
diff --git a/doc/Makefile b/doc/Makefile index f72b8c3..cc981fb 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,6 +1,7 @@ SOURCES=general.txt context.txt loaders.txt filters.txt basic_types.txt drawing_api.txt backends.txt gamma.txt grabbers.txt - environment_variables.txt debug.txt core.txt api.txt input.txt + environment_variables.txt debug.txt core.txt api.txt input.txt + gen.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
diff --git a/doc/gen.txt b/doc/gen.txt new file mode 100644 index 0000000..28b438d --- /dev/null +++ b/doc/gen.txt @@ -0,0 +1,103 @@ +Templating Engine +----------------- + +The GFXprim uses python templating engine to generate code for different pixel +types. This is documentation to the engine internals. + +GFXprim Config +~~~~~~~~~~~~~~ + +The configuration which describes pixel layout could be found in root GFXprim +directory under name 'gfxprim_config.py' which is used to create objects +described below. + +Main Objects +~~~~~~~~~~~~ + +Pixel Size +^^^^^^^^^^ + +[source,python] +------------------------------------------------------------------------------- +class PixelSize(object): + self.size = size + + self.suffix = suffix + + self.bit_endian = bit_endian + + def needs_bit_endian(self): + ... + +------------------------------------------------------------------------------- + +The Pixel Size object represents pixel as a continous block of data. + +The 'size' is size in bits and is sometimes called bpp which stands for bits +per pixel. It also contains suffix that is a string used as a suffix for +functions that manipulates with this pixel size. + +The 'bit_endian' determines direction of bits in bitmaps and graymaps (i.e. +most significant bit left or right). It can be either 'BE' or 'LE'. + +Note that different pixels can share the same pixel size as for certain types +of operations the function doesn't depend on actual arrangements of the color +channels in pixel (i.e. Get/Put Pixel, Rotate buffer 90 degrees, etc...). + +TODO: Which bit endian is which? + +TODO: Rename size to bpp? + +Pixel Type +^^^^^^^^^^ + +[source,python] +------------------------------------------------------------------------------- +class PixelType(object): + self.name = name + self.chanslist = chanslist + self.chans = dict() # { chan_name: (offset, size) } + self.pixelsize = pixelsize # bits per pixel + + def is_palette(self): + ... + + def is_unknown(self): + ... + + def is_rgb(self): + ... + + def is_gray(self): + ... + + def is_alpha(self): + ... + +------------------------------------------------------------------------------- + +This object represents pixel type which describes the sizes and arrangements of +channels in a pixel. Note that it carries an instance of pixel size described +above. + +The chanslist is a list of triplets describing individual channels as +[('chan_name', 'bit_offset', 'bit_size') ] where 'chan_name' is usually one of +R, G, B, V (value, used for grayscale), A (opacity). + +Templating language +~~~~~~~~~~~~~~~~~~~ + +GFXprim uses http://jinja.pocoo.org/%5BJinja] templating engine with a few +objects added into the environment. + +Added are python buildins: + +* 'int' +* 'float' +* 'round' +* 'len' + +And most importantly objects generated from the configuration files: + +* 'pixelsizes' list of all pixel size objects +* 'pixeltypes' list of all pixel type objects
http://repo.or.cz/w/gfxprim.git/commit/0aced3a1a7a5e7031959a0ef904974ed1a06c...
commit 0aced3a1a7a5e7031959a0ef904974ed1a06c4a4 Author: Cyril Hrubis metan@ucw.cz Date: Tue Dec 18 15:44:52 2012 +0100
backends: x11: Add fullscreen and disable SHM opts
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c index 79de755..7c3dd20 100644 --- a/demos/spiv/spiv.c +++ b/demos/spiv/spiv.c @@ -339,6 +339,15 @@ GP_Context *load_resized_image(struct loader_params *params, GP_Size w, GP_Size // GP_FilterEdgeSharpening(img, img, 0.2, NULL); cpu_timer_stop(&timer);
+/* + if (params->rat > 1.5) { + cpu_timer_start(&timer, "Sharpening"); + callback.priv = "Sharpening"; + GP_FilterEdgeSharpening(i1, i1, 0.1, &callback); + cpu_timer_stop(&timer); + } +*/ + /* Free low passed context if needed */ GP_ContextFree(res);
@@ -764,6 +773,10 @@ int main(int argc, char *argv[]) continue;
switch (ev.val.key.key) { + case GP_KEY_F: + if (GP_BackendIsX11(backend)) + GP_BackendX11RequestFullscreen(backend, 2); + break; case GP_KEY_I: params.show_info = !params.show_info; diff --git a/include/backends/GP_X11.h b/include/backends/GP_X11.h index 6d10928..a196a31 100644 --- a/include/backends/GP_X11.h +++ b/include/backends/GP_X11.h @@ -26,14 +26,17 @@ #include "GP_Backend.h"
enum GP_BackendX11Flags { - /* - * When set, w and h is ignored and root window is used - */ + /* When set, w and h is ignored and root window is used */ GP_X11_USE_ROOT_WIN = 0x01, - /* - * Create new borderless window above the root window. - */ + + /* Create new borderless window above the root window */ GP_X11_CREATE_ROOT_WIN = 0x02, + + /* Start fullscreen */ + GP_X11_FULLSCREEN = 0x04, + + /* Do not use MIT SHM even if available */ + GP_X11_DISABLE_SHM = 0x08, };
@@ -52,4 +55,18 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y, const char *caption, enum GP_BackendX11Flags flags);
+/* + * Returns non-zero if backend is X11 backend + */ +int GP_BackendIsX11(GP_Backend *self); + +/* + * Changes full screen mode. + * + * 0 = off + * 1 = on + * 2 = toggle + */ +void GP_BackendX11RequestFullscreen(GP_Backend *self, int mode); + #endif /* BACKENDS_GP_X11_H */ diff --git a/libs/backends/GP_BackendInit.c b/libs/backends/GP_BackendInit.c index bef0dba..e9a809c 100644 --- a/libs/backends/GP_BackendInit.c +++ b/libs/backends/GP_BackendInit.c @@ -138,7 +138,10 @@ static void backend_x11_help(FILE *help, const char *err) "ROOT_WIN - starts the backend in the root windown" " (w and h, if set, are ignored)n" "CREATE_ROOT - starts the backend in newly createdn" - " root window (w and h, if set, are ignored)n"); + " root window (w and h, if set, are ignored)n" + "DISABLE_SHM - disable MIT SHM even if availablen" + "FS - start fullscreenn"); + }
static int x11_params_to_flags(const char *param, GP_Size *w, GP_Size *h, @@ -154,6 +157,16 @@ static int x11_params_to_flags(const char *param, GP_Size *w, GP_Size *h, return 0; }
+ if (!strcasecmp(param, "DISABLE_SHM")) { + *flags |= GP_X11_DISABLE_SHM; + return 0; + } + + if (!strcasecmp(param, "FS")) { + *flags |= GP_X11_FULLSCREEN; + return 0; + } + /* * Accepts only string with format "intxint" or "intXint" */ diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c index e543d48..aaa363f 100644 --- a/libs/backends/GP_X11.c +++ b/libs/backends/GP_X11.c @@ -727,6 +727,57 @@ static void create_window(struct x11_priv *x11, int x, int y, XMapWindow(x11->dpy, x11->win); }
+#ifndef _NET_WM_STATE_ADD +# define _NET_WM_STATE_ADD 1 +#endif /* _NET_WM_STATE_ADD */ + +#ifndef _NET_WM_STATE_REMOVE +# define _NET_WM_STATE_REMOVE 0 +#endif /* _NET_WM_STATE_REMOVE */ + +/* Send NETWM message, most modern Window Managers should understand */ +static void request_fullscreen(struct GP_Backend *self, int mode) +{ + struct x11_priv *x11 = GP_BACKEND_PRIV(self); + + if (mode < 0 || mode > 2) { + GP_WARN("Invalid fullscreen mode = %u", mode); + return; + } + + GP_DEBUG(2, "Requesting fullscreen mode = %u", mode); + + Atom wm_state, fullscreen; + + wm_state = XInternAtom(x11->dpy, "_NET_WM_STATE", True); + fullscreen = XInternAtom(x11->dpy, "_NET_WM_STATE_FULLSCREEN", True); + + if (wm_state == None || fullscreen == None) { + GP_WARN("Failed to create _NET_WM_* atoms"); + return; + } + + XEvent ev; + + memset(&ev, 0, sizeof(ev)); + + ev.type = ClientMessage; + ev.xclient.window = x11->win; + ev.xclient.message_type = wm_state; + ev.xclient.format = 32; + ev.xclient.data.l[0] = mode; + ev.xclient.data.l[1] = fullscreen; + ev.xclient.data.l[2] = 0; + ev.xclient.data.l[3] = 1; + + if (!XSendEvent(x11->dpy, XDefaultRootWindow(x11->dpy), False, SubstructureNotifyMask, &ev)) { + GP_WARN("Failed to send _NET_WM_STATE_FULLSCREEN event"); + return; + } + + XFlush(x11->dpy); +} + GP_Backend *GP_BackendX11Init(const char *display, int x, int y, unsigned int w, unsigned int h, const char *caption, @@ -771,10 +822,13 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y, GP_DEBUG(1, "Failed to create window"); goto err1; } - + + if (flags & GP_X11_FULLSCREEN) + request_fullscreen(backend, 1); + backend->context = NULL;
- if (create_shm_ximage(backend, w, h)) + if ((flags & GP_X11_DISABLE_SHM) || create_shm_ximage(backend, w, h)) if (create_ximage(backend, w, h)) goto err1;
@@ -800,6 +854,11 @@ err0: return NULL; }
+void GP_BackendX11RequestFullscreen(GP_Backend *self, int mode) +{ + return request_fullscreen(self, mode); +} + #else
#include "GP_Backend.h" @@ -814,4 +873,11 @@ GP_Backend *GP_BackendX11Init(const char *GP_UNUSED(display), return NULL; }
+void GP_BackendX11RequestFullscreen(GP_Backend *GP_UNUSED(self), int mode); + #endif /* HAVE_LIBX11 */ + +int GP_BackendIsX11(GP_Backend *self) +{ + return !strcmp(self->name, "X11"); +}
-----------------------------------------------------------------------
Summary of changes: demos/spiv/spiv.c | 13 +++++ doc/Makefile | 3 +- doc/gen.txt | 103 ++++++++++++++++++++++++++++++++++++++++ include/backends/GP_X11.h | 29 +++++++++-- libs/backends/GP_BackendInit.c | 15 +++++- libs/backends/GP_X11.c | 70 ++++++++++++++++++++++++++- 6 files changed, 223 insertions(+), 10 deletions(-) create mode 100644 doc/gen.txt
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.