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 cd239b320e899c30e786fe99ce8b65c44aabf3a1 (commit) via 29839fd2b1137f294b4819d5da2eb1442997dcfe (commit) via 74fca49d3a34a21bb5f0ce41af4b13d8b32584d9 (commit) via 95cc2bf08aeb3596868dfab5a8ac94a5ad859ac9 (commit) via c91491c8b4fe7b2bad685dcc5143ff4c309dda23 (commit) from 125caf8cdfeee0056f22bd69a1d4673bc08b386e (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/cd239b320e899c30e786fe99ce8b65c44aabf...
commit cd239b320e899c30e786fe99ce8b65c44aabf3a1 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 11 15:42:57 2013 +0200
core: Convert: Fix XXX -> XXXA conversion.
The alpha for blits from XXX -> XXXA wasn't filled propery. Was filled with number of bytes rather than with the maximal value.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/core/GP_Convert.gen.h.t b/include/core/GP_Convert.gen.h.t index 89cbe50..7a7397e 100644 --- a/include/core/GP_Convert.gen.h.t +++ b/include/core/GP_Convert.gen.h.t @@ -64,7 +64,7 @@ GP_SCALE_VAL_{{c1[2]}}_{{c2[2]}}(GP_GET_BITS({{c1[1]}}+o1, {{c1[2]}}, p1))); {# case 2: set A to full opacity (not present in source) -#} %% elif c2[0]=='A' - /* A:={{ hex(c2[2]) }} */GP_SET_BITS({{c2[1]}}+o2, {{c2[2]}}, p2, {{ hex(c2[2]) }}); + /* A:={{ hex(c2[2]) }} */GP_SET_BITS({{c2[1]}}+o2, {{c2[2]}}, p2, {{ hex(2 ** c2[2] - 1) }}); {# case 3: calculate V as average of RGB -#} %% elif c2[0]=='V' and pt1.is_rgb() /* V:=RGB_avg */ GP_SET_BITS({{c2[1]}}+o2, {{c2[2]}}, p2, ( http://repo.or.cz/w/gfxprim.git/commit/29839fd2b1137f294b4819d5da2eb1442997d...
commit 29839fd2b1137f294b4819d5da2eb1442997dcfe Author: Cyril Hrubis metan@ucw.cz Date: Sat May 11 15:27:34 2013 +0200
tests: core: Cleanup BlitConv.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/core/BlitConv.gen.c.t b/tests/core/BlitConv.gen.c.t index 6e95acc..4338beb 100644 --- a/tests/core/BlitConv.gen.c.t +++ b/tests/core/BlitConv.gen.c.t @@ -73,11 +73,12 @@ static int check_filled(GP_Context *c, GP_Pixel p) return 0; }
-%% for pt1 in pixeltypes -%% if not pt1.is_unknown() and not pt1.is_palette() -%% for pt2 in pixeltypes -%% if not pt2.is_unknown() and not pt2.is_palette() -static int blit_black_{{ pt1.name }}_to_{{ pt2.name }}(void) +%% macro blit_color(name, r, g, b) +%% for pt1 in pixeltypes +%% if not pt1.is_unknown() and not pt1.is_palette() +%% for pt2 in pixeltypes +%% if not pt2.is_unknown() and not pt2.is_palette() +static int blit_{{ name }}_{{ pt1.name }}_to_{{ pt2.name }}(void) { GP_Context *src = GP_ContextAlloc(100, 100, GP_PIXEL_{{ pt1.name }}); GP_Context *dst = GP_ContextAlloc(100, 100, GP_PIXEL_{{ pt2.name }}); @@ -90,67 +91,37 @@ static int blit_black_{{ pt1.name }}_to_{{ pt2.name }}(void) }
/* Fill source with black, destination with pseudo random mess */ -%% if pt1.is_alpha() - GP_Pixel black_src = GP_RGBAToContextPixel(0, 0, 0, 0xff, src); -%% else - GP_Pixel black_src = GP_RGBToContextPixel(0, 0, 0, src); -%% endif -%% if pt2.is_alpha() - GP_Pixel black_dst = GP_RGBAToContextPixel(0, 0, 0, 0xff, src); -%% else - GP_Pixel black_dst = GP_RGBToContextPixel(0, 0, 0, dst); -%% endif - - fill_context(src, black_src); +%% if pt1.is_alpha() + GP_Pixel pix_src = GP_RGBAToContextPixel({{ r }}, {{ g }}, {{ b }}, 0xff, src); +%% else + GP_Pixel pix_src = GP_RGBToContextPixel({{ r }}, {{ g }}, {{ b }}, src); +%% endif +%% if pt2.is_alpha() + GP_Pixel pix_dst = GP_RGBAToContextPixel({{ r }}, {{ g }}, {{ b }}, 0xff, dst); +%% else + GP_Pixel pix_dst = GP_RGBToContextPixel({{ r }}, {{ g }}, {{ b }}, dst); +%% endif + + tst_msg("pixel_src=%08x pixel_dst=%08x", pix_src, pix_dst); + + fill_context(src, pix_src); mess_context(dst);
GP_Blit(src, 0, 0, src->w, src->h, dst, 0, 0);
- if (check_filled(dst, black_dst)) + if (check_filled(dst, pix_dst)) return TST_FAILED;
return TST_SUCCESS; } - -static int blit_white_{{ pt1.name }}_to_{{ pt2.name }}(void) -{ - GP_Context *src = GP_ContextAlloc(100, 100, GP_PIXEL_{{ pt1.name }}); - GP_Context *dst = GP_ContextAlloc(100, 100, GP_PIXEL_{{ pt2.name }}); - - if (src == NULL || dst == NULL) { - GP_ContextFree(src); - GP_ContextFree(dst); - tst_msg("Malloc failed :("); - return TST_UNTESTED; - } - - /* Fill source with white, destination with pseudo random mess */ -%% if pt1.is_alpha() - GP_Pixel white_src = GP_RGBAToContextPixel(0xff, 0xff, 0xff, 0xff, src); -%% else - GP_Pixel white_src = GP_RGBToContextPixel(0xff, 0xff, 0xff, src); %% endif -%% if pt2.is_alpha() - GP_Pixel white_dst = GP_RGBAToContextPixel(0xff, 0xff, 0xff, 0xff, src); -%% else - GP_Pixel white_dst = GP_RGBToContextPixel(0xff, 0xff, 0xff, dst); -%% endif - - fill_context(src, white_src); - mess_context(dst); - - GP_Blit(src, 0, 0, src->w, src->h, dst, 0, 0); - - if (check_filled(dst, white_dst)) - return TST_FAILED; - - return TST_SUCCESS; -} +%% endfor +%% endif +%% endfor +%% endmacro
-%% endif -%% endfor -%% endif -%% endfor +{{ blit_color('black', '0x00', '0x00', '0x00') }} +{{ blit_color('white', '0xff', '0xff', '0xff') }}
const struct tst_suite tst_suite = { .suite_name = "Blit Conversions Testsuite",
http://repo.or.cz/w/gfxprim.git/commit/74fca49d3a34a21bb5f0ce41af4b13d8b3258...
commit 74fca49d3a34a21bb5f0ce41af4b13d8b32584d9 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 11 15:26:59 2013 +0200
core: Convert: Add experimental RGB -> CMYK.
BEWARE UNTESTED.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/core/GP_Convert.gen.h.t b/include/core/GP_Convert.gen.h.t index 2f59fc3..89cbe50 100644 --- a/include/core/GP_Convert.gen.h.t +++ b/include/core/GP_Convert.gen.h.t @@ -25,12 +25,37 @@
{% block descr %}Convert PixelType values macros and functions{% endblock %}
+{# RGB -> CMYK requires special handling #} +%% macro rgb_to_cmyk(in, out) +%% set R = in.chans['R'] +%% set G = in.chans['G'] +%% set B = in.chans['B'] +%% set C = out.chans['C'] +%% set M = out.chans['M'] +%% set Y = out.chans['Y'] +%% set K = out.chans['K'] +%% set max_bits = max(R[2], G[2], B[2]) +%% set max_val = 2 ** max_bits - 1 + GP_Pixel _R = GP_SCALE_VAL_{{ R[2] }}_{{ max_bits }}(GP_GET_BITS({{ R[1] }}+o1, {{ R[2] }}, p1)); + GP_Pixel _G = GP_SCALE_VAL_{{ G[2] }}_{{ max_bits }}(GP_GET_BITS({{ G[1] }}+o1, {{ G[2] }}, p1)); + GP_Pixel _B = GP_SCALE_VAL_{{ B[2] }}_{{ max_bits }}(GP_GET_BITS({{ B[1] }}+o1, {{ B[2] }}, p1)); + GP_Pixel _K = GP_MAX3(_R, _G, _B); + GP_SET_BITS({{ C[1] }}+o2, {{ C[2] }}, p2, GP_SCALE_VAL_{{ max_bits }}_{{ C[2] }}((_K - _R))); + GP_SET_BITS({{ M[1] }}+o2, {{ M[2] }}, p2, GP_SCALE_VAL_{{ max_bits }}_{{ M[2] }}((_K - _G))); + GP_SET_BITS({{ Y[1] }}+o2, {{ Y[2] }}, p2, GP_SCALE_VAL_{{ max_bits }}_{{ Y[2] }}((_K - _B))); + GP_SET_BITS({{ K[1] }}+o2, {{ K[2] }}, p2, GP_SCALE_VAL_{{ max_bits }}_{{ K[2] }}({{ max_val }} - _K)); +%% endmacro + %% macro GP_Pixel_TYPE_TO_TYPE(pt1, pt2) /*** {{ pt1.name }} -> {{ pt2.name }} *** * macro reads p1 ({{ pt1.name }} at bit-offset o1) * and writes to p2 ({{ pt2.name }} at bit-offset o2) * the relevant part of p2 is assumed to be cleared (zero) */ #define GP_Pixel_{{ pt1.name }}_TO_{{ pt2.name }}_OFFSET(p1, o1, p2, o2) do { +{# special cases -#} +%% if pt1.is_rgb() and pt2.is_cmyk() +{{ rgb_to_cmyk(pt1, pt2) -}} +%% else %% for c2 in pt2.chanslist {# case 1: just copy a channel -#} %% if c2[0] in pt1.chans.keys() @@ -67,14 +92,12 @@ GP_SCALE_VAL_{{ K[2] + V[2] }}_{{ c2[2] }}( (({{ 2 ** K[2] - 1 }} - GP_GET_BITS({{ K[1] }}+o1, {{ K[2] }}, p1)) * ({{ 2 ** V[2] - 1 }} - GP_GET_BITS({{ V[1] }}+o1, {{ V[2] }}, p1))))); -{# case 6: RGB to CMYK -#} -%% elif c2[0] in 'CMYK' and pt1.is_rgb() - /* TODO */ {# case 7: invalid mapping -#} %% else {{ error('Channel conversion ' + pt1.name + ' to ' + pt2.name + ' not supported.') }} %% endif %% endfor +%% endif } while (0)
/* a version without offsets */
http://repo.or.cz/w/gfxprim.git/commit/95cc2bf08aeb3596868dfab5a8ac94a5ad859...
commit 95cc2bf08aeb3596868dfab5a8ac94a5ad859ac9 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 11 15:26:14 2013 +0200
codegen: Propagate min, max to templating engine.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/pylib/gp_codegen/render_utils.py b/pylib/gp_codegen/render_utils.py index b4ca701..be9b32d 100644 --- a/pylib/gp_codegen/render_utils.py +++ b/pylib/gp_codegen/render_utils.py @@ -36,6 +36,8 @@ def create_environment(config, template_dir): env.globals['int'] = int; env.globals['float'] = float; env.globals['round'] = round; + env.globals['min'] = min; + env.globals['max'] = max; return env
http://repo.or.cz/w/gfxprim.git/commit/c91491c8b4fe7b2bad685dcc5143ff4c309dd...
commit c91491c8b4fe7b2bad685dcc5143ff4c309dda23 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 11 15:25:18 2013 +0200
core: Common: Add MAX3(a, b, c) macro.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/include/core/GP_Common.h b/include/core/GP_Common.h index 5a779c0..17d61b8 100644 --- a/include/core/GP_Common.h +++ b/include/core/GP_Common.h @@ -52,6 +52,16 @@ })
/* + * Returns maximum from three numbers. + */ +#define GP_MAX3(a, b, c) ({ + typeof(a) _a = (a); + typeof(b) _b = (b); + typeof(c) _c = (c); + _a > _b ? (_a > _c ? _a : _c) : (_b > _c ? _b : _c); +}) + +/* * Returns absolute value. */ #define GP_ABS(a) ({ -----------------------------------------------------------------------
Summary of changes: include/core/GP_Common.h | 10 +++++ include/core/GP_Convert.gen.h.t | 31 ++++++++++++-- pylib/gp_codegen/render_utils.py | 2 + tests/core/BlitConv.gen.c.t | 83 ++++++++++++------------------------- 4 files changed, 66 insertions(+), 60 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.