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, generate has been updated via 24db76060a41a8d3abb75c57e552d9a784bf5948 (commit) from 8a21bc6f957aa940853da65d443afdb21be9b891 (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/24db76060a41a8d3abb75c57e552d9a784bf5...
commit 24db76060a41a8d3abb75c57e552d9a784bf5948 Author: Cyril Hrubis metan@ucw.cz Date: Mon Jul 25 14:47:44 2011 +0200
Removed clipping rectangle in preparation for subcontext.
diff --git a/include/core/GP_Clip.h b/include/core/GP_Clip.h deleted file mode 100644 index a6e5261..0000000 --- a/include/core/GP_Clip.h +++ /dev/null @@ -1,51 +0,0 @@ -/***************************************************************************** - * 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-2010 Jiri "BlueBear" Dluhos * - * jiri.bluebear.dluhos@gmail.com * - * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * - * * - *****************************************************************************/ - -#ifndef GP_CLIP_H -#define GP_CLIP_H - -/* - * Clipping rectanle mirroring and rotations. - */ -#define GP_MIRROR_V_CLIP(context) do { - typeof(context->clip_w_min) _clip_w_min = context->clip_w_min; - - context->clip_w_min = context->w - context->clip_w_max; - context->clip_w_max = context->w - _clip_w_min; -} while (0) - -#define GP_MIRROR_H_CLIP(context) do { - typeof(context->clip_h_min) _clip_h_min = context->clip_h_min; - - context->clip_h_min = context->h - context->clip_h_max; - context->clip_h_max = context->h - _clip_h_min; -} while (0) - -#define GP_SWAP_CLIPS(context) do { - GP_SWAP(context->clip_w_min, context->clip_h_min); - GP_SWAP(context->clip_w_max, context->clip_h_max); -} while (0) - -#endif /* GP_CLIP_H */ diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h index 2e640da..4bffd66 100644 --- a/include/core/GP_Context.h +++ b/include/core/GP_Context.h @@ -16,10 +16,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -38,8 +38,8 @@ typedef struct GP_Context { uint8_t *pixels; /* pointer to image pixels */ uint8_t bpp; /* values: 1, 2, 4, 8, 16, 24, 32 */ uint32_t bytes_per_row; - uint32_t w; /* width */ - uint32_t h; /* height */ + uint32_t w; /* width in pixels */ + uint32_t h; /* height in pixels */
GP_PixelType pixel_type; /* hardware pixel format */
@@ -50,12 +50,6 @@ typedef struct GP_Context { uint8_t x_swap:1; /* swap direction on x */ uint8_t y_swap:1; /* swap direction on y */ uint8_t bit_endian:1; /* GP_BIT_ENDIAN */ - - /* clipping rectangle; drawing functions only affect the inside */ - uint32_t clip_w_min; - uint32_t clip_w_max; - uint32_t clip_h_min; - uint32_t clip_h_max; } GP_Context;
/* Returns the pixel type used by the context. */ @@ -82,22 +76,14 @@ static inline GP_PixelType GP_GetContextPixelType(const GP_Context *context) GP_CHECK(context->pixels, "invalid context: NULL image pointer"); GP_CHECK(context->bpp <= 32, "invalid context: unsupported bits-per-pixel count"); GP_CHECK(context->w > 0 && context->h > 0, "invalid context: invalid image size"); - GP_CHECK(context->clip_w_min <= context->clip_w_max - && context->clip_h_min <= context->clip_h_max, - "invalid context: invalid clipping rectangle"); - GP_CHECK(context->clip_w_max < context->w - && context->clip_h_max < context->h, - "invalid context: clipping rectangle larger than image"); } while (0)
/* - * Is true, when pixel is clipped. + * Is true, when pixel is clipped out of context. */ #define GP_PIXEL_IS_CLIPPED(context, x, y) - (x < (int) context->clip_w_min - || x > (int) context->clip_w_max - || y < (int) context->clip_h_min - || y > (int) context->clip_h_max) + ((x) < 0 || x >= (int) context->w + || (y) < 0 || y >= (int) context->h) /* * Allocate context. diff --git a/libs/SDL/GP_SDL_Context.c b/libs/SDL/GP_SDL_Context.c index e8b7500..3378d3b 100644 --- a/libs/SDL/GP_SDL_Context.c +++ b/libs/SDL/GP_SDL_Context.c @@ -57,11 +57,5 @@ GP_RetCode GP_SDL_ContextFromSurface(GP_Context *context, SDL_Surface *surf) context->x_swap = 0; context->y_swap = 0;
- /* clipping */ - context->clip_h_min = surf->clip_rect.y; - context->clip_h_max = surf->clip_rect.y + surf->clip_rect.h - 1; - context->clip_w_min = surf->clip_rect.x; - context->clip_w_max = surf->clip_rect.x + surf->clip_rect.w - 1; - return GP_ESUCCESS; } diff --git a/libs/backends/GP_Backend_SDL.c b/libs/backends/GP_Backend_SDL.c index c3fd9ac..a0a40e6 100644 --- a/libs/backends/GP_Backend_SDL.c +++ b/libs/backends/GP_Backend_SDL.c @@ -77,12 +77,6 @@ inline GP_RetCode GP_SDL_ContextFromSurface( context->x_swap = 0; context->y_swap = 0;
- /* clipping */ - context->clip_h_min = surf->clip_rect.y; - context->clip_h_max = surf->clip_rect.y + surf->clip_rect.h - 1; - context->clip_w_min = surf->clip_rect.x; - context->clip_w_max = surf->clip_rect.x + surf->clip_rect.w - 1; - return GP_ESUCCESS; }
diff --git a/libs/core/GP_Context.c b/libs/core/GP_Context.c index 1660d25..58c6a0b 100644 --- a/libs/core/GP_Context.c +++ b/libs/core/GP_Context.c @@ -16,10 +16,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -63,12 +63,6 @@ GP_Context *GP_ContextCopy(GP_Context *context, int flag) new->y_swap = context->y_swap; new->x_swap = context->x_swap;
- /* clipping */ - new->clip_w_min = context->clip_w_min; - new->clip_w_max = context->clip_w_max; - new->clip_h_min = context->clip_h_min; - new->clip_h_max = context->clip_h_max; - return new; } @@ -102,12 +96,6 @@ GP_Context *GP_ContextAlloc(uint32_t w, uint32_t h, GP_PixelType type) context->y_swap = 0; context->x_swap = 0;
- /* clipping */ - context->clip_w_min = 0; - context->clip_w_max = w - 1; - context->clip_h_min = 0; - context->clip_h_max = h - 1; - return context; }
diff --git a/libs/core/GP_GetPutPixel.c b/libs/core/GP_GetPutPixel.c index 9cac910..774be54 100644 --- a/libs/core/GP_GetPutPixel.c +++ b/libs/core/GP_GetPutPixel.c @@ -34,6 +34,6 @@ GP_Pixel GP_GetPixel(const GP_Context *context, int x, int y) void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p) { GP_TRANSFORM_POINT(context, x, y); - if (! GP_PIXEL_IS_CLIPPED(context, x, y)) + if (!GP_PIXEL_IS_CLIPPED(context, x, y)) GP_PutPixel_Raw(context, x, y, p); } diff --git a/libs/filters/GP_Rotate.c b/libs/filters/GP_Rotate.c index adb0ce2..6967514 100644 --- a/libs/filters/GP_Rotate.c +++ b/libs/filters/GP_Rotate.c @@ -51,8 +51,6 @@ GP_RetCode GP_MirrorH(GP_Context *context) memcpy(l2, buf, bpr); }
- GP_MIRROR_H_CLIP(context); - return GP_ESUCCESS; }
diff --git a/libs/filters/algo/GP_MirrorV.algo.h b/libs/filters/algo/GP_MirrorV.algo.h index 3ea1438..6555700 100644 --- a/libs/filters/algo/GP_MirrorV.algo.h +++ b/libs/filters/algo/GP_MirrorV.algo.h @@ -16,16 +16,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#include "core/GP_Clip.h" - #define DEF_MIRRORV_FN(FN_NAME, CONTEXT_T, PIXEL_T, PUTPIXEL, GETPIXEL) void FN_NAME(CONTEXT_T context) { @@ -41,6 +39,4 @@ void FN_NAME(CONTEXT_T context) PUTPIXEL(context, xm, y, tmp); } } -- GP_MIRROR_V_CLIP(context); } diff --git a/libs/filters/algo/GP_Rotate.algo.h b/libs/filters/algo/GP_Rotate.algo.h index e6ea14d..bc7528d 100644 --- a/libs/filters/algo/GP_Rotate.algo.h +++ b/libs/filters/algo/GP_Rotate.algo.h @@ -16,14 +16,13 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
-#include "core/GP_Clip.h" #include "core/GP_Common.h" #include "core/GP_Context.h"
@@ -52,9 +51,6 @@ GP_RetCode FN_NAME(CONTEXT_T context) GP_ContextFree(tmp); - GP_SWAP_CLIPS(context); - GP_MIRROR_H_CLIP(context); - return GP_ESUCCESS; }
@@ -83,8 +79,5 @@ GP_RetCode FN_NAME(CONTEXT_T context) GP_ContextFree(tmp); - GP_SWAP_CLIPS(context); - GP_MIRROR_V_CLIP(context); - return GP_ESUCCESS; } diff --git a/libs/gfx/algo/Circle.algo.h b/libs/gfx/algo/Circle.algo.h index 96eb3b4..f5f5acc 100644 --- a/libs/gfx/algo/Circle.algo.h +++ b/libs/gfx/algo/Circle.algo.h @@ -16,10 +16,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
diff --git a/libs/gfx/algo/HLine.algo.h b/libs/gfx/algo/HLine.algo.h index a62ae50..91dd35f 100644 --- a/libs/gfx/algo/HLine.algo.h +++ b/libs/gfx/algo/HLine.algo.h @@ -16,10 +16,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -28,16 +28,14 @@ /* Ensures that coordinates are in correct order, and clips them. * Exits immediately if the line is completely clipped out. */ -#define ORDER_AND_CLIP_COORDS do { - if (x0 > x1) GP_SWAP(x0, x1); - if (y < (int) context->clip_h_min - || y > (int) context->clip_h_max - || x0 > (int) context->clip_w_max - || x1 < (int) context->clip_w_min) { - return; - } - x0 = GP_MAX(x0, (int) context->clip_w_min); - x1 = GP_MIN(x1, (int) context->clip_w_max); +#define ORDER_AND_CLIP_COORDS do { + if (x0 > x1) + GP_SWAP(x0, x1); + if (y < 0 || y >= (int) context->h || + x1 < 0 || x0 >= (int) context->w) + return; + x0 = GP_MAX(x0, 0); + x1 = GP_MIN(x1, (int) context->w - 1); } while (0)
/* diff --git a/libs/gfx/algo/VLine.algo.h b/libs/gfx/algo/VLine.algo.h index daa6f9d..b33a448 100644 --- a/libs/gfx/algo/VLine.algo.h +++ b/libs/gfx/algo/VLine.algo.h @@ -16,10 +16,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos * + * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2010 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -28,16 +28,14 @@ /* Ensures that coordinates are in correct order, and clips them. * Exits immediately if the line is completely clipped out. */ -#define ORDER_AND_CLIP_COORDS do { - if (y0 > y1) GP_SWAP(y0, y1); - if (x < (int) context->clip_w_min - || x > (int) context->clip_w_max - || y1 < (int) context->clip_h_min - || y0 > (int) context->clip_h_max) { - return; - } - y0 = GP_MAX(y0, (int) context->clip_h_min); - y1 = GP_MIN(y1, (int) context->clip_h_max); +#define ORDER_AND_CLIP_COORDS do { + if (y0 > y1) + GP_SWAP(y0, y1); + if (x < 0 || x >= (int) context->w || + y1 < 0 || y0 >= (int) context->h) + return; + y0 = GP_MAX(y0, 0); + y1 = GP_MIN(y1, (int) context->h - 1); } while (0)
/*
-----------------------------------------------------------------------
Summary of changes: include/core/GP_Clip.h | 51 ----------------------------------- include/core/GP_Context.h | 28 +++++-------------- libs/SDL/GP_SDL_Context.c | 6 ---- libs/backends/GP_Backend_SDL.c | 6 ---- libs/core/GP_Context.c | 16 +--------- libs/core/GP_GetPutPixel.c | 2 +- libs/filters/GP_Rotate.c | 2 - libs/filters/algo/GP_MirrorV.algo.h | 8 +---- libs/filters/algo/GP_Rotate.algo.h | 11 +------ libs/gfx/algo/Circle.algo.h | 4 +- libs/gfx/algo/HLine.algo.h | 22 +++++++-------- libs/gfx/algo/VLine.algo.h | 22 +++++++-------- 12 files changed, 36 insertions(+), 142 deletions(-) delete mode 100644 include/core/GP_Clip.h
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.