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 89d86e0b6926dd8f6a5f650a89920e104ea52b00 (commit) via 995986f457f6cc5d2ea615622cb6d3a310f51e9d (commit) from 9b6212e7e083c6a78dca9cf322553c27baea66b2 (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/89d86e0b6926dd8f6a5f650a89920e104ea52...
commit 89d86e0b6926dd8f6a5f650a89920e104ea52b00 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jan 30 20:35:31 2012 +0100
core: Fix the Blit to honor rotations, added Blit_Raw.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c index f6187f8..5e3e06d 100644 --- a/demos/fbshow/fbshow.c +++ b/demos/fbshow/fbshow.c @@ -211,7 +211,7 @@ static void *image_loader(void *ptr) uint32_t cx = (context->w - ret->w)/2; uint32_t cy = (context->h - ret->h)/2;
- GP_Blit(ret, 0, 0, ret->w, ret->h, context, cx, cy); + GP_Blit_Raw(ret, 0, 0, ret->w, ret->h, context, cx, cy); GP_ContextFree(ret);
/* clean up the rest of the display */ diff --git a/include/core/GP_Blit.h b/include/core/GP_Blit.h index 3c9ec54..f772ce0 100644 --- a/include/core/GP_Blit.h +++ b/include/core/GP_Blit.h @@ -17,7 +17,7 @@ * Boston, MA 02110-1301 USA * * * * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * - * Copyright (C) 2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2011,2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -30,6 +30,12 @@ void GP_Blit(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_Size w, GP_Size h, GP_Context *c2, GP_Coord x2, GP_Coord y2);
+/* + * Doesn't respect rotations. Most of the time faster. + */ +void GP_Blit_Raw(const GP_Context *c1, GP_Coord x1, GP_Coord y1, + GP_Size w, GP_Size h, GP_Context *c2, GP_Coord x2, GP_Coord y2); +
/* * Very naive blit, no optimalizations whatsoever - keep it that way. diff --git a/libs/core/GP_Blit.c b/libs/core/GP_Blit.c index 1aa1e7e..9bcb80e 100644 --- a/libs/core/GP_Blit.c +++ b/libs/core/GP_Blit.c @@ -51,8 +51,8 @@ void GP_Blit_Naive(const GP_Context *c1, int x1, int y1, int w, int h, } */
-void GP_Blit_Naive(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_Size w, GP_Size h, - GP_Context *c2, GP_Coord x2, GP_Coord y2) +void GP_Blit_Naive_Raw(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_Size w, GP_Size h, + GP_Context *c2, GP_Coord x2, GP_Coord y2) { GP_CHECK(x1 >= 0); GP_CHECK(y1 >= 0); @@ -73,3 +73,33 @@ void GP_Blit_Naive(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_Size w, GP GP_PutPixel_Raw(c2, x2 + i, y2 + j, p); } } + +void GP_Blit_Raw(const GP_Context *c1, GP_Coord x1, GP_Coord y1, + GP_Size w, GP_Size h, GP_Context *c2, GP_Coord x2, GP_Coord y2) +{ + // Ultimate TODO: effective processing + GP_Blit_Naive_Raw(c1, x1, y1, w, h, c2, x2, y2); +} + +void GP_Blit_Naive(const GP_Context *c1, GP_Coord x1, GP_Coord y1, GP_Size w, GP_Size h, + GP_Context *c2, GP_Coord x2, GP_Coord y2) +{ + GP_CHECK(x1 >= 0); + GP_CHECK(y1 >= 0); + GP_CHECK(x1 + w <= GP_ContextW(c1)); + GP_CHECK(y1 + h <= GP_ContextH(c1)); + GP_CHECK(x2 >= 0); + GP_CHECK(y2 >= 0); + GP_CHECK(x2 + w <= GP_ContextW(c2)); + GP_CHECK(y2 + h <= GP_ContextH(c2)); + + GP_Size i, j; + + for (i = 0; i < w; i++) + for (j = 0; j < h; j++) { + GP_Pixel p = GP_GetPixel(c1, x1 + i, y1 + j); + if (c1->pixel_type != c2->pixel_type) + p = GP_ConvertContextPixel(p, c1, c2); + GP_PutPixel(c2, x2 + i, y2 + j, p); + } +}
http://repo.or.cz/w/gfxprim.git/commit/995986f457f6cc5d2ea615622cb6d3a310f51...
commit 995986f457f6cc5d2ea615622cb6d3a310f51e9d Author: Cyril Hrubis metan@ucw.cz Date: Mon Jan 30 19:57:08 2012 +0100
core: Added GP_ContextInit().
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h index 664f15b..d91e54d 100644 --- a/include/core/GP_Context.h +++ b/include/core/GP_Context.h @@ -92,6 +92,12 @@ typedef struct GP_Context { GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type);
/* + * Initalize context. + */ +void GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h, + GP_PixelType type, void *pixels); + +/* * If passed the pixels are copied to newly created context, otherwise * the pixels are allocated but uninitalized. */ diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c index 73e926e..157fc82 100644 --- a/libs/core/GP_Context.c +++ b/libs/core/GP_Context.c @@ -107,6 +107,31 @@ GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type) return context; }
+void GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h, + GP_PixelType type, void *pixels) +{ + uint32_t bpp = GP_PixelSize(type); + uint32_t bpr = (bpp * w) / 8 + !!((bpp * w) % 8); + + context->pixels = pixels; + context->bpp = bpp; + context->bytes_per_row = bpr; + context->offset = 0; + + context->w = w; + context->h = h; + + context->pixel_type = type; + context->bit_endian = 0; + + /* rotation and mirroring */ + context->axes_swap = 0; + context->y_swap = 0; + context->x_swap = 0; + + context->free_pixels = 0; +} + GP_Context *GP_ContextConvert(const GP_Context *src, GP_PixelType dst_pixel_type) {
-----------------------------------------------------------------------
Summary of changes: demos/fbshow/fbshow.c | 2 +- include/core/GP_Blit.h | 8 +++++++- include/core/GP_Context.h | 6 ++++++ libs/core/GP_Blit.c | 34 ++++++++++++++++++++++++++++++++-- libs/core/GP_Context.c | 25 +++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 4 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.