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 cc5f16de4ff693a60f55a5b335367b3a8ffd3a40 (commit) via 4a0d49ee3217ef629843a671587ae0e4c1659564 (commit) from 268e020540d7c79ee472d75c1f959228f419b82b (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/cc5f16de4ff693a60f55a5b335367b3a8ffd3...
commit cc5f16de4ff693a60f55a5b335367b3a8ffd3a40 Merge: 4a0d49e 268e020 Author: Tomas Gavenciak gavento@ucw.cz Date: Sat Nov 26 21:38:16 2011 +0100
Merge branch 'master' of git://repo.or.cz/gfxprim
diff --cc demos/fbshow/fbshow.c index ead85bf,8c1a2e7..4510312 --- a/demos/fbshow/fbshow.c +++ b/demos/fbshow/fbshow.c @@@ -109,9 -143,12 +143,12 @@@ static void *image_loader(void *ptr
float rat = calc_img_size(img->w, img->h, w, h);
+ w = img->w; + h = img->h; + /* Workaround */ if (img->pixel_type != GP_PIXEL_RGB888) { - GP_Context *tmp = GP_ContextConvert(img, NULL, GP_PIXEL_RGB888); + GP_Context *tmp = GP_ContextConvert(img, GP_PIXEL_RGB888); GP_ContextFree(img); img = tmp; }
http://repo.or.cz/w/gfxprim.git/commit/4a0d49ee3217ef629843a671587ae0e4c1659...
commit 4a0d49ee3217ef629843a671587ae0e4c1659564 Author: Tomas Gavenciak gavento@ucw.cz Date: Sat Nov 26 21:29:11 2011 +0100
Neuter GP_ContextConvert (always alloc)
Make GP_ContextConvert always allocate a new GP_Context * Consistent allocation behavior (=> less leaks) * The other variant is just a blit (make another wrapper if required) * Easier wrapping
Note: the variant was buggy anyway (direct use of context->w)
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c index bf18f3f..ead85bf 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, NULL, GP_PIXEL_RGB888); + GP_Context *tmp = GP_ContextConvert(img, GP_PIXEL_RGB888); GP_ContextFree(img); img = tmp; } diff --git a/demos/grinder/grinder.c b/demos/grinder/grinder.c index 2a9ec43..2defb20 100644 --- a/demos/grinder/grinder.c +++ b/demos/grinder/grinder.c @@ -443,7 +443,7 @@ static GP_RetCode dither(GP_Context **c, const char *params)
//TODO: so far we convert the context back to RGB888 //(so we can do further work with it) - GP_ContextConvert(bw, *c, (*c)->pixel_type); + GP_Blit(bw, 0, 0, GP_ContextW(bw), GP_ContextH(bw), *c, 0, 0);
GP_ContextFree(bw);
diff --git a/doc/context.txt b/doc/context.txt index 2e102f1..a98d21a 100644 --- a/doc/context.txt +++ b/doc/context.txt @@ -147,8 +147,8 @@ 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. +Provides basic context conversion functionality. +A newly allocated context is 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 cbe3742..664f15b 100644 --- a/include/core/GP_Context.h +++ b/include/core/GP_Context.h @@ -115,16 +115,19 @@ GP_Context *GP_ContextSubContext(GP_Context *context, GP_Context *subcontext, GP_Coord x, GP_Coord y, GP_Size w, GP_Size h);
/* - * Converts context to different pixel type. + * Converts context to a different pixel type. + * Returns a newly allocated context. * * This is naive implementation that doesn't do any ditherings or error * diffusions. */ -GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst, +GP_Context *GP_ContextConvert(const GP_Context *src, GP_PixelType dst_pixel_type);
/* * Free context. + * + * If context->free_pixels, also free pixel data. */ void GP_ContextFree(GP_Context *context);
diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c index 23ae77b..7079901 100644 --- a/libs/core/GP_Context.c +++ b/libs/core/GP_Context.c @@ -107,25 +107,14 @@ GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type) return context; }
-GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst, +GP_Context *GP_ContextConvert(const GP_Context *src, GP_PixelType dst_pixel_type) { - GP_Context *ret = dst; - - if (ret == NULL) { - ret = GP_ContextAlloc(src->w, src->h, dst_pixel_type); - - if (ret == NULL) - return NULL; - } else { - GP_ASSERT(dst->pixel_type == dst_pixel_type, - "Destination pixel type doesn't match"); - GP_ASSERT(src->w <= dst->w && src->h <= dst->h, - "Destination is not big enough"); - } + GP_Context *ret = GP_ContextAlloc(src->w, src->h, dst_pixel_type); + if (ret == NULL) + return NULL;
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 1a4ed83..be39c83 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, NULL, context.pixel_type); + bitmap_conv = GP_ContextConvert(bitmap_raw, 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 | 4 ++-- include/core/GP_Context.h | 7 +++++-- libs/core/GP_Context.c | 19 ++++--------------- tests/SDL/blittest.c | 2 +- 6 files changed, 14 insertions(+), 22 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.