Gfxprim
Threads by month
- ----- 2026 -----
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
December 2012
- 3 participants
- 79 discussions
[repo.or.cz] gfxprim.git branch master updated: 458bf7bf0abdd984b499c4deadc7551232108c5e
by metan 28 Dec '12
by metan 28 Dec '12
28 Dec '12
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 458bf7bf0abdd984b499c4deadc7551232108c5e (commit)
from f1688be3cd5e34c596afc0027b9c07d2cfec4325 (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/458bf7bf0abdd984b499c4deadc755123210…
commit 458bf7bf0abdd984b499c4deadc7551232108c5e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Dec 28 21:40:51 2012 +0100
spiv: Add different zoom modes.
A little hacky support for two more zoom modes.
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index cbb77a0..6059199 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -49,6 +49,24 @@ static GP_Backend *backend = NULL;
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
+ */
+ ZOOM_FIXED_WIN,
+};
+
struct loader_params {
/* current image path */
const char *img_path;
@@ -71,6 +89,14 @@ struct loader_params {
/* resampling method */
int resampling_method;
+ /* offset in pixels */
+ unsigned int zoom_x_offset;
+ unsigned int zoom_y_offset;
+
+ /* zoom */
+ enum zoom_type zoom_type;
+ float zoom;
+
/* caches for loaded images */
struct image_cache *img_resized_cache;
struct image_cache *img_orig_cache;
@@ -108,14 +134,47 @@ static int image_loader_callback(GP_ProgressCallback *self)
return 0;
}
+static GP_Context *load_image(struct loader_params *params, int elevate);
-static float calc_img_size(uint32_t img_w, uint32_t img_h,
+/*
+ * Ask backend to resize window may not be implemented or authorized. If
+ * backend (window) is resized we will get SYS_RESIZE event, see the main event
+ * loop.
+ */
+static void resize_backend(struct loader_params *params, float ratio, int shift_flag)
+{
+ GP_Context *img = load_image(params, 1);
+
+ if (!shift_flag)
+ ratio = 1.00 / ratio;
+
+ unsigned int w = img->w * ratio + 0.5;
+ unsigned int h = img->h * ratio + 0.5;
+
+ GP_BackendResize(backend, w, h);
+}
+
+
+static float calc_img_size(struct loader_params *params,
+ uint32_t img_w, uint32_t img_h,
uint32_t src_w, uint32_t src_h)
{
- float w_rat = 1.00 * src_w / img_w;
- float h_rat = 1.00 * src_h / img_h;
+ float w_rat;
+ float h_rat;
+
+ switch (params->zoom_type) {
+ case ZOOM_FIT:
+ w_rat = 1.00 * src_w / img_w;
+ h_rat = 1.00 * src_h / img_h;
+ return GP_MIN(w_rat, h_rat);
+ case ZOOM_FIXED:
+ return params->zoom;
+ case ZOOM_FIXED_WIN:
+ resize_backend(params, params->zoom, 0);
+ return params->zoom;
+ }
- return GP_MIN(w_rat, h_rat);
+ return 1;
}
static const char *img_name(const char *img_path)
@@ -142,7 +201,7 @@ static void set_caption(const char *path, float rat)
/*
* Loads image
*/
-GP_Context *load_image(struct loader_params *params, int elevate)
+static GP_Context *load_image(struct loader_params *params, int elevate)
{
struct cpu_timer timer;
GP_Context *img, *context = backend->context;
@@ -218,8 +277,20 @@ static void update_display(struct loader_params *params, GP_Context *img)
if (img == NULL)
return;
- uint32_t cx = (context->w - img->w)/2;
- uint32_t cy = (context->h - img->h)/2;
+ int cx = 0;
+ int cy = 0;
+
+ switch (params->zoom_type) {
+ case ZOOM_FIT:
+ cx = (context->w - img->w)/2;
+ cy = (context->h - img->h)/2;
+ break;
+ case ZOOM_FIXED:
+ case ZOOM_FIXED_WIN:
+ cx = params->zoom_x_offset;
+ cy = params->zoom_y_offset;
+ break;
+ }
GP_Context sub_display;
@@ -231,19 +302,27 @@ static void update_display(struct loader_params *params, GP_Context *img)
GP_FilterFloydSteinberg_RGB888(img, &sub_display, NULL);
// GP_FilterHilbertPeano_RGB888(img, &sub_display, NULL);
} else {
- GP_Blit_Raw(img, 0, 0, img->w, img->h, context, cx, cy);
+ 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);
- GP_FillRectXYWH(context, img->w + cx, 0, context->w - img->w - cx, context->h, black_pixel);
- GP_FillRectXYWH(context, 0, img->h + cy, context->w, context->h - img->h - 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);
+
+ int h = context->h - img->h - cy;
+
+ if (h > 0)
+ GP_FillRectXYWH(context, 0, img->h + cy, context->w, h, black_pixel);
set_caption(params->img_path, params->rat);
@@ -394,7 +473,11 @@ static void *image_loader(void *ptr)
if ((img = load_image(params, 0)) == NULL)
return NULL;
- params->rat = calc_img_size(img->w, img->h, w, h);
+ params->rat = calc_img_size(params, img->w, img->h, w, h);
+
+ /* Special case => no need to resize */
+ if (params->rat == 1.0)
+ goto update;
w = img->w;
h = img->h;
@@ -407,8 +490,8 @@ static void *image_loader(void *ptr)
image_cache_print(params->img_resized_cache);
image_cache_print(params->img_orig_cache);
+update:
update_display(params, img);
-
cpu_timer_stop(&sum_timer);
return NULL;
@@ -445,6 +528,24 @@ static void show_image(struct loader_params *params, const char *path)
}
}
+static void zoom_offset_horiz(struct loader_params *params, int size)
+{
+ params->zoom_x_offset += size;
+ show_image(params, NULL);
+}
+
+static void zoom_offset_vert(struct loader_params *params, int size)
+{
+ params->zoom_y_offset += size;
+ show_image(params, NULL);
+}
+
+static void zoom_mul(struct loader_params *params, float mul)
+{
+ params->zoom *= mul;
+ show_image(params, NULL);
+}
+
static void sighandler(int signo)
{
if (backend != NULL)
@@ -560,23 +661,6 @@ static void init_caches(struct loader_params *params)
// params->img_orig_cache = NULL;
}
-/*
- * Ask backend to resize window. Once window is resized we will
- * get SYS_RESIZE event, see the main event loop.
- */
-static void resize_backend(struct loader_params *params, float ratio, int shift_flag)
-{
- GP_Context *img = load_image(params, 1);
-
- if (!shift_flag)
- ratio = 1.00 / ratio;
-
- unsigned int w = img->w * ratio + 0.5;
- unsigned int h = img->h * ratio + 0.5;
-
- GP_BackendResize(backend, w, h);
-}
-
static const char *keys_help[] = {
"Keyboard control:",
"",
@@ -685,11 +769,14 @@ int main(int argc, char *argv[])
.rotate = 0,
.resampling_method = GP_INTERP_LINEAR_LF_INT,
+ .zoom_type = ZOOM_FIT,
+ .zoom = 1,
+
.img_resized_cache = NULL,
.img_orig_cache = NULL,
};
- while ((opt = getopt(argc, argv, "b:cd:e:fhIPs:r:")) != -1) {
+ while ((opt = getopt(argc, argv, "b:cd:e:fhIPs:r:z:")) != -1) {
switch (opt) {
case 'I':
params.show_info = 1;
@@ -735,6 +822,16 @@ int main(int argc, char *argv[])
print_help();
exit(0);
break;
+ case 'z':
+ switch (optarg[0]) {
+ case 'f':
+ params.zoom_type = ZOOM_FIXED;
+ break;
+ case 'w':
+ params.zoom_type = ZOOM_FIXED_WIN;
+ break;
+ }
+ break;
default:
fprintf(stderr, "Invalid paramter '%c'n", opt);
print_help();
@@ -894,15 +991,31 @@ int main(int argc, char *argv[])
break;
next:
case GP_KEY_RIGHT:
+ if (shift_flag) {
+ zoom_offset_horiz(¶ms, 10);
+ break;
+ }
case GP_KEY_UP:
+ if (shift_flag) {
+ zoom_offset_vert(¶ms, -10);
+ break;
+ }
case GP_KEY_SPACE:
params.show_progress_once = 1;
show_image(¶ms, image_list_move(list, 1));
break;
prev:
- case GP_KEY_BACKSPACE:
case GP_KEY_LEFT:
+ if (shift_flag) {
+ zoom_offset_horiz(¶ms, -10);
+ break;
+ }
case GP_KEY_DOWN:
+ if (shift_flag) {
+ zoom_offset_vert(¶ms, 10);
+ break;
+ }
+ case GP_KEY_BACKSPACE:
params.show_progress_once = 1;
show_image(¶ms, image_list_move(list, -1));
break;
@@ -933,6 +1046,12 @@ int main(int argc, char *argv[])
case GP_KEY_9:
resize_backend(¶ms, 9, shift_flag);
break;
+ case GP_KEY_DOT:
+ zoom_mul(¶ms, 1.5);
+ break;
+ case GP_KEY_COMMA:
+ zoom_mul(¶ms, 1/1.5);
+ break;
}
break;
case GP_EV_SYS:
-----------------------------------------------------------------------
Summary of changes:
demos/spiv/spiv.c | 183 +++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 151 insertions(+), 32 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: f1688be3cd5e34c596afc0027b9c07d2cfec4325
by metan 28 Dec '12
by metan 28 Dec '12
28 Dec '12
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 f1688be3cd5e34c596afc0027b9c07d2cfec4325 (commit)
via 4cc70c909eb0e232bee1263f970d3f2262e34d96 (commit)
via 49cc14c142e17b791edbcce2a3b6ad5eef503227 (commit)
via 160879734f14a7aa8f676660fdc1bee7a2b256bb (commit)
from e13f2d1266a1d8fd179ac4c1b7276dbd831b6436 (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/f1688be3cd5e34c596afc0027b9c07d2cfec…
commit f1688be3cd5e34c596afc0027b9c07d2cfec4325
Merge: 4cc70c9 e13f2d1
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Dec 28 11:46:53 2012 +0100
Merge ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/4cc70c909eb0e232bee1263f970d3f2262e3…
commit 4cc70c909eb0e232bee1263f970d3f2262e34d96
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Dec 28 11:46:01 2012 +0100
spiv: Filter out non image files in dir traversal.
diff --git a/demos/spiv/image_list.c b/demos/spiv/image_list.c
index 1376130..fd35669 100644
--- a/demos/spiv/image_list.c
+++ b/demos/spiv/image_list.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <string.h>
+#include <loaders/GP_Loader.h>
#include <core/GP_Debug.h>
#include "image_list.h"
@@ -64,8 +65,10 @@ static int dir_filter(const struct dirent *d)
if (!strcmp(d->d_name, ".."))
return 0;
- //TODO: filter out directories, non-image files?
-
+ //TODO: filter out directories
+
+ if (GP_MatchExtension(d->d_name) == NULL)
+ return 0;
GP_DEBUG(4, "Adding file '%s'", d->d_name);
http://repo.or.cz/w/gfxprim.git/commit/49cc14c142e17b791edbcce2a3b6ad5eef50…
commit 49cc14c142e17b791edbcce2a3b6ad5eef503227
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Dec 28 11:43:11 2012 +0100
loaders: Add function to match loader by filename.
diff --git a/build/syms/Loaders_symbols.txt b/build/syms/Loaders_symbols.txt
index 2de93ed..bce6650 100644
--- a/build/syms/Loaders_symbols.txt
+++ b/build/syms/Loaders_symbols.txt
@@ -53,6 +53,7 @@ GP_SaveTmpFile
GP_LoadTmpFile
GP_MatchSignature
+GP_MatchExtension
GP_LoadImage
GP_SaveImage
GP_LoadMetaData
diff --git a/doc/loaders.txt b/doc/loaders.txt
index aa16606..907a171 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -41,7 +41,7 @@ Image Loader
[source,c]
-------------------------------------------------------------------------------
-#include <loaders/GP_Loaders.h>
+#include <loaders/GP_Loader.h>
/* or */
#include <GP.h>
@@ -66,7 +66,7 @@ stdout.
[source,c]
-------------------------------------------------------------------------------
-#include <loaders/GP_Loaders.h>
+#include <loaders/GP_Loader.h>
/* or */
#include <GP.h>
@@ -164,7 +164,7 @@ link:example_loader_registration.html[example].
[source,c]
-------------------------------------------------------------------------------
-#include <loaders/GP_Loaders.h>
+#include <loaders/GP_Loader.h>
/* or */
#include <GP.h>
@@ -175,6 +175,19 @@ Returns pointer to image loader accordingly to image signature or 'NULL' if no
suitable loader was found. The buf pointer must point to a buffer at least 32
bytes long.
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_Loader.h>
+/* or */
+#include <GP.h>
+
+const GP_Loader *GP_MatchExtension(const char *path)
+-------------------------------------------------------------------------------
+
+Matches loader by the file extension. This function does not check that the
+file exists or that it could be opened it only looks at the extension (i.e.
+string after the dot) and matches it agains known extensions.
+
WARNING: If you attempt to modify the content of the strucutre the behavior is
undefined. Most likely the program will crash.
diff --git a/include/loaders/GP_Loader.h b/include/loaders/GP_Loader.h
index 6730613..f80cf58 100644
--- a/include/loaders/GP_Loader.h
+++ b/include/loaders/GP_Loader.h
@@ -108,6 +108,11 @@ typedef struct GP_Loader {
*/
const GP_Loader *GP_MatchSignature(const void *buf);
+/*
+ * Tries to match loader by extension. Returns NULL if no loader was found.
+ */
+const GP_Loader *GP_MatchExtension(const char *path);
+
void GP_LoaderRegister(GP_Loader *self);
void GP_LoaderUnregister(GP_Loader *self);
diff --git a/libs/loaders/GP_Loader.c b/libs/loaders/GP_Loader.c
index 1d15ec7..fdd2641 100644
--- a/libs/loaders/GP_Loader.c
+++ b/libs/loaders/GP_Loader.c
@@ -248,7 +248,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
ext_load = loader_by_filename(src_path);
- if (ext_load != NULL) {
+ if (ext_load != NULL && ext_load->Load != NULL) {
img = ext_load->Load(src_path, callback);
if (img)
@@ -259,7 +259,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
* Avoid further work if signature was correct but the loader issued
* ENOSYS.
*/
- if (errno == ENOSYS)
+ if (ext_load != NULL && errno == ENOSYS)
return NULL;
sig_load = loader_by_signature(src_path);
@@ -269,7 +269,7 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback)
src_path, ext_load->fmt_name, sig_load->fmt_name);
}
- if (sig_load)
+ if (sig_load && sig_load->Load != NULL)
return sig_load->Load(src_path, callback);
errno = ENOSYS;
@@ -445,3 +445,8 @@ const GP_Loader *GP_MatchSignature(const void *buf)
return NULL;
}
+
+const GP_Loader *GP_MatchExtension(const char *path)
+{
+ return loader_by_filename(path);
+}
http://repo.or.cz/w/gfxprim.git/commit/160879734f14a7aa8f676660fdc1bee7a2b2…
commit 160879734f14a7aa8f676660fdc1bee7a2b256bb
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu Dec 27 11:45:47 2012 +0100
doc: Add more text formatting.
diff --git a/doc/api.txt b/doc/api.txt
index a03d282..7d4898a 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -70,6 +70,8 @@ GFXprim API
Video grabbers interface such as V4L2.
+
+TIP: There is also a nice page with code link:examples.html[examples].
+
GFXprim Internals
-----------------
@@ -78,5 +80,3 @@ GFXprim Internals
Describes structure and basic usage of the templating engine (C code
generator).
+
-
-There is also a nice page with code link:examples.html[examples].
diff --git a/doc/backends.txt b/doc/backends.txt
index 5ee7e78..a4fb226 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -9,7 +9,7 @@ controlling the drawing.
So far there are backends for Linux mmaped frame-buffer, libSDL and X11.
-For example usage see backend link:example_backend.html[example].
+TIP: For example usage see backend link:example_backend.html[example].
Initialization functions
------------------------
diff --git a/doc/core.txt b/doc/core.txt
index 3e20ee2..a59938d 100644
--- a/doc/core.txt
+++ b/doc/core.txt
@@ -86,7 +86,7 @@ bitmap loaders 'errno' is set to 'ECANCELED'.
The callback, if supported, is the last parameter of a function.
-For example usage see progress callback
+TIP: For example usage see progress callback
link:example_loaders_progress_callback.html[example].
Temporary Buffer Allocator
diff --git a/doc/grabbers.txt b/doc/grabbers.txt
index a794847..ce71654 100644
--- a/doc/grabbers.txt
+++ b/doc/grabbers.txt
@@ -8,7 +8,7 @@ There is currently V4L2 driver that implements a grabber.
To link against grabbers use +-lGP_grabbers+ or better
+`gfxprim-config --libs-grabbers`+ in your linker flags.
-For example usage see grabber link:example_v4l2.html[examples].
+TIP: For example usage see grabber link:example_v4l2.html[examples].
Grabber API
~~~~~~~~~~~
diff --git a/doc/input.txt b/doc/input.txt
index 35ff473..f48f24d 100644
--- a/doc/input.txt
+++ b/doc/input.txt
@@ -15,7 +15,7 @@ difference is that events that belongs together are delivered together (the
kernel input API sends one event for each value i.e. x or y coordinate and has
sync event that finalizes the changes in the values).
-For example usage see input events link:example_input.html[example].
+TIP: For example usage see input events link:example_input.html[example].
Event Structure Description
~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/loaders.txt b/doc/loaders.txt
index e12c6f8..aa16606 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -159,7 +159,7 @@ unregister your own loaders by 'GP_LoaderRegister()' and
'GP_LoaderUnregister()'. Once image loader is registered the generic loading
functions could use it to load and save images.
-For example usage see image loader registration
+TIP: For example usage see image loader registration
link:example_loader_registration.html[example].
[source,c]
-----------------------------------------------------------------------
Summary of changes:
build/syms/Loaders_symbols.txt | 1 +
demos/spiv/image_list.c | 7 +++++--
doc/api.txt | 4 ++--
doc/backends.txt | 2 +-
doc/core.txt | 2 +-
doc/grabbers.txt | 2 +-
doc/input.txt | 2 +-
doc/loaders.txt | 21 +++++++++++++++++----
include/loaders/GP_Loader.h | 5 +++++
libs/loaders/GP_Loader.c | 11 ++++++++---
10 files changed, 42 insertions(+), 15 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: e13f2d1266a1d8fd179ac4c1b7276dbd831b6436
by gavento 28 Dec '12
by gavento 28 Dec '12
28 Dec '12
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 e13f2d1266a1d8fd179ac4c1b7276dbd831b6436 (commit)
via 67b0b61db1e6e49583be60eb07807bacc77273f2 (commit)
via 25e233552995b48bf90f7631e075a8e83782b8fa (commit)
via 8cd7aa8c4396771f0e28b1677b571cfff171f1f1 (commit)
via aa090dff3b0c8343388fca5586e73653e9d66c12 (commit)
via 2bdf13f554c7ce4edf977dd73abcf520e145da64 (commit)
from df87777210da0ea03b70f5d8cf138050a5399e05 (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/e13f2d1266a1d8fd179ac4c1b7276dbd831b…
commit e13f2d1266a1d8fd179ac4c1b7276dbd831b6436
Merge: 67b0b61 df87777
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Dec 28 02:15:23 2012 +0100
Merge branch 'master' of ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/67b0b61db1e6e49583be60eb07807bacc772…
commit 67b0b61db1e6e49583be60eb07807bacc77273f2
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Dec 28 02:14:25 2012 +0100
core: pylib: Fix a bug in Context.Convert
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index 366d049..27c32e3 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -79,8 +79,8 @@ def _init(module):
@extend(_context)
def Convert(self, target_type):
"""Converts context to a different pixel type, allocates new context.
- See GP_ContextConvert() for details."""
- return c_core.GP_ContextConvert(self, pixeltype_no(target_type))
+ See GP_ContextConvertAlloc() for details."""
+ return c_core.GP_ContextConvertAlloc(self, pixeltype_no(target_type))
# Manipulation
extend_direct(_context, "PutPixel", c_core.GP_PutPixel,
http://repo.or.cz/w/gfxprim.git/commit/25e233552995b48bf90f7631e075a8e83782…
commit 25e233552995b48bf90f7631e075a8e83782b8fa
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Dec 28 02:13:50 2012 +0100
core: pylib: Extend PixelTypeDescription with __str__
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py
index a4301f5..366d049 100644
--- a/pylib/gfxprim/core/__init__.py
+++ b/pylib/gfxprim/core/__init__.py
@@ -25,6 +25,14 @@ def _init(module):
from ..utils import extend, extend_direct, add_swig_getmethod, add_swig_setmethod
from ..utils import import_members
_context = module['Context']
+ _ptdescr = c_core.GP_PixelTypeDescription
+
+ # String representation
+
+ @extend(_ptdescr, name='__str__')
+ @extend(_ptdescr, name='__repr__')
+ def ptdescr_str(self):
+ return "<PixelTypeDescription %s>" % (self.name, )
# String representation
http://repo.or.cz/w/gfxprim.git/commit/8cd7aa8c4396771f0e28b1677b571cfff171…
commit 8cd7aa8c4396771f0e28b1677b571cfff171f1f1
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Dec 28 02:12:37 2012 +0100
core: pylib: First Context tests and a runner
diff --git a/tests/pylib/runtests.sh b/tests/pylib/runtests.sh
new file mode 100755
index 0000000..a64a8c0
--- /dev/null
+++ b/tests/pylib/runtests.sh
@@ -0,0 +1,2 @@
+cd ../..
+./gp_run.sh nosetests -w tests/pylib/ "$@"
diff --git a/tests/pylib/test_core.py b/tests/pylib/test_core.py
new file mode 100644
index 0000000..2752c64
--- /dev/null
+++ b/tests/pylib/test_core.py
@@ -0,0 +1,68 @@
+
+### Helper imports and decorators
+# TODO: separate (nose plugin?)
+
+from unittest import SkipTest
+
+def alltypes(_filter=None):
+ def decorate(f):
+ def gen():
+ for t in core.PixelTypes[1:]:
+ if (_filter is None) or _filter(t):
+ yield f, t
+ gen.__name__ = f.__name__
+ return gen
+ return decorate
+
+
+### The actual tests
+
+from gfxprim import core
+from gfxprim.core import Context
+
+def test_basic_types_exist():
+ assert core.C.PIXEL_RGB888 > 0
+ assert core.C.PIXEL_RGBA8888 > 0
+ assert core.C.PIXEL_G8 > 0
+
+def test_create_context():
+ c = Context.Create(7, 9, core.C.PIXEL_RGB888)
+ assert c.w == 7
+ assert c.h == 9
+
+
+@alltypes()
+def test_create_context_and_check_sanity(t):
+ "Allocate Context by pixeltype and check basic invariants"
+ c = Context.Create(13, 15, t.type)
+ assert c.w == 13
+ assert c.h == 15
+ assert c._bit_endian == t.bit_endian
+ assert c.bpp == t.size
+ assert c._free_pixels
+
+@alltypes()
+def test_create_by_number(t):
+ "Allocation by pixeltype number"
+ c = Context.Create(3, 5, t)
+
+@alltypes()
+def test_context_convert_from_RGB888(t):
+ "Test conversion from RGB888"
+ if 'P' in t.name:
+ raise SkipTest("Palette conversion os TODO")
+ c = Context.Create(17, 19, core.C.PIXEL_RGB888)
+ # both by number and the pixeltype
+ c2 = c.Convert(t)
+ assert c2.pixel_type == t.type
+ c3 = c.Convert(t.type)
+ assert c3.pixel_type == t.type
+
+@alltypes()
+def test_context_convert_to_RGB888(t):
+ "Test conversion to RGB888"
+ if 'P' in t.name:
+ raise SkipTest("Palette conversion os TODO")
+ c = Context.Create(1, 1, t)
+ c2 = c.Convert(core.C.PIXEL_RGB888)
+ assert c2.pixel_type == core.C.PIXEL_RGB888
http://repo.or.cz/w/gfxprim.git/commit/aa090dff3b0c8343388fca5586e73653e9d6…
commit aa090dff3b0c8343388fca5586e73653e9d66c12
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Fri Dec 28 02:09:11 2012 +0100
Update .gitignore for pylib
diff --git a/.gitignore b/.gitignore
index 7007e36..f6c7e20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,7 @@
config.h
config.gen.mk
gfxprim-config
+pylib/gfxprim/*/*_c.py
+pylib/gfxprim/*/*_wrap.c
+pylib/gfxprim/*/c_*.py
+
http://repo.or.cz/w/gfxprim.git/commit/2bdf13f554c7ce4edf977dd73abcf520e145…
commit 2bdf13f554c7ce4edf977dd73abcf520e145da64
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Thu Dec 27 21:24:06 2012 +0100
Make gp_run.sh (slightly) more robust
diff --git a/gp_run.sh b/gp_run.sh
index 4c76693..e1d60f3 100755
--- a/gp_run.sh
+++ b/gp_run.sh
@@ -2,7 +2,7 @@
# Very simple script to run python, ipython and GP executables
-BDIR=.
+BDIR=`pwd`
export LD_LIBRARY_PATH=$BDIR/build/
export PYTHONPATH=$BDIR/pylib/
-----------------------------------------------------------------------
Summary of changes:
.gitignore | 4 ++
gp_run.sh | 2 +-
pylib/gfxprim/core/__init__.py | 12 ++++++-
tests/pylib/runtests.sh | 2 +
tests/pylib/test_core.py | 68 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 85 insertions(+), 3 deletions(-)
create mode 100755 tests/pylib/runtests.sh
create mode 100644 tests/pylib/test_core.py
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: df87777210da0ea03b70f5d8cf138050a5399e05
by metan 27 Dec '12
by metan 27 Dec '12
27 Dec '12
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 df87777210da0ea03b70f5d8cf138050a5399e05 (commit)
from 57673b3b830b3d6434956c656d0cec95156314cc (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/df87777210da0ea03b70f5d8cf138050a539…
commit df87777210da0ea03b70f5d8cf138050a5399e05
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu Dec 27 01:38:23 2012 +0100
demos: c_simple: Update backend example.
diff --git a/demos/c_simple/backend_example.c b/demos/c_simple/backend_example.c
index 063da75..3d565ef 100644
--- a/demos/c_simple/backend_example.c
+++ b/demos/c_simple/backend_example.c
@@ -71,10 +71,8 @@ int main(int argc, char *argv[])
GP_BackendFlip(backend);
for (;;) {
- if (backend->Poll)
- GP_BackendPoll(backend);
-
- usleep(1000);
+ /* Wait for backend event */
+ GP_BackendWait(backend);
/* Read and parse events */
GP_Event ev;
@@ -85,13 +83,20 @@ int main(int argc, char *argv[])
switch (ev.type) {
case GP_EV_KEY:
- switch (ev.val.key.key) {
+ switch (ev.val.val) {
case GP_KEY_ESC:
case GP_KEY_Q:
GP_BackendExit(backend);
return 0;
break;
}
+ break;
+ case GP_EV_SYS:
+ case GP_EV_SYS_QUIT:
+ GP_BackendExit(backend);
+ return 0;
+ break;
+ break;
}
}
}
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/backend_example.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 57673b3b830b3d6434956c656d0cec95156314cc
by metan 27 Dec '12
by metan 27 Dec '12
27 Dec '12
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 57673b3b830b3d6434956c656d0cec95156314cc (commit)
from 8728ce4ba9c41b1ae214808623111c5c869f31ad (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/57673b3b830b3d6434956c656d0cec951563…
commit 57673b3b830b3d6434956c656d0cec95156314cc
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu Dec 27 01:08:39 2012 +0100
doc: Add word about coordinate system.
diff --git a/doc/Makefile b/doc/Makefile
index 7bda21b..35c23aa 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,7 +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 - gen.txt pixels.txt
+ gen.txt pixels.txt coordinate_system.txt
EXAMPLE_SOURCES=$(wildcard example_*.txt)
diff --git a/doc/api.txt b/doc/api.txt
index 69d460a..a03d282 100644
--- a/doc/api.txt
+++ b/doc/api.txt
@@ -1,12 +1,19 @@
-GFXprim API
-===========
+GFXprim Documentation
+=====================
Cyril Hrubis <metan(a)ucw.cz>
+GFXprim API
+-----------
+
. link:basic_types.html[Basic library types]
+
Describes how colors and pixels are handled also describes progress callback
in great detail.
+
+. link:coordinate_system.html[Coordinate system]
+ +
+ Describes briefly coordinate system and relation to pixels.
+ +
. link:core.html[Library Core overview]
+
Describes functions and macros in library core.
@@ -62,5 +69,14 @@ Cyril Hrubis <metan(a)ucw.cz>
+
Video grabbers interface such as V4L2.
+
-
+
+GFXprim Internals
+-----------------
+
+. link:gen.html[Templating engine]
+ +
+ Describes structure and basic usage of the templating engine (C code
+ generator).
+ +
+
There is also a nice page with code link:examples.html[examples].
diff --git a/doc/basic_types.txt b/doc/basic_types.txt
index 1542083..2d9b342 100644
--- a/doc/basic_types.txt
+++ b/doc/basic_types.txt
@@ -1,7 +1,7 @@
Basic types
-----------
-Coordinates and Size/Length
-~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Coordinates and Size and Length
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Most of the drawing functions use typedefed 'GP_Coord' and 'GP_Size' integer
types for parameters.
diff --git a/doc/coordinate_system.txt b/doc/coordinate_system.txt
new file mode 100644
index 0000000..fb3f408
--- /dev/null
+++ b/doc/coordinate_system.txt
@@ -0,0 +1,11 @@
+Coordinate System
+-----------------
+
+GFXprim uses Cartesian coordinate system. The pixel +(0, 0)+ lies at the upper
+left corner of the bitmap and coordinates grows to the right and to the
+bottom. The last valid pixel, that still lies in the bitmap of size +w+ and
++h+, occupies coordinates +(w - 1, h - 1)+. The precise position of the point
+with integer coordinates is in the middle of the pixel (and borders between
+the pixels lies are integers + 0.5).
+
+image:coordinates-1.svg[Coordinate System]
diff --git a/doc/coordinates-1.svg b/doc/coordinates-1.svg
new file mode 100644
index 0000000..841444d
--- /dev/null
+++ b/doc/coordinates-1.svg
@@ -0,0 +1,176 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ width="546.91302"
+ height="426.914"
+ id="svg2"
+ xml:space="preserve"><metadata
+ id="metadata8"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
+ id="defs6"><clipPath
+ id="clipPath18"><path
+ d="m 0,0 437.5304,0 0,341.5312 L 0,341.5312 0,0 z"
+ inkscape:connector-curvature="0"
+ id="path20" /></clipPath></defs><g
+ transform="matrix(1.25,0,0,-1.25,0,426.914)"
+ id="g10"><g
+ id="g12"><g
+ id="g14"><g
+ clip-path="url(#clipPath18)"
+ id="g16"><g
+ transform="translate(0,341.5312)"
+ id="g22"><g
+ transform="translate(3.5304,-339.5312)"
+ id="g24"><path
+ d="M 0,0 432,0"
+ inkscape:connector-curvature="0"
+ id="path26"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,48 432,0"
+ inkscape:connector-curvature="0"
+ id="path28"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,96 432,0"
+ inkscape:connector-curvature="0"
+ id="path30"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,144 432,0"
+ inkscape:connector-curvature="0"
+ id="path32"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,192 432,0"
+ inkscape:connector-curvature="0"
+ id="path34"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,240 432,0"
+ inkscape:connector-curvature="0"
+ id="path36"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,288 432,0"
+ inkscape:connector-curvature="0"
+ id="path38"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,336 432,0"
+ inkscape:connector-curvature="0"
+ id="path40"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="M 0,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path42"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 48,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path44"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 96,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path46"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 144,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path48"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 192,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path50"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 240,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path52"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 288,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path54"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 336,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path56"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 384,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path58"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 432,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path60"
+ style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="M 0,336 0,0"
+ inkscape:connector-curvature="0"
+ id="path62"
+ style="fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="M -1.5304,3.6946 0,0 l 1.5304,3.6946 -3.0608,0 z"
+ inkscape:connector-curvature="0"
+ id="path64"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="M 0,0 432,0"
+ inkscape:connector-curvature="0"
+ id="path66"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 432,0 0,336"
+ inkscape:connector-curvature="0"
+ id="path68"
+ style="fill:none;stroke:#000000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="m 0,336 432,0"
+ inkscape:connector-curvature="0"
+ id="path70"
+ style="fill:none;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><path
+ d="M 428.30338,334.46877 432,336 l -3.69662,1.53123 0,-3.06246 z"
+ inkscape:connector-curvature="0"
+ id="path72"
+ style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><g
+ transform="translate(0,341.5312)"
+ id="g74"><text
+ transform="matrix(1,0,0,-1,12.1001,-24.0405)"
+ id="text76"><tspan
+ x="0 3.8744552 8.8557549 14.940911 19.922211"
+ y="0"
+ id="tspan78"
+ style="font-size:9.96259975px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:CMR10;-inkscape-font-specification:CMR10">(0,0)</tspan></text>
+<g
+ transform="translate(0,-341.5312)"
+ id="g80"><path
+ d="m 24,312 0,0"
+ inkscape:connector-curvature="0"
+ id="path82"
+ style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><g
+ transform="translate(0,341.5312)"
+ id="g84"><text
+ transform="matrix(1,0,0,-1,386.4142,-312.0405)"
+ id="text86"><tspan
+ x="0 3.8744552 11.069445 14.389979 19.371279 25.456436 30.991655 34.312191 39.293491"
+ y="0"
+ id="tspan88"
+ style="font-size:9.96259975px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:CMR10;-inkscape-font-specification:CMR10">(w-1,h-1)</tspan></text>
+<g
+ transform="translate(0,-341.5312)"
+ id="g90"><path
+ d="m 408,24 0,0"
+ inkscape:connector-curvature="0"
+ id="path92"
+ style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><g
+ transform="translate(0,341.5312)"
+ id="g94"><text
+ transform="matrix(1,0,0,-1,98.1,-120.9405)"
+ id="text96"><tspan
+ x="0 3.8744552 8.8557549 11.623365 16.604666 22.689821 27.671122"
+ y="0"
+ id="tspan98"
+ style="font-size:9.96259975px;font-variant:normal;font-weight:normal;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:CMR10;-inkscape-font-specification:CMR10">(1.5,2)</tspan></text>
+<g
+ transform="translate(0,-341.5312)"
+ id="g100"><path
+ d="m 96,216 0,0"
+ inkscape:connector-curvature="0"
+ id="path102"
+ style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-opacity:1;stroke-dasharray:none" /><g
+ transform="translate(0,341.5312)"
+ id="g104" /></g></g></g></g></g></g></g></g></g></g></g></g></svg>
No newline at end of file
diff --git a/doc/coordinates.mp b/doc/coordinates.mp
new file mode 100644
index 0000000..404ff70
--- /dev/null
+++ b/doc/coordinates.mp
@@ -0,0 +1,40 @@
+%
+% Compile to svg by:
+%
+% mptopdf coordinates.mp; inkscape -l coordinates-1.svg coordinates-1.pdf
+%
+beginfig(1)
+ % Draw grid
+ u := 48;
+ w := 9;
+ h := 7;
+
+ for i=0 upto h:
+ draw (0, i * u) -- (w * u, i * u);
+ endfor
+
+ for i=0 upto w:
+ draw (i * u, 0) -- (i * u, h * u);
+ endfor
+
+ % Draw frame
+ pair A, B, C, D;
+
+ A = (0, 0);
+ B = (w * u, 0);
+ C = (w * u, h * u);
+ D = (0, h * u);
+
+ drawarrow D -- A withpen pencircle scaled 4;
+ draw A -- B withpen pencircle scaled 2;
+ draw B -- C withpen pencircle scaled 2;
+ drawarrow D -- C withpen pencircle scaled 4;
+
+ % Draw labels
+ dotlabel.top(btex (0, 0) etex, (u/2, h * u - u/2));
+ dotlabel.top(btex (w-1, h-1) etex, (w * u - u/2, u/2));
+
+ dotlabel.urt(btex (1.5, 2) etex, (2 * u, h * u - 2 * u - u/2));
+
+endfig;
+end
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt
index 0304138..e2e50db 100644
--- a/doc/drawing_api.txt
+++ b/doc/drawing_api.txt
@@ -1,6 +1,8 @@
Drawing primitives
------------------
+NOTE: You may want to see the link:coordinate_system.html[coordinate system] first.
+
Fill
~~~~
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +-
doc/api.txt | 22 +++++-
doc/basic_types.txt | 4 +-
doc/coordinate_system.txt | 11 +++
doc/coordinates-1.svg | 176 +++++++++++++++++++++++++++++++++++++++++++++
doc/coordinates.mp | 40 ++++++++++
doc/drawing_api.txt | 2 +
7 files changed, 251 insertions(+), 6 deletions(-)
create mode 100644 doc/coordinate_system.txt
create mode 100644 doc/coordinates-1.svg
create mode 100644 doc/coordinates.mp
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 8728ce4ba9c41b1ae214808623111c5c869f31ad
by metan 26 Dec '12
by metan 26 Dec '12
26 Dec '12
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 8728ce4ba9c41b1ae214808623111c5c869f31ad (commit)
via 95609738c5d91412e53a1fadc18ed6200825ce1d (commit)
via 43664f1f57cd6092e77765fa72234cf92d4ad074 (commit)
via 082e5eed64755a0130dafab53ef3b5252ce745e6 (commit)
from 0d714fd8292c2805d3cdc23d89345d41c9f23815 (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/8728ce4ba9c41b1ae214808623111c5c869f…
commit 8728ce4ba9c41b1ae214808623111c5c869f31ad
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 21:12:36 2012 +0100
core: Prepare for correct WritePixels implementation.
* The Write Pixels header is correctly generated now
* C sources are generated for Write Pixels functions
that are not written by hand (currently the body is
empty)
* The Write Pixels for 1BPP, 2BPP and 4BPP are now
all correct and fast (hopefully)
TODO: Generated Write Pixels, tests
diff --git a/include/core/GP_WritePixel.gen.h.t b/include/core/GP_WritePixel.gen.h.t
new file mode 100644
index 0000000..91237bc
--- /dev/null
+++ b/include/core/GP_WritePixel.gen.h.t
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * 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-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+%% extends 'base.h.t'
+
+{% block description %}Write Pixels generated header{% endblock %}
+
+{% block body %}
+
+/*
+ * These functions writes cnt pixels using value val starting at start address
+ * and additionally (for pixel sizes that are not aligned to the whole bytes)
+ * at off offset in the first byte (i.e. byte at the start address).
+ */
+
+%% for ps in pixelsizes
+%% if ps.needs_bit_endian()
+void GP_WritePixels_{{ ps.suffix }}(void *start, uint8_t off,
+ size_t cnt, unsigned int val);
+
+%% else
+void GP_WritePixels_{{ ps.suffix }}(void *start, size_t cnt, unsigned int val);
+
+%% endif
+%% endfor
+
+{% endblock body %}
diff --git a/include/core/GP_WritePixel.h b/include/core/GP_WritePixel.h
index bb79b1f..b5005ec 100644
--- a/include/core/GP_WritePixel.h
+++ b/include/core/GP_WritePixel.h
@@ -26,51 +26,9 @@
#ifndef CORE_GP_WRITEPIXEL_H
#define CORE_GP_WRITEPIXEL_H
+#include <stddef.h>
#include <stdint.h>
-#include <unistd.h>
-/*
- * Writes cnt pixels starting at offset off.
- */
-void GP_WritePixels_1BPP_LE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val);
-
-/*
- * Writes cnt pixels starting at offset off (offset is in pixel sizes not in
- * bits).
- */
-void GP_WritePixels_2BPP_LE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val);
-
-/*
- * Writes cnt pixels starting at offset off (offset is in pixel sizes not in
- * bits i.e. offset could be either 0 or 1).
- */
-void GP_WritePixels_4BPP_LE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val);
-
-/*
- * These calls are not byte aligned, thus need start offset.
- */
-void GP_WritePixels_1BPP_BE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val);
-
-void GP_WritePixels_2BPP_BE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val);
-
-void GP_WritePixels_4BPP_BE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val);
-
-void GP_WritePixels_18BPP_BE(void *start, uint8_t off,
- size_t count, uint32_t value);
-
-void GP_WritePixels_18BPP_LE(void *start, uint8_t off,
- size_t count, uint32_t value);
-
-/* Byte-aligned calls. */
-void GP_WritePixels_8BPP(void *start, size_t count, uint8_t value);
-void GP_WritePixels_16BPP(void *start, size_t count, uint16_t value);
-void GP_WritePixels_24BPP(void *start, size_t count, uint32_t value);
-void GP_WritePixels_32BPP(void *start, size_t count, uint32_t value);
+#include "core/GP_WritePixel.gen.h"
#endif /* CORE_GP_WRITEPIXEL_H */
diff --git a/include/core/Makefile b/include/core/Makefile
index 5606d74..0dac795 100644
--- a/include/core/Makefile
+++ b/include/core/Makefile
@@ -4,7 +4,8 @@ include $(TOPDIR)/pre.mk
GENHEADERS=GP_Convert_Scale.gen.h GP_Pixel.gen.h GP_GetPutPixel.gen.h GP_Convert.gen.h GP_FnPerBpp.gen.h - GP_MixPixels.gen.h GP_GammaCorrection.gen.h GP_GammaPixel.gen.h
+ GP_MixPixels.gen.h GP_GammaCorrection.gen.h GP_GammaPixel.gen.h + GP_WritePixel.gen.h
include $(TOPDIR)/gen.mk
include $(TOPDIR)/post.mk
diff --git a/libs/core/GP_WritePixel.c b/libs/core/GP_WritePixel.c
index a6829b0..916f9ef 100644
--- a/libs/core/GP_WritePixel.c
+++ b/libs/core/GP_WritePixel.c
@@ -30,8 +30,8 @@
static const uint8_t bytes_1BPP[] = {0x00, 0xff};
-void GP_WritePixels_1BPP_LE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val)
+void GP_WritePixels_1BPP_LE(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
{
int len = cnt;
@@ -104,10 +104,84 @@ void GP_WritePixels_1BPP_LE(uint8_t *start, uint8_t off,
}
}
+void GP_WritePixels_1BPP_BE(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
+{
+ int len = cnt;
+
+ /* Write start of the line */
+ switch (off) {
+ case 0:
+ break;
+ case 1:
+ GP_SET_BITS1_ALIGNED(6, 1, start, val);
+
+ if (--len == 0)
+ return;
+ case 2:
+ GP_SET_BITS1_ALIGNED(5, 1, start, val);
+
+ if (--len == 0)
+ return;
+ case 3:
+ GP_SET_BITS1_ALIGNED(4, 1, start, val);
+
+ if (--len == 0)
+ return;
+ case 4:
+ GP_SET_BITS1_ALIGNED(3, 1, start, val);
+
+ if (--len == 0)
+ return;
+ case 5:
+ GP_SET_BITS1_ALIGNED(2, 1, start, val);
+
+ if (--len == 0)
+ return;
+ case 6:
+ GP_SET_BITS1_ALIGNED(1, 1, start, val);
+
+ if (--len == 0)
+ return;
+ case 7:
+ GP_SET_BITS1_ALIGNED(0, 1, start, val);
+
+ if (--len == 0)
+ return;
+
+ start++;
+ break;
+ }
+
+ /* Write as many bytes as possible */
+ memset(start, bytes_1BPP[val & 0x01], len/8);
+
+ start+=len/8;
+
+ /* And the rest */
+ switch (len%8) {
+ case 7:
+ GP_SET_BITS1_ALIGNED(1, 1, start, val);
+ case 6:
+ GP_SET_BITS1_ALIGNED(2, 1, start, val);
+ case 5:
+ GP_SET_BITS1_ALIGNED(3, 1, start, val);
+ case 4:
+ GP_SET_BITS1_ALIGNED(4, 1, start, val);
+ case 3:
+ GP_SET_BITS1_ALIGNED(5, 1, start, val);
+ case 2:
+ GP_SET_BITS1_ALIGNED(6, 1, start, val);
+ case 1:
+ GP_SET_BITS1_ALIGNED(7, 1, start, val);
+ break;
+ }
+}
+
static const uint8_t bytes_2BPP[] = {0x00, 0x55, 0xaa, 0xff};
-void GP_WritePixels_2BPP_LE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val)
+void GP_WritePixels_2BPP_LE(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
{
int len = cnt;
@@ -152,13 +226,59 @@ void GP_WritePixels_2BPP_LE(uint8_t *start, uint8_t off,
}
}
+void GP_WritePixels_2BPP_BE(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
+{
+ int len = cnt;
+
+ /* Write start of the line */
+ switch (off) {
+ case 0:
+ break;
+ case 1:
+ GP_SET_BITS1_ALIGNED(6, 2, start, val);
+
+ if (--len == 0)
+ return;
+ case 2:
+ GP_SET_BITS1_ALIGNED(4, 2, start, val);
+
+ if (--len == 0)
+ return;
+ case 3:
+ GP_SET_BITS1_ALIGNED(2, 2, start, val);
+
+ if (--len == 0)
+ return;
+
+ start++;
+ break;
+ }
+
+ /* Write as many bytes as possible */
+ memset(start, bytes_2BPP[val & 0x03], len/4);
+
+ start+=len/4;
+
+ /* And the rest */
+ switch (len%4) {
+ case 3:
+ GP_SET_BITS1_ALIGNED(0, 2, start, val);
+ case 2:
+ GP_SET_BITS1_ALIGNED(2, 2, start, val);
+ case 1:
+ GP_SET_BITS1_ALIGNED(4, 2, start, val);
+ break;
+ }
+}
+
static const uint8_t bytes_4BPP[] = {
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
};
-void GP_WritePixels_4BPP_LE(uint8_t *start, uint8_t off,
- size_t cnt, uint8_t val)
+void GP_WritePixels_4BPP_LE(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
{
int len = cnt;
@@ -189,116 +309,45 @@ void GP_WritePixels_4BPP_LE(uint8_t *start, uint8_t off,
}
}
-static const uint8_t chunks_1bpp[8] = {
- 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe,
-};
-
-void GP_WritePixels_1BPP_BE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val)
-{
- uint8_t s_off = off % 8;
- uint8_t e_off = (cnt + s_off) % 8;
- uint32_t len = (cnt + s_off) / 8;
- uint8_t col = val ? 0xff : 0x00;
-
- /* handle special cases */
- if (cnt < 8) {
- uint8_t u_chunk = chunks_1bpp[cnt] >> off;
- uint8_t l_chunk = chunks_1bpp[cnt] << (8 - off);
-
- if (val) {
- start[0] |= u_chunk;
- start[1] |= l_chunk;
- } else {
- start[0] &= ~u_chunk;
- start[1] &= ~l_chunk;
- }
-
- return;
- }
-
- /* write len - 2 bytes */
- if (len > 1)
- GP_WritePixels_8BPP(start + 1, len - 2, col);
-
- /* deal with the start and end */
- if (val) {
- start[0] |= ~chunks_1bpp[s_off];
- start[len] |= chunks_1bpp[e_off];
- } else {
- start[0] &= chunks_1bpp[s_off];
- start[len] &= ~chunks_1bpp[e_off];
- }
-}
-
-static const uint8_t colors_2bpp[4] = {
- 0x00, 0x55, 0xaa, 0xff
-};
-
-#define PUT_PIXEL_2BPP(p, off, pix) *(p) = (*(p) & ~(0xc0>>(off))) | (pix<<(6 - off))
-
-void GP_WritePixels_2BPP_BE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val)
+void GP_WritePixels_4BPP_BE(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
{
- uint8_t s_off = off % 4;
- uint8_t e_off = 2 * ((cnt + s_off) % 4);
- uint8_t len = (cnt + s_off) / 4;
-
- s_off *= 2;
- val %= 4;
-
- /* handle special cases */
- if (cnt < 4) {
- uint8_t len = s_off + 2*cnt;
- uint8_t max = GP_MIN(s_off + 2*cnt, 8u);
+ int len = cnt;
- for (off = s_off; off < max; off+=2)
- PUT_PIXEL_2BPP(start, off, val);
+ /* Write start of the line */
+ switch (off) {
+ case 0:
+ break;
+ case 1:
+ GP_SET_BITS1_ALIGNED(0, 4, start, val);
- if (len <= 8)
+ if (--len == 0)
return;
- for (off = 0; off < len%8; off+=2)
- PUT_PIXEL_2BPP(start+1, off, val);
-
- return;
+ start++;
+ break;
}
- /* write len - 2 bytes */
- if (len > 1)
- GP_WritePixels_8BPP(start + 1, len - 2, colors_2bpp[val]);
-
- /* handle start and end */
- start[0] = (start[0] & (0xff << (8 - s_off))) |
- (colors_2bpp[val] >> s_off);
-
- start[len] = (start[len] & (0xff >> e_off)) |
- (colors_2bpp[val] << (8 - e_off));
-}
-
-
-void GP_WritePixels_4BPP_BE(uint8_t *start, uint8_t off, size_t cnt, uint8_t val)
-{
- uint8_t s_off = off % 2;
- uint8_t e_off = (cnt + s_off) % 2;
- uint32_t len = (cnt - s_off - e_off) / 2;
-
- val %= 16;
- uint8_t col = (val << 4)& val;
+ /* Write as many bytes as possible */
+ memset(start, bytes_4BPP[val & 0x0f], len/2);
- if (len > 0)
- GP_WritePixels_8BPP(start + s_off, len, val);
+ start+=len/2;
- /* handle start and end */
- if (s_off) GP_SET_BITS(4, 4, start[0], col);
- if (e_off) GP_SET_BITS(0, 4, start[len+s_off], val);
+ /* And the rest */
+ switch (len%2) {
+ case 1:
+ GP_SET_BITS1_ALIGNED(4, 4, start, val);
+ break;
+ }
}
-void GP_WritePixels_8BPP(void *start, size_t count, uint8_t value)
+void GP_WritePixels_8BPP(void *start, size_t count, unsigned int value)
{
memset(start, value, count);
}
-void GP_WritePixels_16BPP(void *start, size_t count, uint16_t value)
+void GP_WritePixels_16BPP(void *start, size_t count, unsigned int value)
{
uint16_t *p = (uint16_t *) start;
size_t i;
@@ -323,17 +372,7 @@ void GP_WritePixels_16BPP(void *start, size_t count, uint16_t value)
}
}
-void GP_WritePixels_18BPP_LE(void *start, uint8_t off, size_t count, uint32_t value)
-{
- #warning TODO
-}
-
-void GP_WritePixels_18BPP_BE(void *start, uint8_t off, size_t count, uint32_t value)
-{
- #warning TODO
-}
-
-void GP_WritePixels_24BPP(void *start, size_t count, uint32_t value)
+void GP_WritePixels_24BPP(void *start, size_t count, unsigned int value)
{
uint8_t *bytep = (uint8_t *) start;
@@ -453,7 +492,7 @@ void GP_WritePixels_24BPP(void *start, size_t count, uint32_t value)
}
}
-void GP_WritePixels_32BPP(void *start, size_t count, uint32_t value)
+void GP_WritePixels_32BPP(void *start, size_t count, unsigned int value)
{
/*
* Inspired by GNU libc's wmemset() (by Ulrich Drepper, licensed under LGPL).
diff --git a/libs/core/GP_WritePixel.gen.c.t b/libs/core/GP_WritePixel.gen.c.t
new file mode 100644
index 0000000..2bc89b3
--- /dev/null
+++ b/libs/core/GP_WritePixel.gen.c.t
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * 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-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+%% extends 'base.h.t'
+
+{% block description %}Write pixel{% endblock %}
+
+{% block body %}
+
+#include "core/GP_GetSetBits.h"
+#include "core/GP_GetPutPixel.h"
+#include "core/GP_WritePixel.gen.h"
+
+{# Some pixel types has hand written optimized functions #}
+%% set hand_optimized = ['1BPP_LE', '1BPP_BE',
+ '2BPP_LE', '2BPP_BE',
+ '4BPP_LE', '4BPP_BE',
+ '8BPP', '16BPP',
+ '24BPP', '32BPP']
+
+%% for ps in pixelsizes
+%% if ps.suffix not in hand_optimized
+%% if ps.needs_bit_endian()
+void GP_WritePixels_{{ ps.suffix }}(void *start, uint8_t off,
+ size_t cnt, unsigned int val)
+{
+ //TODO:
+}
+%% else
+void GP_WritePixels_{{ ps.suffix }}(void *start, size_t cnt, unsigned int val)
+{
+ //TODO:
+}
+%% endif
+
+%% endif
+%% endfor
+
+{% endblock body %}
diff --git a/libs/core/Makefile b/libs/core/Makefile
index cd08e30..46a46d3 100644
--- a/libs/core/Makefile
+++ b/libs/core/Makefile
@@ -2,7 +2,8 @@ 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_WritePixel.gen.c
+
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
LIBNAME=core
http://repo.or.cz/w/gfxprim.git/commit/95609738c5d91412e53a1fadc18ed6200825…
commit 95609738c5d91412e53a1fadc18ed6200825ce1d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 21:02:59 2012 +0100
doc: gen: Add quick jinja2 help.
diff --git a/doc/gen.txt b/doc/gen.txt
index 73e9e15..830a0d4 100644
--- a/doc/gen.txt
+++ b/doc/gen.txt
@@ -210,3 +210,27 @@ And most importantly objects generated from the configuration files:
* 'pixelsizes' list of all pixel size objects
* 'pixeltypes' list of all pixel type objects
+
+Quick Syntax Help
+^^^^^^^^^^^^^^^^^
+
+Jinja2 basics:
+
+- Each written line is reproduces as it is unless it contains template
+ 'variable' or 'expression'
+
+- 'Variable' is text enclosed between +{{+ and +}}+
+ * +{{ ps.size }}' or +{{ ps.suffix }}+
+ * +{{ 2 ** i }}+
+ * +{{ int(2 ** (7 - i)) }} >> {{ 8 - i }}+
+
+- 'Expression' is either line that starts with +%%+ or a text enclosed between
+ +{%+ and +%}+
+ * +%% for ps in pixel_size+
+ * +%% endfor+
+ * +{% if ps.needs_bit_endian() %} ... {% endif %}+
+
+- Comments are enclosed in +{#+ and +#}+
+
+More complete documentation could be found in
+http://jinja.pocoo.org/docs/templates/[Jinja official documentation]
http://repo.or.cz/w/gfxprim.git/commit/43664f1f57cd6092e77765fa72234cf92d4a…
commit 43664f1f57cd6092e77765fa72234cf92d4ad074
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 20:20:59 2012 +0100
doc: gen: Add needs_bit_endian() function.
diff --git a/doc/gen.txt b/doc/gen.txt
index 1cdf906..73e9e15 100644
--- a/doc/gen.txt
+++ b/doc/gen.txt
@@ -25,7 +25,11 @@ class PixelSize(object):
self.suffix = suffix
self.bit_endian = bit_endian
- ...
+
+ def needs_bit_endian(self):
+ ...
+
+ ...
-------------------------------------------------------------------------------
@@ -41,10 +45,13 @@ The 'bit_endian' determines the ordering of pixel bits within a byte in bitmaps
and graymaps. This is significant in pixel types with pixel boundaries
within a byte, i.e. 1 bpp, 4 bpp or 17 bpp.
-It can be either 'BE' or 'LE' (i.e. most significant bit left or right in the bitmap).
-Usually, the bitmap is ordered with left bits earlier in the memory, but the
-earlier/later relationship is important.
-This is defined in terms of natural pixel ordering within the memory.
+The function 'needs_bit_endian()' returns true for pixel sizes that are not
+aligned to the whole bytes.
+
+The bit endian can be either 'BE' or 'LE' (i.e. most significant bit left or
+right in the bitmap). Usually, the bitmap is ordered with left bits earlier
+in the memory, but the earlier/later relationship is important. This is
+defined in terms of natural pixel ordering within the memory.
'BE' means that the earlier (usually left-most) pixels use the higher ("big")
bits of the byte. I.e. in 1 bpp, the first pixel would have value 128, the second 64
http://repo.or.cz/w/gfxprim.git/commit/082e5eed64755a0130dafab53ef3b5252ce7…
commit 082e5eed64755a0130dafab53ef3b5252ce745e6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 19:18:40 2012 +0100
core: GP_Common: Reimplement the abort message.
Move the abort message code from the header to
the C source.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile
index cce46d8..cb6fe82 100644
--- a/demos/c_simple/Makefile
+++ b/demos/c_simple/Makefile
@@ -18,7 +18,7 @@ APPS=backend_example loaders_example loaders filters_symmetry gfx_koch virtual_backend_example meta_data meta_data_dump tmp_file showimage v4l2_show v4l2_grab convolution weighted_median shapetest koch input_example fileview linetest randomshapetest fonttest- loaders_register blittest textaligntest
+ loaders_register blittest textaligntest abort
ifeq ($(HAVE_LIBSDL),yes)
APPS+=SDL_glue
diff --git a/demos/c_simple/abort.c b/demos/c_simple/abort.c
new file mode 100644
index 0000000..d9c3e18
--- /dev/null
+++ b/demos/c_simple/abort.c
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * 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-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include <GP.h>
+
+int main(void)
+{
+ GP_Context *ctx;
+
+ /* this call causes library to abort because of invalid parameters */
+ ctx = GP_ContextAlloc(0, 0, -1);
+
+ return 0;
+}
diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h
index 1140e76..1352c76 100644
--- a/include/core/GP_Common.h
+++ b/include/core/GP_Common.h
@@ -100,29 +100,19 @@
* GP_GENERAL_CHECK is a check with specified message prefix
* (for assert and check)
*/
+#define GP_INTERNAL_ABORT(...) do { + GP_PrintAbortInfo(__FILE__, __FUNCTION__, __LINE__, __VA_ARGS__); + abort(); +} while (0)
/*
* Print as much trace info as possible. Currently, the (C) call stack and
* the Python stack if a Python interpreter is set up. In case more wrappers
* are written, it should print a trace for the currently active.
*/
-void GP_PrintAbortInfo(void);
-
-#define GP_INTERNAL_ABORT_BUFSIZE 1024
-#define GP_INTERNAL_ABORT(str_abort_msg_, ...) do { - char bufstart[GP_INTERNAL_ABORT_BUFSIZE], *buf = bufstart; - char *bufend = buf + GP_INTERNAL_ABORT_BUFSIZE; - buf += snprintf(buf, bufend - buf, "*** gfxprim: %s:%d: in %s: %s", - __FILE__, __LINE__, __FUNCTION__, str_abort_msg_); - if (buf > bufend) buf = bufend; - if (! (#__VA_ARGS__ [0])) - buf += snprintf(buf, bufend - buf, "abort()"); - else - buf += snprintf(buf, bufend - buf, " " __VA_ARGS__); - fprintf(stderr, "%sn", bufstart); - GP_PrintAbortInfo(); - abort(); -} while (0)
+void GP_PrintAbortInfo(const char *file, const char *function, unsigned int line,
+ const char *msg, const char *fmt, ...)
+ __attribute__ ((format (printf, 5, 6)));
#define GP_GENERAL_CHECK(check_cond_, check_message_, ...) do { if (unlikely(!(check_cond_))) { @@ -138,10 +128,11 @@ void GP_PrintAbortInfo(void);
* Aborts and prints the message along with the location in code
* to stderr. Used for fatal errors.
*
- * Use as either GP_ABORT(), GP_ABORT(msg) or GP_ABORT(format, params...) where
+ * Use as either GP_ABORT(msg) or GP_ABORT(format, params...) where
* msg and format must be string constants.
*/
-#define GP_ABORT(...) GP_INTERNAL_ABORT("", ##__VA_ARGS__)
+#define GP_ABORT(...) + GP_INTERNAL_ABORT("n", __VA_ARGS__)
/*
* Checks the condition and aborts immediately if it is not satisfied,
@@ -153,7 +144,7 @@ void GP_PrintAbortInfo(void);
* constants.
*/
#define GP_ASSERT(check_cond_, ...) - GP_GENERAL_CHECK(check_cond_, "assertion failed: ", ##__VA_ARGS__);
+ GP_GENERAL_CHECK(check_cond_, "assertion failed: ", ##__VA_ARGS__)
/*
* Perform a runtime check, on failure abort and print a message.
@@ -164,6 +155,6 @@ void GP_PrintAbortInfo(void);
* constants.
*/
#define GP_CHECK(check_cond_, ...) - GP_GENERAL_CHECK(check_cond_, "check failed: ", ##__VA_ARGS__);
+ GP_GENERAL_CHECK(check_cond_, "check failed: ", ##__VA_ARGS__)
#endif /* CORE_GP_COMMON_H */
diff --git a/libs/core/GP_Common.c b/libs/core/GP_Common.c
index ae1365e..1d608ff 100644
--- a/libs/core/GP_Common.c
+++ b/libs/core/GP_Common.c
@@ -26,6 +26,7 @@
#include "../config.h"
#include <stdio.h>
+#include <stdarg.h>
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
@@ -70,9 +71,20 @@ static void print_python_stack(void)
#endif /* HAVE_DL */
}
-void GP_PrintAbortInfo(void)
+void GP_PrintAbortInfo(const char *file, const char *func, unsigned int line,
+ const char *msg, const char *fmt, ...)
{
+ va_list va;
+
+ fprintf(stderr, "*** gfxprim: %s:%d: in %s: %sn",
+ file, line, func, msg);
+
+ va_start(va, fmt);
+ vfprintf(stderr, fmt, va);
+ va_end(va);
+
+ fprintf(stderr, "n");
+
print_python_stack();
print_c_stack();
}
-
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/Makefile | 2 +-
.../GP_Grabbers.h => demos/c_simple/abort.c | 14 +-
doc/gen.txt | 41 +++-
include/core/GP_Common.h | 33 +--
.../core/GP_WritePixel.gen.h.t | 24 +-
include/core/GP_WritePixel.h | 46 +----
include/core/Makefile | 3 +-
libs/core/GP_Common.c | 16 +-
libs/core/GP_WritePixel.c | 263 +++++++++++---------
.../GP_WritePixel.gen.c.t} | 30 ++-
libs/core/Makefile | 3 +-
11 files changed, 264 insertions(+), 211 deletions(-)
copy include/grabbers/GP_Grabbers.h => demos/c_simple/abort.c (90%)
copy libs/gfx/GP_VLine.gen.c.t => include/core/GP_WritePixel.gen.h.t (76%)
copy libs/{gfx/GP_VLine.gen.c.t => core/GP_WritePixel.gen.c.t} (71%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 0d714fd8292c2805d3cdc23d89345d41c9f23815
by metan 26 Dec '12
by metan 26 Dec '12
26 Dec '12
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 0d714fd8292c2805d3cdc23d89345d41c9f23815 (commit)
from 65cea9aefed176553293e6d5b18ad5eb24b9b704 (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/0d714fd8292c2805d3cdc23d89345d41c9f2…
commit 0d714fd8292c2805d3cdc23d89345d41c9f23815
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 17:15:04 2012 +0100
build: Fix the parallel build.
diff --git a/Makefile b/Makefile
index 7c5480f..3da6589 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,10 @@
TOPDIR=.
+
+include $(TOPDIR)/pre.mk
+
+TOP_MAKE=1
+
SUBDIRS=include libs tests pylib demos build
-include post.mk
libs: include
build: libs
@@ -30,3 +34,5 @@ endif
tar:
$(MAKE) clean
cd .. && tar cf gfxprim-`date +%Y-%b-%d-%HH%MM`.tar gfxprim
+
+include $(TOPDIR)/post.mk
diff --git a/app.mk b/app.mk
index c5aef12..77bd5e7 100644
--- a/app.mk
+++ b/app.mk
@@ -7,6 +7,6 @@ CLEAN+=$(APPS)
ifdef VERBOSE
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $^ $(LDLIBS) -Wl,--end-group -o $@
else
- @echo "LD $@"
+ @echo "LD $@"
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,--start-group $^ $(LDLIBS) -Wl,--end-group -o $@
endif
diff --git a/build/Makefile b/build/Makefile
index 59afb71..2c1aa01 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -12,38 +12,32 @@ clean:
ifdef VERBOSE
rm -rf libGP.a libGP.so libGP.so.0 .lock
else
- @echo "RM libGP.a libGP.so libGP.so.0 .lock"
+ @echo "RM libGP.a libGP.so libGP.so.0 .lock"
@rm -rf libGP.a libGP.so libGP.so.0 .lock
endif
libGP.a:
- @. ./liblock.sh; spinlock .
ifdef VERBOSE
$(AR) rcs libGP.a $(LIB_OBJECTS)
else
- @echo "AR libGP.a"
+ @echo "AR libGP.a"
@$(AR) rcs libGP.a $(LIB_OBJECTS)
endif
- @. ./liblock.sh; spinunlock .
libGP.so:
- @. ./liblock.sh; spinlock .
ifdef VERBOSE
$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,libGP.so.0 $(LIB_OBJECTS) -o libGP.so
else
- @echo "LD libGP.so"
+ @echo "LD libGP.so"
@$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,libGP.so.0 $(LIB_OBJECTS) -o libGP.so
endif
- @. ./liblock.sh; spinunlock .
libGP.so.0: libGP.so
- @. ./liblock.sh; spinlock .
ifdef VERBOSE
rm -f libGP.so.0
ln -s libGP.so libGP.so.0
else
- @echo "LN libGP.so.0"
+ @echo "LN libGP.so.0"
@rm -f libGP.so.0
@ln -s libGP.so libGP.so.0
endif
- @. ./liblock.sh; spinunlock .
diff --git a/build/liblock.sh b/build/liblock.sh
deleted file mode 100644
index 2af11e4..0000000
--- a/build/liblock.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Takes directory as parameter
-#
-spinlock()
-{
- I=0
- #echo -n "Trying to acquire lock in '$1' ."
- while ! `mkdir "$1/.lock" &> /dev/null`; do
- sleep 1;
- ((I=I+1))
- echo $I
- if [ $I -gt 10 ]; then
- echo "Failed to acquire lock '`pwd`/.lock'"
- exit 1
- fi
- # echo -n .
- done
- #echo " done"
-}
-
-spinunlock()
-{
- #echo "Removing lock in '$1'"
- rmdir "$1/.lock" &> /dev/null
-}
diff --git a/lib.mk b/lib.mk
index d9a6f0b..98a7e5a 100644
--- a/lib.mk
+++ b/lib.mk
@@ -29,7 +29,7 @@ ifdef VERBOSE
else
@rm -f $(LIBP)$(LIB).so.0
@cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
- @echo "LD $@"
+ @echo "LD $@"
@$(CC) -fPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
endif
@@ -37,7 +37,7 @@ $(LIBP)$(LIB).a: $(OBJS)
ifdef VERBOSE
$(AR) rcs $@ $(OBJECTS)
else
- @echo "AR $@"
+ @echo "AR $@"
@$(AR) rcs $@ $(OBJECTS)
endif
@@ -45,7 +45,7 @@ else
# BUILDLIB = no
include $(TOPDIR)/config.mk
-ifeq ($(REBUILD_LIBGP),yes)
+ifndef TOP_MAKE
ALL+=rebuild_lib
rebuild_lib:
diff --git a/libs/backends/Makefile b/libs/backends/Makefile
index e59e2c1..39ea7d2 100644
--- a/libs/backends/Makefile
+++ b/libs/backends/Makefile
@@ -1,8 +1,9 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
CSOURCES=$(shell ls *.c)
LIBNAME=backends
BUILDLIB=yes
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/libs/core/Makefile b/libs/core/Makefile
index 65d8440..cd08e30 100644
--- a/libs/core/Makefile
+++ b/libs/core/Makefile
@@ -1,10 +1,11 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
GENSOURCES=GP_Pixel.gen.c GP_Blit.gen.c GP_Convert.gen.c GP_GammaCorrection.gen.c
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
LIBNAME=core
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/gen.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/libs/filters/Makefile b/libs/filters/Makefile
index cedc55a..1773151 100644
--- a/libs/filters/Makefile
+++ b/libs/filters/Makefile
@@ -1,4 +1,5 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
STATS_FILTERS=GP_Histogram.gen.c
@@ -17,7 +18,6 @@ CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
LIBNAME=filters
INCLUDE=core
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/gen.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile
index e46a8ef..4511495 100644
--- a/libs/gfx/Makefile
+++ b/libs/gfx/Makefile
@@ -1,10 +1,11 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
GENSOURCES=GP_Line.gen.c GP_HLine.gen.c GP_LineAA.gen.c GP_PutPixelAA.gen.c GP_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c
LIBNAME=gfx
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/gen.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/libs/grabbers/Makefile b/libs/grabbers/Makefile
index 4df5769..919a0ef 100644
--- a/libs/grabbers/Makefile
+++ b/libs/grabbers/Makefile
@@ -1,8 +1,9 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
CSOURCES=$(shell ls *.c)
LIBNAME=grabbers
BUILDLIB=yes
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/libs/input/Makefile b/libs/input/Makefile
index 4896a22..5d58e4c 100644
--- a/libs/input/Makefile
+++ b/libs/input/Makefile
@@ -1,8 +1,9 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
CSOURCES=$(shell ls *.c)
INCLUDE=core
LIBNAME=input
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/libs/loaders/Makefile b/libs/loaders/Makefile
index 0adfcfb..076b940 100644
--- a/libs/loaders/Makefile
+++ b/libs/loaders/Makefile
@@ -1,8 +1,9 @@
TOPDIR=../..
+include $(TOPDIR)/pre.mk
+
CSOURCES=$(shell ls *.c)
INCLUDE=core
LIBNAME=loaders
-include $(TOPDIR)/pre.mk
include $(TOPDIR)/lib.mk
include $(TOPDIR)/post.mk
diff --git a/post.mk b/post.mk
index 84ef703..881a42f 100644
--- a/post.mk
+++ b/post.mk
@@ -82,10 +82,10 @@ endif
#
$(SUBDIRS):
ifdef VERBOSE
- $(MAKE) -C $@ $(MAKECMDGOALS)
+ $(MAKE) -C $@ $(MAKECMDGOALS) TOP_MAKE=$(TOP_MAKE)
else
- @export CURSUBDIR="$$CURSUBDIR/$@" && echo "DIR $$CURSUBDIR" &&- $(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS)
+ @export CURSUBDIR="$$CURSUBDIR/$@" && echo "DIR $$CURSUBDIR" &&+ $(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS) TOP_MAKE=$(TOP_MAKE)
endif
#
@@ -95,7 +95,7 @@ $(DEPFILES): %.dep: %.c
ifdef VERBOSE
$(CC) -MM $(CFLAGS) $< -o $@
else
- @echo "DEP -I(include $(INCLUDE)) $@"
+ @echo "DEP -I(include $(INCLUDE)) $@"
@$(CC) -MM $(CFLAGS) $< -o $@
endif
@@ -103,7 +103,7 @@ $(OBJECTS): %.o: %.c
ifdef VERBOSE
$(CC) $(CFLAGS) -c $< -o $@
else
- @echo "CC -I(include $(INCLUDE)) $@"
+ @echo "CC -I(include $(INCLUDE)) $@"
@$(CC) $(CFLAGS) -c $< -o $@
endif
@@ -112,7 +112,7 @@ clean:
ifdef VERBOSE
rm -f $(CLEAN)
else
- @echo "RM $(CLEAN)"
+ @echo "RM $(CLEAN)"
@rm -f $(CLEAN)
endif
endif
diff --git a/pywrap.mk b/pywrap.mk
index 2b527b8..f41ce63 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -29,7 +29,7 @@ $(SWIG_LIB): $(SWIG_C)
ifdef VERBOSE
$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
else # VERBOSE
- @echo "LD $@"
+ @echo "LD $@"
@$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) -I$(PYTHON_INCLUDE) --shared -lGP $(LDLIBS) -L$(TOPDIR)/build/ -o $@
endif # VERBOSE
-----------------------------------------------------------------------
Summary of changes:
Makefile | 8 +++++++-
app.mk | 2 +-
build/Makefile | 14 ++++----------
build/liblock.sh | 25 -------------------------
lib.mk | 6 +++---
libs/backends/Makefile | 3 ++-
libs/core/Makefile | 3 ++-
libs/filters/Makefile | 2 +-
libs/gfx/Makefile | 3 ++-
libs/grabbers/Makefile | 3 ++-
libs/input/Makefile | 3 ++-
libs/loaders/Makefile | 3 ++-
post.mk | 12 ++++++------
pywrap.mk | 2 +-
14 files changed, 35 insertions(+), 54 deletions(-)
delete mode 100644 build/liblock.sh
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 65cea9aefed176553293e6d5b18ad5eb24b9b704
by metan 26 Dec '12
by metan 26 Dec '12
26 Dec '12
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 65cea9aefed176553293e6d5b18ad5eb24b9b704 (commit)
via 9405c62813a1cc0ce1584a512ca07384899244b2 (commit)
via e9931e042beccee51ddb1855ba2cecc22dc8d0ea (commit)
from 36422459f0fc8293fb52d4818dc94c8342615a1c (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/65cea9aefed176553293e6d5b18ad5eb24b9…
commit 65cea9aefed176553293e6d5b18ad5eb24b9b704
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 16:02:33 2012 +0100
build: pywrap: Fix the dependencies.
Make can't create rule that produces two
or more files so we use small trick with
with dummy rule to fix this.
diff --git a/pywrap.mk b/pywrap.mk
index d8b18f6..2b527b8 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -13,7 +13,11 @@ INCLUDES+=$(addprefix -I$(TOPDIR)/include/, $(INCLUDE))
ALL+=$(SWIG_LIB) $(SWIG_PY)
-$(SWIG_C) $(SWIG_PY): $(SWIG_SRC)
+# Empty rule to satisfy SWIG_PY
+$(SWIG_PY): $(SWIG_C)
+ @
+
+$(SWIG_C): $(SWIG_SRC)
ifdef VERBOSE
$(SWIG) $(SWIGOPTS) -python $(INCLUDES) $<
else # VERBOSE
http://repo.or.cz/w/gfxprim.git/commit/9405c62813a1cc0ce1584a512ca073848992…
commit 9405c62813a1cc0ce1584a512ca07384899244b2
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 15:55:35 2012 +0100
build: Fix dependencies for library build.
Now the library is rebuild only once after
the sources has been changed.
diff --git a/build/Makefile b/build/Makefile
index 7ac79b2..59afb71 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -1,7 +1,10 @@
LIB_OBJECTS=$(shell ./get_objs.sh)
all: libGP.a libGP.so libGP.so.0
-.PHONY: libGP.a libGP.so libGP.so.0
+
+libGP.a: $(LIB_OBJECTS)
+libGP.so: $(LIB_OBJECTS)
+libGP.so.0: $(LIB_OBJECTS)
rebuild: all
http://repo.or.cz/w/gfxprim.git/commit/e9931e042beccee51ddb1855ba2cecc22dc8…
commit e9931e042beccee51ddb1855ba2cecc22dc8d0ea
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 15:52:20 2012 +0100
Remove long obsolete TODO file.
diff --git a/TODO b/TODO
deleted file mode 100644
index 04e7bdc..0000000
--- a/TODO
+++ /dev/null
@@ -1,15 +0,0 @@
-What's not implemented (and should be)
---------------------------------------
-
-* Meditate about bit endians and why these aren't separate pixel types
- (which would make our lives a bit easier)
-
-Advanced features
------------------
-
-* bitmaps
- - alpha channel
-
-* gfx primitives
- - drawing with alpha channel
- - anti aliasing
-----------------------------------------------------------------------
Summary of changes:
TODO | 15 ---------------
build/Makefile | 5 ++++-
pywrap.mk | 6 +++++-
3 files changed, 9 insertions(+), 17 deletions(-)
delete mode 100644 TODO
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 36422459f0fc8293fb52d4818dc94c8342615a1c
by metan 26 Dec '12
by metan 26 Dec '12
26 Dec '12
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 36422459f0fc8293fb52d4818dc94c8342615a1c (commit)
via 833048c796ea1e1edd87616fd55cc6d8b83c2e24 (commit)
via af5118fc6050c831cac9fdb26e1d4a0f2d081626 (commit)
from 8bfdadb7f739f7eb614d3c4f427a3d075a0669a1 (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/36422459f0fc8293fb52d4818dc94c834261…
commit 36422459f0fc8293fb52d4818dc94c8342615a1c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 15:40:08 2012 +0100
all: Fix some warnings.
diff --git a/demos/c_simple/blittest.c b/demos/c_simple/blittest.c
index 013bf07..5a80233 100644
--- a/demos/c_simple/blittest.c
+++ b/demos/c_simple/blittest.c
@@ -147,7 +147,7 @@ void print_instructions(void)
printf(" P ............... pausen");
}
-int main(int argc, char *argv[])
+int main(void)
{
const char *sprite = "ball.ppm";
const char *backend_opts = "X11";
diff --git a/include/filters/GP_Sigma.h b/include/filters/GP_Sigma.h
index 18275f0..a9e35e9 100644
--- a/include/filters/GP_Sigma.h
+++ b/include/filters/GP_Sigma.h
@@ -47,18 +47,21 @@ int GP_FilterSigmaEx(const GP_Context *src,
GP_Size w_src, GP_Size h_src,
GP_Context *dst,
GP_Coord x_dst, GP_Coord y_dst,
- int xrad, int yrad, int min, float sigma,
+ int xrad, int yrad,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback);
GP_Context *GP_FilterSigmaExAlloc(const GP_Context *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- int xrad, int yrad, int min, float sigma,
+ int xrad, int yrad,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback);
static inline int GP_FilterSigma(const GP_Context *src,
GP_Context *dst,
- int xrad, int yrad, int min, float sigma,
+ int xrad, int yrad,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback)
{
return GP_FilterSigmaEx(src, 0, 0, src->w, src->h,
@@ -67,7 +70,7 @@ static inline int GP_FilterSigma(const GP_Context *src,
static inline GP_Context *GP_FilterSigmaAlloc(const GP_Context *src,
int xrad, int yrad,
- int min, float sigma,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback)
{
return GP_FilterSigmaExAlloc(src, 0, 0, src->w, src->h,
diff --git a/libs/filters/GP_Sigma.c b/libs/filters/GP_Sigma.c
index 876e21d..2d1f6aa 100644
--- a/libs/filters/GP_Sigma.c
+++ b/libs/filters/GP_Sigma.c
@@ -37,7 +37,8 @@ static int GP_FilterSigma_Raw(const GP_Context *src,
GP_Size w_src, GP_Size h_src,
GP_Context *dst,
GP_Coord x_dst, GP_Coord y_dst,
- int xrad, int yrad, int min, float sigma,
+ int xrad, int yrad,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback)
{
int x, y;
@@ -68,7 +69,7 @@ static int GP_FilterSigma_Raw(const GP_Context *src,
for (x = 0; x < (int)w; x++) {
int xi = GP_CLAMP(x_src + x - xrad, 0, (int)src->w - 1);
- for (y = 0; y < ydiam; y++) {
+ for (y = 0; y < (int)ydiam; y++) {
int yi = GP_CLAMP(y_src + y - yrad, 0, (int)src->h - 1);
GP_Pixel pix = GP_GetPixel_Raw_24BPP(src, xi, yi);
@@ -206,7 +207,8 @@ int GP_FilterSigmaEx(const GP_Context *src,
GP_Size w_src, GP_Size h_src,
GP_Context *dst,
GP_Coord x_dst, GP_Coord y_dst,
- int xrad, int yrad, int min, float sigma,
+ int xrad, int yrad,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback)
{
GP_CHECK(src->pixel_type == dst->pixel_type);
@@ -225,7 +227,8 @@ int GP_FilterSigmaEx(const GP_Context *src,
GP_Context *GP_FilterSigmaExAlloc(const GP_Context *src,
GP_Coord x_src, GP_Coord y_src,
GP_Size w_src, GP_Size h_src,
- int xrad, int yrad, int min, float sigma,
+ int xrad, int yrad,
+ unsigned int min, float sigma,
GP_ProgressCallback *callback)
{
int ret;
diff --git a/libs/loaders/GP_TmpFile.c b/libs/loaders/GP_TmpFile.c
index cacbf32..2796652 100644
--- a/libs/loaders/GP_TmpFile.c
+++ b/libs/loaders/GP_TmpFile.c
@@ -39,7 +39,7 @@ GP_Context *GP_LoadTmpFile(const char *src_path, GP_ProgressCallback *callback)
enum GP_PixelType pixel_type;
char sig[sizeof(file_sig)];
GP_Context *ret;
- int err;
+ int err, i;
f = fopen(src_path, "r");
@@ -58,15 +58,15 @@ GP_Context *GP_LoadTmpFile(const char *src_path, GP_ProgressCallback *callback)
goto err0;
}
- /* Read context metadata */
- fread(&w, sizeof(w), 1, f);
- fread(&h, sizeof(h), 1, f);
- fread(&offset, sizeof(offset), 1, f);
- fread(&bpr, sizeof(bpr), 1, f);
- fread(&pixel_type, sizeof(pixel_type), 1, f);
- fread(&flags, 1, 1, f);
+ /* Read context metadata */
+ i = fread(&w, sizeof(w), 1, f);
+ i += fread(&h, sizeof(h), 1, f);
+ i += fread(&offset, sizeof(offset), 1, f);
+ i += fread(&bpr, sizeof(bpr), 1, f);
+ i += fread(&pixel_type, sizeof(pixel_type), 1, f);
+ i += fread(&flags, 1, 1, f);
- if (ferror(f)) {
+ if (i != 6 || ferror(f)) {
err = EIO;
goto err0;
}
@@ -121,7 +121,7 @@ int GP_SaveTmpFile(const GP_Context *src, const char *dst_path,
{
FILE *f;
int err;
- uint32_t y;
+ uint32_t y, i;
f = fopen(dst_path, "w");
@@ -129,14 +129,14 @@ int GP_SaveTmpFile(const GP_Context *src, const char *dst_path,
return 1;
/* Write a signature */
- fwrite(file_sig, sizeof(file_sig), 1, f);
+ i = fwrite(file_sig, sizeof(file_sig), 1, f);
/* Write block of metadata */
- fwrite(&src->w, sizeof(src->w), 1, f);
- fwrite(&src->h, sizeof(src->h), 1, f);
- fwrite(&src->offset, sizeof(src->offset), 1, f);
- fwrite(&src->bytes_per_row, sizeof(src->bytes_per_row), 1, f);
- fwrite(&src->pixel_type, sizeof(src->pixel_type), 1, f);
+ i += fwrite(&src->w, sizeof(src->w), 1, f);
+ i += fwrite(&src->h, sizeof(src->h), 1, f);
+ i += fwrite(&src->offset, sizeof(src->offset), 1, f);
+ i += fwrite(&src->bytes_per_row, sizeof(src->bytes_per_row), 1, f);
+ i += fwrite(&src->pixel_type, sizeof(src->pixel_type), 1, f);
uint8_t flags = 0;
@@ -149,7 +149,12 @@ int GP_SaveTmpFile(const GP_Context *src, const char *dst_path,
if (src->y_swap)
flags |= 0x04;
- fwrite(&flags, 1, 1, f);
+ i += fwrite(&flags, 1, 1, f);
+
+ if (i != 7) {
+ err = EIO;
+ goto err1;
+ }
/* And pixels */
for (y = 0; y < src->h; y++) {
diff --git a/pylib/gfxprim/core/core.i b/pylib/gfxprim/core/core.i
index c59ae6c..89c0301 100644
--- a/pylib/gfxprim/core/core.i
+++ b/pylib/gfxprim/core/core.i
@@ -38,7 +38,7 @@ ERROR_ON_NULL(GP_ColorToColorName);
%inline %{
const GP_PixelTypeDescription *GP_PixelTypes_access(GP_PixelType no)
{
- if (no < 0 || no >= GP_PIXEL_MAX) no = GP_PIXEL_UNKNOWN;
+ if ((signed)no < 0 || no >= GP_PIXEL_MAX) no = GP_PIXEL_UNKNOWN;
return &GP_PixelTypes[no];
}
%}
diff --git a/tests/filters/LinearConvolution.c b/tests/filters/LinearConvolution.c
index 0264ddd..42ac872 100644
--- a/tests/filters/LinearConvolution.c
+++ b/tests/filters/LinearConvolution.c
@@ -114,7 +114,7 @@ static int test_v_lin_conv_box_3_raw(void)
if (ret != TST_SUCCESS)
return ret;
- GP_SetDebugLevel(10);
+// GP_SetDebugLevel(10);
/* Apply the convolution */
float kernel[] = {1, 1, 1};
http://repo.or.cz/w/gfxprim.git/commit/833048c796ea1e1edd87616fd55cc6d8b83c…
commit 833048c796ea1e1edd87616fd55cc6d8b83c2e24
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 15:34:47 2012 +0100
pywrap: loaders: Ignore GP_Loader structure.
Don't generate accessors for GP_Loader structure members.
diff --git a/pylib/gfxprim/loaders/loaders.i b/pylib/gfxprim/loaders/loaders.i
index f72a3e8..33a2fbd 100644
--- a/pylib/gfxprim/loaders/loaders.i
+++ b/pylib/gfxprim/loaders/loaders.i
@@ -6,6 +6,8 @@
#include "loaders/GP_Loaders.h"
%}
+%ignore GP_Loader;
+
%import ../core/core.i
ERROR_ON_NULL(GP_LoadImage);
http://repo.or.cz/w/gfxprim.git/commit/af5118fc6050c831cac9fdb26e1d4a0f2d08…
commit af5118fc6050c831cac9fdb26e1d4a0f2d081626
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed Dec 26 15:20:28 2012 +0100
tests: framework: Use more portable posix_memalign.
diff --git a/tests/framework/tst_alloc_barriers.c b/tests/framework/tst_alloc_barriers.c
index 315480e..fb745b6 100644
--- a/tests/framework/tst_alloc_barriers.c
+++ b/tests/framework/tst_alloc_barriers.c
@@ -31,10 +31,9 @@ void *tst_alloc_barrier_right(size_t size)
{
size_t pagesize = sysconf(_SC_PAGESIZE);
size_t pages = size/pagesize + !!(size%pagesize) + 1;
-
- char *buf = memalign(pagesize, pages * pagesize);
-
- if (buf == NULL)
+ char *buf;
+
+ if (posix_memalign((void*)&buf, pagesize, pages * pagesize))
return NULL;
/*
@@ -70,9 +69,9 @@ void *tst_alloc_barrier_left(size_t size)
size_t pagesize = sysconf(_SC_PAGESIZE);
size_t pages = size/pagesize + !!(size%pagesize) + 1;
- char *buf = memalign(pagesize, pages * pagesize);
-
- if (buf == NULL)
+ char *buf;
+
+ if (posix_memalign((void*)&buf, pagesize, pages * pagesize))
return NULL;
/*
-----------------------------------------------------------------------
Summary of changes:
demos/c_simple/blittest.c | 2 +-
include/filters/GP_Sigma.h | 11 ++++++---
libs/filters/GP_Sigma.c | 11 ++++++---
libs/loaders/GP_TmpFile.c | 39 +++++++++++++++++++--------------
pylib/gfxprim/core/core.i | 2 +-
pylib/gfxprim/loaders/loaders.i | 2 +
tests/filters/LinearConvolution.c | 2 +-
tests/framework/tst_alloc_barriers.c | 13 +++++------
8 files changed, 47 insertions(+), 35 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
[repo.or.cz] gfxprim.git branch master updated: 8bfdadb7f739f7eb614d3c4f427a3d075a0669a1
by gavento 25 Dec '12
by gavento 25 Dec '12
25 Dec '12
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 8bfdadb7f739f7eb614d3c4f427a3d075a0669a1 (commit)
via 55afb5fd376150afe14f6388749547e07fc02c42 (commit)
from 08e5a448761d5d3b25abcf1d42967458e8cdfa62 (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/8bfdadb7f739f7eb614d3c4f427a3d075a06…
commit 8bfdadb7f739f7eb614d3c4f427a3d075a0669a1
Merge: 55afb5f 08e5a44
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Tue Dec 25 03:28:02 2012 +0100
Merge branch 'master' of ssh://repo.or.cz/srv/git/gfxprim
http://repo.or.cz/w/gfxprim.git/commit/55afb5fd376150afe14f6388749547e07fc0…
commit 55afb5fd376150afe14f6388749547e07fc02c42
Author: Tomas Gavenciak <gavento(a)ucw.cz>
Date: Tue Dec 25 03:26:45 2012 +0100
loaders: pylib: cleanup and Context submodule
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py
index 5dd476e..621099a 100644
--- a/pylib/gfxprim/loaders/__init__.py
+++ b/pylib/gfxprim/loaders/__init__.py
@@ -1,11 +1,31 @@
-from . import loaders_c
+from . import c_loaders
+
+
+def Load(filename, callback=None):
+ "Load image from given file, guessing the type."
+ c = c_loaders.GP_LoadImage(filename, callback)
+ return c
+
def _init(module):
+ "Extend Context with loaders submodule"
+
+ from ..utils import extend, add_swig_getmethod, add_swig_setmethod
+ from ..core import Context as _context
+
+ class LoadersSubmodule(object):
+ def __init__(self, ctx):
+ self.ctx = ctx
+
+ _context._submodules['loaders'] = LoadersSubmodule
+
+ @extend(LoadersSubmodule)
+ def Save(self, filename, callback=None):
+ """Save the image, guessing the type from the extension.
- # Extend Context with convenience methods
- from ._extend_context import extend_context
- from ..core import Context
- extend_context(Context)
+ Generally, not all pixel types work with all formats.
+ """
+ c_loaders.GP_SaveImage(self.ctx, filename, callback)
# Imports from the SWIG module
import re
@@ -14,11 +34,13 @@ def _init(module):
# Import functions from the SWIG module
from ..utils import import_members
- import_members(loaders_c, module, sub=strip_GP,
- exclude=[
- '^w+_swigregister$',
- '^gfxprim$',
- '^_w+$'])
+ import_members(c_loaders, module, sub=strip_GP,
+ include=[
+ '^GP_Load[A-Z]{3}.*',
+ '^GP_Save[A-Z]{3}.*',
+ '^GP_ListLoaders$',
+ '^GP_LoadMetaData$',
+ ])
_init(locals())
del _init
diff --git a/pylib/gfxprim/loaders/loaders.i b/pylib/gfxprim/loaders/loaders.i
index 7c9d903..f72a3e8 100644
--- a/pylib/gfxprim/loaders/loaders.i
+++ b/pylib/gfxprim/loaders/loaders.i
@@ -1,5 +1,5 @@
%include "../common.i"
-%module(package="gfxprim.loaders") loaders_c
+%module(package="gfxprim.loaders") c_loaders
%{
#include "core/GP_Core.h"
@@ -14,7 +14,7 @@ ERROR_ON_NONZERO(GP_SaveImage);
%newobject GP_LoadImage;
-%include "GP_Loaders.h"
+%include "GP_Loader.h"
ERROR_ON_NONZERO(GP_OpenJPG);
ERROR_ON_NULL(GP_ReadJPG);
-----------------------------------------------------------------------
Summary of changes:
pylib/gfxprim/loaders/__init__.py | 42 ++++++++++++++++++++++++++++--------
pylib/gfxprim/loaders/loaders.i | 4 +-
2 files changed, 34 insertions(+), 12 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0