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 730f353131afe02ce53c9957b1e80009abba59e4 (commit) from 870edf9002091a710e94dd929c2e9583af590f34 (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/730f353131afe02ce53c9957b1e80009abba5...
commit 730f353131afe02ce53c9957b1e80009abba59e4 Author: Cyril Hrubis metan@ucw.cz Date: Fri Jan 6 20:36:48 2012 +0100
core: Use table for gamma correction.
diff --git a/include/core/GP_GammaCorrection.h b/include/core/GP_GammaCorrection.h index d36b1a9..c4eb3b1 100644 --- a/include/core/GP_GammaCorrection.h +++ b/include/core/GP_GammaCorrection.h @@ -34,14 +34,17 @@
#define GP_GAMMA 2.2
+extern uint8_t *GP_LinearToGamma_8bit; + /* * Coverts linear 0 255 value into 0 255 gama value. * - * (this is used for Anti Aliased gfx primitives. + * (this is used for Anti Aliased gfx primitives.) */ -static inline uint8_t GP_GammaToLinear(uint8_t val) +static inline uint8_t GP_LinearToGamma(uint8_t val) { - return pow(1.00 * val/255, 1/GP_GAMMA) * 255 + 0.5; + + return GP_LinearToGamma_8bit[val]; }
#endif /* CORE_GP_GAMMA_CORRECTION_H */ diff --git a/libs/core/Makefile b/libs/core/Makefile index 3af4933..2baef75 100644 --- a/libs/core/Makefile +++ b/libs/core/Makefile @@ -1,5 +1,6 @@ TOPDIR=../.. -GENSOURCES=GP_Pixel.gen.c GP_Blit.gen.c GP_Convert.gen.c +GENSOURCES=GP_Pixel.gen.c GP_Blit.gen.c GP_Convert.gen.c + GP_GammaCorrection.gen.c CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c)) LIBNAME=core
diff --git a/libs/gfx/GP_RectAA.c b/libs/gfx/GP_RectAA.c index 69ddd8f..a48d72e 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,
/* Special case, vertical 1px line */ if (out_x0 == out_x1) { - uint8_t mix = GP_GammaToLinear(w); + uint8_t mix = GP_LinearToGamma(w); GP_Coord i;
/* Special case 1px 100% width line */ @@ -71,7 +71,7 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
/* Special case, horizontal 1px line */ if (out_y0 == out_y1) { - uint8_t mix = GP_GammaToLinear(h); + uint8_t mix = GP_LinearToGamma(h); GP_Coord i; /* Special case 1px 100% height line */ @@ -105,7 +105,7 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
/* if the outer and innter coordinates doesn't match, draw blurred edge */ if (in_y0 != out_y0) { - uint8_t mix = GP_GammaToLinear(GP_FP_FROM_INT(in_y0) + GP_FP_1_2 - y0); + uint8_t mix = GP_LinearToGamma(GP_FP_FROM_INT(in_y0) + GP_FP_1_2 - y0); GP_Coord i; for (i = out_x0; i <= out_x1; i++) { @@ -116,7 +116,7 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, } if (in_y1 != out_y1) { - uint8_t mix = GP_GammaToLinear(y1 - GP_FP_FROM_INT(in_y0) - GP_FP_1_2); + uint8_t mix = GP_LinearToGamma(y1 - GP_FP_FROM_INT(in_y0) - GP_FP_1_2); GP_Coord i; for (i = out_x0; i <= out_x1; i++) { @@ -127,7 +127,7 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, }
if (in_x0 != out_x0) { - uint8_t mix = GP_GammaToLinear(GP_FP_FROM_INT(in_x0) + GP_FP_1_2 - x0); + uint8_t mix = GP_LinearToGamma(GP_FP_FROM_INT(in_x0) + GP_FP_1_2 - x0); GP_Coord i; for (i = out_y0; i <= out_y1; i++) { @@ -138,7 +138,7 @@ void GP_FillRectXYXY_AA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, }
if (in_x1 != out_x1) { - uint8_t mix = GP_GammaToLinear(x1 - GP_FP_FROM_INT(in_x1) - GP_FP_1_2); + uint8_t mix = GP_LinearToGamma(x1 - GP_FP_FROM_INT(in_x1) - GP_FP_1_2); GP_Coord i; for (i = out_y0; i <= out_y1; i++) {
-----------------------------------------------------------------------
Summary of changes: include/core/GP_GammaCorrection.h | 9 ++++++--- libs/core/Makefile | 3 ++- libs/gfx/GP_RectAA.c | 12 ++++++------ 3 files changed, 14 insertions(+), 10 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.