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 a52536952b40f8337b4415fe265217c5976f2f77 (commit) from 9f1c5605ccc309bc66b098c26590a3a1e35025b2 (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/a52536952b40f8337b4415fe265217c5976f2...
commit a52536952b40f8337b4415fe265217c5976f2f77 Author: Cyril Hrubis metan@ucw.cz Date: Tue Jan 3 21:09:12 2012 +0100
gfx: Fix Anti Aliased Rectangle rotations
Silly me I should use _Raw variants.
diff --git a/include/core/GP_GetPutPixel.h b/include/core/GP_GetPutPixel.h index 0cd7661..671a16e 100644 --- a/include/core/GP_GetPutPixel.h +++ b/include/core/GP_GetPutPixel.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 * * * *****************************************************************************/
@@ -38,12 +38,13 @@ * GetPixel with context transformations and clipping. * Returns 0 for clipped pixels or pixels outside bitmap. */ -GP_Pixel GP_GetPixel(const GP_Context *context, int x, int y); +GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y);
/* * Version of GetPixel without transformations nor border checking. */ -static inline GP_Pixel GP_GetPixel_Raw(const GP_Context *context, int x, int y) +static inline GP_Pixel GP_GetPixel_Raw(const GP_Context *context, + GP_Coord x, GP_Coord y) { GP_FN_RET_PER_BPP(GP_GetPixel_Raw, context->bpp, context->bit_endian, context, x, y); @@ -52,22 +53,44 @@ static inline GP_Pixel GP_GetPixel_Raw(const GP_Context *context, int x, int y) }
/* + * Version of GetPixel without transformations and with border checking. + */ +static inline GP_Pixel GP_GetPixel_Raw_Clipped(const GP_Context *context, + GP_Coord x, GP_Coord y) +{ + if (GP_PIXEL_IS_CLIPPED(context, x, y)) + return 0; + + return GP_GetPixel_Raw(context, x, y); +} + +/* * PutPixel with context transformations and clipping. * NOP for clipped pixels or pixels outside bitmap. */ -void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p); +void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p);
/* * Version of PutPixel without transformations nor border checking. */ -static inline void GP_PutPixel_Raw(GP_Context *context, int x, int y, - GP_Pixel p) +static inline void GP_PutPixel_Raw(GP_Context *context, + GP_Coord x, GP_Coord y, GP_Pixel p) { GP_FN_PER_BPP(GP_PutPixel_Raw, context->bpp, context->bit_endian, context, x, y, p); }
/* + * Version of PutPixel without transformation and with border checking. + */ +static inline void GP_PutPixel_Raw_Clipped(GP_Context *context, + GP_Coord x, GP_Coord y, GP_Pixel p) +{ + GP_FN_PER_BPP(GP_PutPixel_Raw_Clipped, context->bpp, context->bit_endian, + context, x, y, p); +} + +/* * Returns pixel offset. */ uint8_t GP_PixelAddrOffset(GP_Coord x, GP_PixelType pixel_type); diff --git a/include/core/GP_Transform.h b/include/core/GP_Transform.h index cc6e8b4..e903d69 100644 --- a/include/core/GP_Transform.h +++ b/include/core/GP_Transform.h @@ -28,6 +28,7 @@ #ifndef CORE_GP_TRANSFORM_H #define CORE_GP_TRANSFORM_H
+#include "GP_Common.h" #include "GP_FixedPoint.h"
/* diff --git a/libs/core/GP_GetPutPixel.c b/libs/core/GP_GetPutPixel.c index 6550275..83e4ff2 100644 --- a/libs/core/GP_GetPutPixel.c +++ b/libs/core/GP_GetPutPixel.c @@ -17,13 +17,14 @@ * Boston, MA 02110-1301 USA * * * * Copyright (C) 2011 Tomas Gavenciak gavento@ucw.cz * + * Copyright (C) 2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
#include "GP_GetPutPixel.h" #include "GP_Transform.h"
-GP_Pixel GP_GetPixel(const GP_Context *context, int x, int y) +GP_Pixel GP_GetPixel(const GP_Context *context, GP_Coord x, GP_Coord y) { GP_TRANSFORM_POINT(context, x, y); if (GP_PIXEL_IS_CLIPPED(context, x, y)) @@ -31,7 +32,7 @@ GP_Pixel GP_GetPixel(const GP_Context *context, int x, int y) return GP_GetPixel_Raw(context, x, y); }
-void GP_PutPixel(GP_Context *context, int x, int y, GP_Pixel p) +void GP_PutPixel(GP_Context *context, GP_Coord x, GP_Coord y, GP_Pixel p) { GP_TRANSFORM_POINT(context, x, y); if (!GP_PIXEL_IS_CLIPPED(context, x, y)) diff --git a/libs/gfx/GP_RectAA.c b/libs/gfx/GP_RectAA.c index 4225fd0..66e24b6 100644 --- a/libs/gfx/GP_RectAA.c +++ b/libs/gfx/GP_RectAA.c @@ -53,7 +53,7 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, GP_Coord yi1 = GP_FP_FLOOR(y1);
if (xi1 >= xi0 && yi1 >= yi0) - GP_FillRect(context, xi0, yi0, xi1, yi1, pixel); + GP_FillRect_Raw(context, xi0, yi0, xi1, yi1, pixel); printf("%i %i %i %in", xi0, yi0, yi1, yi1);
@@ -67,54 +67,52 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, d_perc = GP_GammaToLinear(GP_FP_FRAC(y1));
for (i = GP_FP_CEIL(x0); i <= GP_FP_FLOOR(x1); i++) { - GP_Pixel u = GP_GetPixel(context, i, GP_FP_FLOOR(y0)); - GP_Pixel d = GP_GetPixel(context, i, GP_FP_CEIL(y1)); + GP_Pixel u = GP_GetPixel_Raw_Clipped(context, i, GP_FP_FLOOR(y0)); + GP_Pixel d = GP_GetPixel_Raw_Clipped(context, i, GP_FP_CEIL(y1)); u = GP_MixPixels(pixel, u, u_perc, context->pixel_type); d = GP_MixPixels(pixel, d, d_perc, context->pixel_type); - GP_PutPixel(context, i, GP_FP_FLOOR(y0), u); - GP_PutPixel(context, i, GP_FP_CEIL(y1), d); + GP_PutPixel_Raw_Clipped(context, i, GP_FP_FLOOR(y0), u); + GP_PutPixel_Raw_Clipped(context, i, GP_FP_CEIL(y1), d); }
u_perc = GP_GammaToLinear(GP_FP_1 - GP_FP_FRAC(x0)); d_perc = GP_GammaToLinear(GP_FP_FRAC(x1)); for (i = GP_FP_CEIL(y0); i <= GP_FP_FLOOR(y1); i++) { - GP_Pixel u = GP_GetPixel(context, GP_FP_FLOOR(x0), i); - GP_Pixel d = GP_GetPixel(context, GP_FP_CEIL(x1), i); + GP_Pixel u = GP_GetPixel_Raw_Clipped(context, GP_FP_FLOOR(x0), i); + GP_Pixel d = GP_GetPixel_Raw_Clipped(context, GP_FP_CEIL(x1), i); u = GP_MixPixels(pixel, u, u_perc, context->pixel_type); d = GP_MixPixels(pixel, d, d_perc, context->pixel_type); - GP_PutPixel(context, GP_FP_FLOOR(x0), i, u); - GP_PutPixel(context, GP_FP_CEIL(x1), i, d); + GP_PutPixel_Raw_Clipped(context, GP_FP_FLOOR(x0), i, u); + GP_PutPixel_Raw_Clipped(context, GP_FP_CEIL(x1), i, d); }
- return; - uint8_t perc; GP_Pixel p;
- perc = GP_GammaToLinear((GP_FP_FRAC(x0) + GP_FP_FRAC(y0) + 1)/2); - p = GP_GetPixel(context, GP_FP_FLOOR(x0), GP_FP_FLOOR(y0)); + perc = GP_GammaToLinear(GP_FP_1 - (GP_FP_FRAC(x0) + GP_FP_1 - GP_FP_FRAC(y0) + 2)/4); + p = GP_GetPixel_Raw_Clipped(context, GP_FP_FLOOR(x0), GP_FP_FLOOR(y0)); p = GP_MixPixels(pixel, p, perc, context->pixel_type); - GP_PutPixel(context, GP_FP_FLOOR(x0), GP_FP_FLOOR(y0), p); + GP_PutPixel_Raw_Clipped(context, GP_FP_FLOOR(x0), GP_FP_FLOOR(y0), p);
- perc = GP_GammaToLinear((GP_FP_FRAC(x1) + GP_FP_FRAC(y0) + 1)/2); - p = GP_GetPixel(context, (x1>>8) + 1, (y0>>8) - 1); + perc = GP_GammaToLinear((GP_FP_FRAC(x1) + GP_FP_1 - GP_FP_FRAC(y0) + 2)/4); + p = GP_GetPixel_Raw_Clipped(context, GP_FP_CEIL(x1), GP_FP_FLOOR(y0)); p = GP_MixPixels(pixel, p, perc, context->pixel_type); - GP_PutPixel(context, (x1>>8) + 1, (y0>>8) - 1, p); + GP_PutPixel_Raw_Clipped(context, GP_FP_CEIL(x1), GP_FP_FLOOR(y0), p);
- perc = GP_GammaToLinear((GP_FP_FRAC(x0) + GP_FP_FRAC(y1) + 1)/2); - p = GP_GetPixel(context, (x0>>8) - 1, (y1>>8) + 1); + perc = GP_GammaToLinear((GP_FP_1 - GP_FP_FRAC(x0) + GP_FP_FRAC(y1) + 2)/4); + p = GP_GetPixel_Raw_Clipped(context, GP_FP_FLOOR(x0), GP_FP_CEIL(y1)); p = GP_MixPixels(pixel, p, perc, context->pixel_type); - GP_PutPixel(context, (x0>>8) - 1, (y1>>8) + 1, p); + GP_PutPixel_Raw_Clipped(context, GP_FP_FLOOR(x0), GP_FP_CEIL(y1), p); - perc = GP_GammaToLinear((GP_FP_FRAC(x1) + GP_FP_FRAC(y1) + 1)/2); - p = GP_GetPixel(context, (x1>>8) + 1, (y1>>8) + 1); + perc = GP_GammaToLinear((GP_FP_FRAC(x1) + GP_FP_FRAC(y1) + 2)/4); + p = GP_GetPixel_Raw_Clipped(context, GP_FP_CEIL(x1), GP_FP_CEIL(y1)); p = GP_MixPixels(pixel, p, perc, context->pixel_type); - GP_PutPixel(context, (x1>>8) + 1, (y1>>8) + 1, p); + GP_PutPixel_Raw_Clipped(context, GP_FP_CEIL(x1), GP_FP_CEIL(y1), p); }
void GP_FillRectXYWH_AA_Raw(GP_Context *context, GP_Coord x, GP_Coord y, @@ -135,7 +133,7 @@ void GP_FillRectXYXY_AA(GP_Context *context, GP_Coord x0, GP_Coord y0, GP_TRANSFORM_POINT_FP(context, x0, y0); GP_TRANSFORM_POINT_FP(context, x1, y1);
- GP_FillRect_AA_Raw(context, x0, y0, x1, y1, pixel); + GP_FillRectXYXY_AA_Raw(context, x0, y0, x1, y1, pixel); }
void GP_FillRectXYWH_AA(GP_Context *context, GP_Coord x, GP_Coord y,
-----------------------------------------------------------------------
Summary of changes: include/core/GP_GetPutPixel.h | 35 +++++++++++++++++++++++++----- include/core/GP_Transform.h | 1 + libs/core/GP_GetPutPixel.c | 5 ++- libs/gfx/GP_RectAA.c | 46 +++++++++++++++++++--------------------- 4 files changed, 55 insertions(+), 32 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.