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 f841e08588f0113c8a6800a55ab3735ea7691188 (commit) from 97e18f4407aadb708f4ea171b0cbed30b829fa0b (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/f841e08588f0113c8a6800a55ab3735ea7691...
commit f841e08588f0113c8a6800a55ab3735ea7691188 Author: Cyril Hrubis metan@ucw.cz Date: Sun Nov 13 20:07:33 2011 +0100
core: Changed GP_ContextConvert API, updated progs and docs.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c index ead85bf..bf18f3f 100644 --- a/demos/fbshow/fbshow.c +++ b/demos/fbshow/fbshow.c @@ -111,7 +111,7 @@ static void *image_loader(void *ptr)
/* Workaround */ if (img->pixel_type != GP_PIXEL_RGB888) { - GP_Context *tmp = GP_ContextConvert(img, GP_PIXEL_RGB888); + GP_Context *tmp = GP_ContextConvert(img, NULL, GP_PIXEL_RGB888); GP_ContextFree(img); img = tmp; } diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index 9833ea1..fd6ccce 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -326,6 +326,8 @@ static GP_RetCode invert(GP_Context **c, const char *params) return GP_ESUCCESS; }
+/* blur */ + static struct param blur_params[] = { {"sigma", PARAM_FLOAT, "sigma parameter, radii of blur (sets both)", NULL, NULL}, {"sigma_x", PARAM_FLOAT, "sigma parameter for horizontal direction", NULL, NULL}, diff --git a/doc/context.txt b/doc/context.txt index 89cf55d..2e102f1 100644 --- a/doc/context.txt +++ b/doc/context.txt @@ -136,3 +136,20 @@ pointer. In both cases pointer to subcontext or NULL (in case of 'malloc(2)' failure) is returned.
+Conversions +~~~~~~~~~~~ + +[source,c] +------------------------------------------------------------------------------- +#include <GP.h> + +GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst, + GP_PixelType dst_pixel_type); +------------------------------------------------------------------------------- + +This provides basic context conversion functionality. If 'NULL' is passed as +dst, the context for result is allocated and returned. + +This fuction does no error distribution but only integer +division/multiplication for each pixel channel. + diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h index d6b0f6a..cbe3742 100644 --- a/include/core/GP_Context.h +++ b/include/core/GP_Context.h @@ -120,7 +120,8 @@ GP_Context *GP_ContextSubContext(GP_Context *context, GP_Context *subcontext, * This is naive implementation that doesn't do any ditherings or error * diffusions. */ -GP_Context *GP_ContextConvert(const GP_Context *context, GP_PixelType res_type); +GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst, + GP_PixelType dst_pixel_type);
/* * Free context. diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c index ab27966..f1efa61 100644 --- a/libs/core/GP_Context.c +++ b/libs/core/GP_Context.c @@ -94,7 +94,7 @@ GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type) context->h = h;
context->pixel_type = type; - #warning Hmm, bit endianity..., Why isn't this settled by different pixel types? + #warning Hmm, bit endianity... Why isn't this settled by different pixel types? context->bit_endian = 0; /* rotation and mirroring */ @@ -107,14 +107,19 @@ GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type) return context; }
-GP_Context *GP_ContextConvert(const GP_Context *context, GP_PixelType res_type) +GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst, + GP_PixelType dst_pixel_type) { - GP_Context *ret = GP_ContextAlloc(context->w, context->h, res_type); + GP_Context *ret = dst; + + if (ret == NULL) { + ret = GP_ContextAlloc(src->w, src->h, dst_pixel_type);
- if (ret == NULL) - return NULL; + if (ret == NULL) + return NULL; + }
- GP_Blit_Naive(context, 0, 0, context->w, context->h, ret, 0, 0); + GP_Blit_Naive(src, 0, 0, src->w, src->h, ret, 0, 0);
return ret; } diff --git a/tests/SDL/blittest.c b/tests/SDL/blittest.c index be39c83..1a4ed83 100644 --- a/tests/SDL/blittest.c +++ b/tests/SDL/blittest.c @@ -184,7 +184,7 @@ int main(int argc, char *argv[])
GP_SDL_ContextFromSurface(&context, display); - bitmap_conv = GP_ContextConvert(bitmap_raw, context.pixel_type); + bitmap_conv = GP_ContextConvert(bitmap_raw, NULL, context.pixel_type); change_bitmap();
black = GP_ColorToContextPixel(GP_COL_BLACK, &context);
-----------------------------------------------------------------------
Summary of changes: demos/fbshow/fbshow.c | 2 +- demos/grinder/grinder.c | 2 ++ doc/context.txt | 17 +++++++++++++++++ include/core/GP_Context.h | 3 ++- libs/core/GP_Context.c | 17 +++++++++++------ tests/SDL/blittest.c | 2 +- 6 files changed, 34 insertions(+), 9 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.