Gfxprim
Threads by month
- ----- 2026 -----
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- 929 discussions
11 May '13
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 1db276a11bc1bca52f361c7e9f7e4cf2933353d6 (commit)
from cd239b320e899c30e786fe99ce8b65c44aabf3a1 (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/1db276a11bc1bca52f361c7e9f7e4cf29333…
commit 1db276a11bc1bca52f361c7e9f7e4cf2933353d6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 11 16:21:39 2013 +0200
tests: core: More tests in BlitConv.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/tests/core/BlitConv.gen.c.t b/tests/core/BlitConv.gen.c.t
index 4338beb..3305c0e 100644
--- a/tests/core/BlitConv.gen.c.t
+++ b/tests/core/BlitConv.gen.c.t
@@ -73,11 +73,15 @@ static int check_filled(GP_Context *c, GP_Pixel p)
return 0;
}
-%% 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 GP_Pixel rgb_to_pixel(int r, int g, int b, GP_Context *c)
+{
+ if (GP_PixelHasFlags(c->pixel_type, GP_PIXEL_HAS_ALPHA))
+ return GP_RGBAToContextPixel(r, g, b, 0xff, c);
+
+ return GP_RGBToContextPixel(r, g, b, c);
+}
+
+%% macro gen_blit(name, r, g, b, pt1, pt2)
static int blit_{{ name }}_{{ pt1.name }}_to_{{ pt2.name }}(void)
{
GP_Context *src = GP_ContextAlloc(100, 100, GP_PIXEL_{{ pt1.name }});
@@ -90,17 +94,9 @@ static int blit_{{ name }}_{{ pt1.name }}_to_{{ pt2.name }}(void)
return TST_UNTESTED;
}
- /* Fill source with black, destination with pseudo random mess */
-%% 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
+ /* Fill source with color, destination with pseudo random mess */
+ GP_Pixel pix_src = rgb_to_pixel({{ r }}, {{ g }}, {{ b }}, src);
+ GP_Pixel pix_dst = rgb_to_pixel({{ r }}, {{ g }}, {{ b }}, dst);
tst_msg("pixel_src=%08x pixel_dst=%08x", pix_src, pix_dst);
@@ -114,6 +110,14 @@ static int blit_{{ name }}_{{ pt1.name }}_to_{{ pt2.name }}(void)
return TST_SUCCESS;
}
+%% endmacro
+
+%% 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()
+{{ gen_blit(name, r, g, b, pt1, pt2) }}
%% endif
%% endfor
%% endif
@@ -123,6 +127,36 @@ static int blit_{{ name }}_{{ pt1.name }}_to_{{ pt2.name }}(void)
{{ blit_color('black', '0x00', '0x00', '0x00') }}
{{ blit_color('white', '0xff', '0xff', '0xff') }}
+%% macro blit_equal_pixel(name, r, g, b)
+%% for pt1 in pixeltypes
+%% if not pt1.is_unknown() and not pt1.is_palette()
+{{ gen_blit(name, r, g, b, pt1, pt1) }}
+%% endif
+%% endfor
+%% endmacro
+
+{{ blit_equal_pixel('equal_pixel', '0x0f', '0xff', '0x00') }}
+
+%% macro gen_blit2(name, r, g, b, pname1, pname2)
+{{ gen_blit(name, r, g, b, pixeltypes_dict[pname1], pixeltypes_dict[pname2]) }}
+%% endmacro
+
+{{ gen_blit2('red', '0xff', '0x00', '0x00', 'RGB888', 'CMYK8888') }}
+{{ gen_blit2('green', '0x00', '0xff', '0x00', 'RGB888', 'CMYK8888') }}
+{{ gen_blit2('blue', '0x00', '0x00', '0xff', 'RGB888', 'CMYK8888') }}
+{{ gen_blit2('gray', '0xef', '0xef', '0xef', 'RGB888', 'CMYK8888') }}
+
+{{ gen_blit2('red', '0xff', '0x00', '0x00', 'CMYK8888', 'RGB888') }}
+{{ gen_blit2('green', '0x00', '0xff', '0x00', 'CMYK8888', 'RGB888') }}
+{{ gen_blit2('blue', '0x00', '0x00', '0xff', 'CMYK8888', 'RGB888') }}
+{{ gen_blit2('gray', '0xef', '0xef', '0xef', 'CMYK8888', 'RGB888') }}
+
+
+%% macro gen_suite_entry(name, from, to)
+ {.name = "Blit {{ from }} to {{ to }}",
+ .tst_fn = blit_{{ name }}_{{ from }}_to_{{ to }}},
+%% endmacro
+
const struct tst_suite tst_suite = {
.suite_name = "Blit Conversions Testsuite",
.tests = {
@@ -130,14 +164,31 @@ const struct tst_suite tst_suite = {
%% if not pt1.is_unknown() and not pt1.is_palette()
%% for pt2 in pixeltypes
%% if not pt2.is_unknown() and not pt2.is_palette()
- {.name = "blit black {{ pt1.name }} to {{ pt2.name }}",
+ {.name = "Blit black {{ pt1.name }} to {{ pt2.name }}",
.tst_fn = blit_black_{{ pt1.name }}_to_{{ pt2.name }}},
- {.name = "blit white {{ pt1.name }} to {{ pt2.name }}",
+ {.name = "Blit white {{ pt1.name }} to {{ pt2.name }}",
.tst_fn = blit_white_{{ pt1.name }}_to_{{ pt2.name }}},
%% endif
%% endfor
%% endif
%% endfor
+%% for pt1 in pixeltypes
+%% if not pt1.is_unknown() and not pt1.is_palette()
+ {.name = "Blit {{ pt1.name }} to {{ pt1.name }}",
+ .tst_fn = blit_equal_pixel_{{ pt1.name }}_to_{{ pt1.name }}},
+%% endif
+%% endfor
+
+{{ gen_suite_entry('red', 'RGB888', 'CMYK8888') }}
+{{ gen_suite_entry('green', 'RGB888', 'CMYK8888') }}
+{{ gen_suite_entry('blue', 'RGB888', 'CMYK8888') }}
+{{ gen_suite_entry('gray', 'RGB888', 'CMYK8888') }}
+
+{{ gen_suite_entry('red', 'CMYK8888', 'RGB888') }}
+{{ gen_suite_entry('green', 'CMYK8888', 'RGB888') }}
+{{ gen_suite_entry('blue', 'CMYK8888', 'RGB888') }}
+{{ gen_suite_entry('gray', 'CMYK8888', 'RGB888') }}
+
{.name = NULL}
}
};
-----------------------------------------------------------------------
Summary of changes:
tests/core/BlitConv.gen.c.t | 87 ++++++++++++++++++++++++++++++++++---------
1 files changed, 69 insertions(+), 18 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
11 May '13
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/cd239b320e899c30e786fe99ce8b65c44aab…
commit cd239b320e899c30e786fe99ce8b65c44aabf3a1
Author: Cyril Hrubis <metan(a)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(a)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/29839fd2b1137f294b4819d5da2eb1442997…
commit 29839fd2b1137f294b4819d5da2eb1442997dcfe
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 11 15:27:34 2013 +0200
tests: core: Cleanup BlitConv.
Signed-off-by: Cyril Hrubis <metan(a)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/74fca49d3a34a21bb5f0ce41af4b13d8b325…
commit 74fca49d3a34a21bb5f0ce41af4b13d8b32584d9
Author: Cyril Hrubis <metan(a)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(a)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/95cc2bf08aeb3596868dfab5a8ac94a5ad85…
commit 95cc2bf08aeb3596868dfab5a8ac94a5ad859ac9
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 11 15:26:14 2013 +0200
codegen: Propagate min, max to templating engine.
Signed-off-by: Cyril Hrubis <metan(a)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/c91491c8b4fe7b2bad685dcc5143ff4c309d…
commit c91491c8b4fe7b2bad685dcc5143ff4c309dda23
Author: Cyril Hrubis <metan(a)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(a)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(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
11 May '13
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 125caf8cdfeee0056f22bd69a1d4673bc08b386e (commit)
from 69fe54806e58e8f78860761e97b90d592199b665 (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/125caf8cdfeee0056f22bd69a1d4673bc08b…
commit 125caf8cdfeee0056f22bd69a1d4673bc08b386e
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sat May 11 00:31:02 2013 +0200
test: core: Add Blit Conversions tests.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/tests/core/BlitConv.gen.c.t b/tests/core/BlitConv.gen.c.t
new file mode 100644
index 0000000..6e95acc
--- /dev/null
+++ b/tests/core/BlitConv.gen.c.t
@@ -0,0 +1,174 @@
+/*****************************************************************************
+ * 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-2013 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+%% extends "base.test.c.t"
+
+%% block body
+
+#include <stdio.h>
+
+#include <core/GP_Context.h>
+#include <core/GP_Convert.h>
+#include <core/GP_GetPutPixel.h>
+#include <core/GP_Blit.h>
+
+#include "tst_test.h"
+
+static void fill_context(GP_Context *c, GP_Pixel p)
+{
+ GP_Coord x, y;
+
+ for (x = 0; x < (GP_Coord)c->w; x++)
+ for (y = 0; y < (GP_Coord)c->h; y++)
+ GP_PutPixel(c, x, y, p);
+}
+
+static void mess_context(GP_Context *c)
+{
+ GP_Coord y;
+ unsigned int i;
+
+ for (y = 0; y < (GP_Coord)c->h; y++) {
+ uint8_t *row = GP_PIXEL_ADDR(c, 0, y);
+ for (i = 0; i < c->bytes_per_row; i++) {
+ row[i] = y ^ i;
+ }
+ }
+}
+
+static int check_filled(GP_Context *c, GP_Pixel p)
+{
+ GP_Coord x, y;
+ GP_Pixel pc;
+
+ for (x = 0; x < (GP_Coord)c->w; x++) {
+ for (y = 0; y < (GP_Coord)c->h; y++) {
+ pc = GP_GetPixel(c, x, y);
+ if (p != pc) {
+ tst_msg("Pixels different %08x %08x", p, pc);
+ return 1;
+ }
+ }
+ }
+
+ 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)
+{
+ 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 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);
+ mess_context(dst);
+
+ GP_Blit(src, 0, 0, src->w, src->h, dst, 0, 0);
+
+ if (check_filled(dst, black_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;
+}
+
+%% endif
+%% endfor
+%% endif
+%% endfor
+
+const struct tst_suite tst_suite = {
+ .suite_name = "Blit Conversions Testsuite",
+ .tests = {
+%% 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()
+ {.name = "blit black {{ pt1.name }} to {{ pt2.name }}",
+ .tst_fn = blit_black_{{ pt1.name }}_to_{{ pt2.name }}},
+ {.name = "blit white {{ pt1.name }} to {{ pt2.name }}",
+ .tst_fn = blit_white_{{ pt1.name }}_to_{{ pt2.name }}},
+%% endif
+%% endfor
+%% endif
+%% endfor
+ {.name = NULL}
+ }
+};
+
+%% endblock body
diff --git a/tests/core/Makefile b/tests/core/Makefile
index 8aa4196..2fb3c86 100644
--- a/tests/core/Makefile
+++ b/tests/core/Makefile
@@ -4,9 +4,9 @@ include $(TOPDIR)/pre.mk
CSOURCES=Context.c Pixel.c
-GENSOURCES+=WritePixel.gen.c GetPutPixel.gen.c
+GENSOURCES+=WritePixel.gen.c GetPutPixel.gen.c BlitConv.gen.c
-APPS=WritePixel.gen Pixel Context GetPutPixel.gen
+APPS=WritePixel.gen Pixel Context GetPutPixel.gen BlitConv.gen
include ../tests.mk
diff --git a/tests/core/test_list.txt b/tests/core/test_list.txt
index 89cbedd..432bef9 100644
--- a/tests/core/test_list.txt
+++ b/tests/core/test_list.txt
@@ -3,3 +3,4 @@ WritePixel.gen
Context
Pixel
GetPutPixel.gen
+BlitConv.gen
-----------------------------------------------------------------------
Summary of changes:
tests/core/BlitConv.gen.c.t | 174 +++++++++++++++++++++++++++++++++++++++++++
tests/core/Makefile | 4 +-
tests/core/test_list.txt | 1 +
3 files changed, 177 insertions(+), 2 deletions(-)
create mode 100644 tests/core/BlitConv.gen.c.t
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
10 May '13
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 69fe54806e58e8f78860761e97b90d592199b665 (commit)
via f19066b7575762295fe077dd20cbd149a330578d (commit)
via 390152eb9ac9b007ca33ab4309e44ab628d04c6a (commit)
via e0f1329f8cc9daf32cd26e3cdc80d6fee0feede5 (commit)
from fafd7bf50d69b47a22775fcbb166d9c3d48c565f (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/69fe54806e58e8f78860761e97b90d592199…
commit 69fe54806e58e8f78860761e97b90d592199b665
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 15:22:05 2013 +0200
loaders: JPG: Add support for loading CMYK images.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c
index 0e04ce6..11c34d1 100644
--- a/libs/loaders/GP_JPG.c
+++ b/libs/loaders/GP_JPG.c
@@ -140,6 +140,9 @@ GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback)
case JCS_RGB:
pixel_type = GP_PIXEL_RGB888;
break;
+ case JCS_CMYK:
+ pixel_type = GP_PIXEL_CMYK8888;
+ break;
default:
pixel_type = GP_PIXEL_UNKNOWN;
}
@@ -168,22 +171,35 @@ GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback)
JSAMPROW addr = (void*)GP_PIXEL_ADDR(ret, 0, y);
jpeg_read_scanlines(&cinfo, &addr, 1);
- if (pixel_type != GP_PIXEL_RGB888)
- continue;
+ if (pixel_type == GP_PIXEL_RGB888) {
+ //TODO: fixme bigendian?
+ /* fix the pixel, as we want in fact BGR */
+ unsigned int i;
- //TODO: fixme bigendian?
- /* fix the pixel, as we want in fact BGR */
- uint32_t i;
-
- for (i = 0; i < ret->w; i++) {
- uint8_t *pix = GP_PIXEL_ADDR(ret, i, y);
- GP_SWAP(pix[0], pix[2]);
- }
+ for (i = 0; i < ret->w; i++) {
+ uint8_t *pix = GP_PIXEL_ADDR(ret, i, y);
+ GP_SWAP(pix[0], pix[2]);
+ }
- if (GP_ProgressCallbackReport(callback, y, ret->h, ret->w)) {
- GP_DEBUG(1, "Operation aborted");
- err = ECANCELED;
- goto err2;
+ if (GP_ProgressCallbackReport(callback, y, ret->h, ret->w)) {
+ GP_DEBUG(1, "Operation aborted");
+ err = ECANCELED;
+ goto err2;
+ }
+ }
+
+ if (pixel_type == GP_PIXEL_CMYK8888) {
+ unsigned int i;
+ uint8_t *buf = GP_PIXEL_ADDR(ret, 0, y);
+
+ for (i = 0; i < ret->w; i++) {
+ unsigned int j = 4 * i;
+
+ buf[j] = 0xff - buf[j];
+ buf[j+1] = 0xff - buf[j+1];
+ buf[j+2] = 0xff - buf[j+2];
+ buf[j+3] = 0xff - buf[j+3];
+ }
}
}
http://repo.or.cz/w/gfxprim.git/commit/f19066b7575762295fe077dd20cbd149a330…
commit f19066b7575762295fe077dd20cbd149a330578d
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 15:16:51 2013 +0200
core: Add initial support for CMYK8888.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/gen.txt b/doc/gen.txt
index cac6b9d..3f3c0d8 100644
--- a/doc/gen.txt
+++ b/doc/gen.txt
@@ -181,6 +181,9 @@ class PixelType(object):
def is_rgb(self):
...
+ def is_cmyk(self):
+ ...
+
def is_gray(self):
...
diff --git a/gfxprim_config.py b/gfxprim_config.py
index 1af12c9..dad4bbe 100644
--- a/gfxprim_config.py
+++ b/gfxprim_config.py
@@ -4,8 +4,8 @@
#
#
-# 2011 - Tomas Gavenciak <gavento(a)ucw.cz>
-# 2011 - Cyril Hrubis <metan(a)ucw.cz>
+# 2011 Tomas Gavenciak <gavento(a)ucw.cz>
+# 2011-2013 Cyril Hrubis <metan(a)ucw.cz>
#
# This file is sourced by all the generating scripts.
# Moreover, the generated files are sourced by almost all Gfxprim sources,
@@ -75,7 +75,16 @@ config = GfxPrimConfig(
('R', 12, 6),
('G', 6, 6),
('B', 0, 6)]),
-
+
+ #
+ # CMYK
+ #
+ PixelType(name="CMYK8888", pixelsize=PS_32BPP, chanslist=[
+ ('K', 24, 8),
+ ('Y', 16, 8),
+ ('M', 8, 8),
+ ('C', 0, 8)]),
+
#
# Palette types
#
diff --git a/include/core/GP_Convert.gen.h.t b/include/core/GP_Convert.gen.h.t
index 7dc25a9..2f59fc3 100644
--- a/include/core/GP_Convert.gen.h.t
+++ b/include/core/GP_Convert.gen.h.t
@@ -52,7 +52,25 @@
%% set c1 = pt1.chans['V']
/* {{ c2[0] }}:=V */ GP_SET_BITS({{c2[1]}}+o2, {{c2[2]}}, p2, GP_SCALE_VAL_{{c1[2]}}_{{c2[2]}}(GP_GET_BITS({{c1[1]}}+o1, {{c1[2]}}, p1))); -{# case 5: invalid mapping -#}
+{# case 5: CMYK to RGB -#}
+%% elif c2[0] in 'RGB' and pt1.is_cmyk()
+%% set K = pt1.chans['K']
+{# Get the right channel -#}
+%% if c2[0] == 'R'
+%% set V = pt1.chans['C']
+%% elif c2[0] == 'G'
+%% set V = pt1.chans['M']
+%% else
+%% set V = pt1.chans['Y']
+%% endif
+ GP_SET_BITS({{ c2[1] }}+o2, {{ c2[2] }}, p2,+ 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
diff --git a/include/core/GP_Pixel.h b/include/core/GP_Pixel.h
index ff2d710..4a0806e 100644
--- a/include/core/GP_Pixel.h
+++ b/include/core/GP_Pixel.h
@@ -97,6 +97,7 @@ typedef enum GP_PixelFlags {
GP_PIXEL_HAS_ALPHA = 0x01,
GP_PIXEL_IS_RGB = 0x02,
GP_PIXEL_IS_PALETTE = 0x04,
+ GP_PIXEL_IS_CMYK = 0x08,
GP_PIXEL_IS_GRAYSCALE = 0x10,
} GP_PixelFlags;
diff --git a/libs/core/GP_Pixel.gen.c.t b/libs/core/GP_Pixel.gen.c.t
index 7fad071..0511120 100644
--- a/libs/core/GP_Pixel.gen.c.t
+++ b/libs/core/GP_Pixel.gen.c.t
@@ -37,6 +37,7 @@ Pixel type definitions and functions
{% if pt.is_rgb() %} | GP_PIXEL_IS_RGB{% endif -%}
{% if pt.is_palette() %} | GP_PIXEL_IS_PALETTE{% endif -%}
{% if pt.is_gray() %} | GP_PIXEL_IS_GRAYSCALE{% endif -%}
+{% if pt.is_cmyk() %} | GP_PIXEL_IS_CMYK{% endif -%}
%%- endmacro
/*
diff --git a/pylib/gp_codegen/pixeltype.py b/pylib/gp_codegen/pixeltype.py
index 08e08fe..eaac404 100644
--- a/pylib/gp_codegen/pixeltype.py
+++ b/pylib/gp_codegen/pixeltype.py
@@ -58,6 +58,11 @@ class PixelType(object):
def is_gray(self):
return ('V' in self.chans)
+
+ def is_cmyk(self):
+ for i in 'CMYK':
+ if i not in self.chans: return False
+ return True
def is_alpha(self):
return ('A' in self.chans)
http://repo.or.cz/w/gfxprim.git/commit/390152eb9ac9b007ca33ab4309e44ab628d0…
commit 390152eb9ac9b007ca33ab4309e44ab628d04c6a
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 13:47:39 2013 +0200
filters; Ditherings: Make list of output fmts explicit.
Make the list of output formats explicit so that the code doesn't break
when new pixel that is not RGB nor Gray is added.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/filters/GP_FloydSteinberg.gen.c.t b/libs/filters/GP_FloydSteinberg.gen.c.t
index e10a326..fde40d9 100644
--- a/libs/filters/GP_FloydSteinberg.gen.c.t
+++ b/libs/filters/GP_FloydSteinberg.gen.c.t
@@ -46,7 +46,7 @@
%% endmacro
%% for pt in pixeltypes
-%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette()
+%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha()
/*
* Floyd Steinberg RGB888 to {{ pt.name }}
*/
@@ -127,7 +127,7 @@ int GP_FilterFloydSteinberg_RGB888_Raw(const GP_Context *src,
{
switch (dst->pixel_type) {
%% for pt in pixeltypes
-%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette()
+%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha()
case GP_PIXEL_{{ pt.name }}:
return GP_FilterFloydSteinberg_RGB888_to_{{ pt.name }}_Raw(src, dst, callback);
%% endif
diff --git a/libs/filters/GP_HilbertPeano.gen.c.t b/libs/filters/GP_HilbertPeano.gen.c.t
index 37a79d7..9c84bee 100644
--- a/libs/filters/GP_HilbertPeano.gen.c.t
+++ b/libs/filters/GP_HilbertPeano.gen.c.t
@@ -49,7 +49,7 @@ static unsigned int count_bits(unsigned int n)
}
%% for pt in pixeltypes
-%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette()
+%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha()
/*
* Hilbert Peano RGB888 to {{ pt.name }}
*/
@@ -137,7 +137,7 @@ int GP_FilterHilbertPeano_RGB888_Raw(const GP_Context *src,
{
switch (dst->pixel_type) {
%% for pt in pixeltypes
-%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette()
+%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha()
case GP_PIXEL_{{ pt.name }}:
return GP_FilterHilbertPeano_RGB888_to_{{ pt.name }}_Raw(src, dst, callback);
%% endif
http://repo.or.cz/w/gfxprim.git/commit/e0f1329f8cc9daf32cd26e3cdc80d6fee0fe…
commit e0f1329f8cc9daf32cd26e3cdc80d6fee0feede5
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 13:15:15 2013 +0200
configure: Use Popen instead of check_output
Fixes configure with Python 2.6
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/configure b/configure
index df8a74f..36450a1 100755
--- a/configure
+++ b/configure
@@ -5,7 +5,7 @@
import os
import sys
from optparse import OptionParser
-from subprocess import check_output
+import subprocess
def header_exists(cfg, filename):
fpath = cfg['include_path'][0] + '/' + filename
@@ -45,7 +45,9 @@ def python_version(cfg):
sys.stderr.write('NAn')
return ''
- res = str(check_output("%s --ldflags" % cfg['PYTHON_CONFIG'][0], shell=True))
+ cmd = subprocess.Popen([cfg['PYTHON_CONFIG'][0], '--ldflags'],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ res = str(cmd.communicate())
res = res[res.find('-lpython')+8:]
res = res[:3]
-----------------------------------------------------------------------
Summary of changes:
configure | 6 +++-
doc/gen.txt | 3 ++
gfxprim_config.py | 15 ++++++++--
include/core/GP_Convert.gen.h.t | 20 +++++++++++++-
include/core/GP_Pixel.h | 1 +
libs/core/GP_Pixel.gen.c.t | 1 +
libs/filters/GP_FloydSteinberg.gen.c.t | 4 +-
libs/filters/GP_HilbertPeano.gen.c.t | 4 +-
libs/loaders/GP_JPG.c | 44 +++++++++++++++++++++----------
pylib/gp_codegen/pixeltype.py | 5 +++
10 files changed, 79 insertions(+), 24 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
10 May '13
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 fafd7bf50d69b47a22775fcbb166d9c3d48c565f (commit)
via 26a5965f520f882cd33c837e582ac545058efbec (commit)
via f8e9023cc4fa863d5a373c86c1f998ae7185d119 (commit)
via b0c52fdb07844102bc97b887672b2bf9ff4d1d1f (commit)
via a8071e4ec58be0465c9235ee50e0bf8f136aa5c9 (commit)
via 92a84bb8701fb5d421bac2b277debdb8056d68e4 (commit)
via 3b46f61b9b1698b2711c93e746464db13a486e62 (commit)
from c7c32efcf6deac514ea58f8adef8185afc0a3788 (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/fafd7bf50d69b47a22775fcbb166d9c3d48c…
commit fafd7bf50d69b47a22775fcbb166d9c3d48c565f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 13:02:36 2013 +0200
gfx: Remove unused Line.algo.h, fix copyrights.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/gfx/GP_Line.gen.c.t b/libs/gfx/GP_Line.gen.c.t
index 668d89f..a2dbd9d 100644
--- a/libs/gfx/GP_Line.gen.c.t
+++ b/libs/gfx/GP_Line.gen.c.t
@@ -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-2012 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
diff --git a/libs/gfx/algo/Line.algo.h b/libs/gfx/algo/Line.algo.h
deleted file mode 100644
index 952598c..0000000
--- a/libs/gfx/algo/Line.algo.h
+++ /dev/null
@@ -1,81 +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(a)gmail.com> *
- * *
- * Copyright (C) 2009-2010 Cyril Hrubis <metan(a)ucw.cz> *
- * *
- *****************************************************************************/
-
-/*
- * The classical Bresenham line drawing algorithm.
- * Please see http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
- * for a nice and understandable description.
- */
-
-/*
- * This macro defines a line drawing function.
- * Arguments:
- * CONTEXT_T - user-defined type of drawing context (passed to PUTPIXEL)
- * PIXVAL_T - user-defined pixel value type (passed to PUTPIXEL)
- * PUTPIXEL - a pixel drawing function f(context, x, y, pixval)
- * FN_NAME - name of the function to be defined
- */
-#define DEF_LINE_FN(FN_NAME, CONTEXT_T, PIXVAL_T, PUTPIXEL) -void FN_NAME(CONTEXT_T context, int x0, int y0, int x1, int y1, - PIXVAL_T pixval) -{ - if (x0 == x1) { - if (y0 > y1) - GP_SWAP(y0, y1); - int y; - for (y = y0; y <= y1; y++) - PUTPIXEL(context, x0, y, pixval); - return; - } -- int steep = abs(y1 - y0) / abs(x1 - x0); - if (steep) { - GP_SWAP(x0, y0); - GP_SWAP(x1, y1); - } - if (x0 > x1) { - GP_SWAP(x0, x1); - GP_SWAP(y0, y1); - } -- int deltax = x1 - x0; - int deltay = abs(y1 - y0); - int error = deltax / 2; - int y = y0, x; - int ystep = (y0 < y1) ? 1 : -1; - for (x = x0; x <= x1; x++) { -- if (steep) - PUTPIXEL(context, y, x, pixval); - else - PUTPIXEL(context, x, y, pixval); -- error = error - deltay; - if (error < 0) { - y = y + ystep; - error = error + deltax; - } - } -}
http://repo.or.cz/w/gfxprim.git/commit/26a5965f520f882cd33c837e582ac545058e…
commit 26a5965f520f882cd33c837e582ac545058efbec
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 13:00:05 2013 +0200
gfx: Remove commented out FillCircle from Circle.c
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/gfx/GP_Circle.c b/libs/gfx/GP_Circle.c
index d8973e4..a19e98f 100644
--- a/libs/gfx/GP_Circle.c
+++ b/libs/gfx/GP_Circle.c
@@ -19,7 +19,7 @@
* Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -53,11 +53,6 @@ void GP_Circle(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
GP_Circle_Raw(context, xcenter, ycenter, r, pixel);
}
-/* #include "algo/FillCircle.algo.h" */
-
-/* Generate drawing functions for various bit depths. */
-//GP_DEF_FILL_FN_PER_BPP(GP_FillCircle_Raw, DEF_FILLCIRCLE_FN)
-
void GP_Ring_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
GP_Size r1, GP_Size r2, GP_Pixel pixel)
{
http://repo.or.cz/w/gfxprim.git/commit/f8e9023cc4fa863d5a373c86c1f998ae7185…
commit f8e9023cc4fa863d5a373c86c1f998ae7185d119
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 12:56:37 2013 +0200
tests: PNG: Add testcase for Adam7 interlacing.
* Add test for Adam7 interlacing
* Edhance a few testcases to check context
data pixel values.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/tests/loaders/PNG.c b/tests/loaders/PNG.c
index d4901ca..540e492 100644
--- a/tests/loaders/PNG.c
+++ b/tests/loaders/PNG.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -25,6 +25,7 @@
#include <sys/stat.h>
#include <core/GP_Context.h>
+#include <core/GP_GetPutPixel.h>
#include <loaders/GP_Loaders.h>
#include "tst_test.h"
@@ -57,6 +58,71 @@ static int test_load_PNG(const char *path)
return TST_SUCCESS;
}
+struct check_color_test {
+ const char *path;
+ GP_Pixel pixel;
+};
+
+static int test_load_PNG_check_color(struct check_color_test *test)
+{
+ GP_Context *img;
+
+ errno = 0;
+
+ img = GP_LoadPNG(test->path, NULL);
+
+ if (img == NULL) {
+ switch (errno) {
+ case ENOSYS:
+ tst_msg("Not Implemented");
+ return TST_SKIPPED;
+ default:
+ tst_msg("Got %s", strerror(errno));
+ return TST_FAILED;
+ }
+ }
+
+ unsigned int x, y, fail = 0;
+
+ for (x = 0; x < img->w; x++) {
+ for (y = 0; y < img->w; y++) {
+ GP_Pixel p = GP_GetPixel(img, x, y);
+
+ if (p != test->pixel) {
+ if (!fail)
+ tst_msg("First failed at %u,%u %x %x",
+ x, y, p, test->pixel);
+ fail = 1;
+ }
+ }
+ }
+
+ if (!fail)
+ tst_msg("Context pixels are correct");
+
+ GP_ContextFree(img);
+
+ if (fail)
+ return TST_FAILED;
+
+ return TST_SUCCESS;
+}
+
+static struct check_color_test white_adam7 = {
+ .path = "100x100-white-adam7.png",
+ .pixel = 0xffffff,
+};
+
+static struct check_color_test black_grayscale = {
+ .path = "100x100-black-grayscale.png",
+ .pixel = 0x000000,
+};
+
+static struct check_color_test red = {
+ .path = "100x100-red.png",
+ .pixel = 0xff0000,
+};
+
static int test_save_PNG(GP_PixelType pixel_type)
{
GP_Context *ctx;
@@ -96,9 +162,9 @@ const struct tst_suite tst_suite = {
.tests = {
/* PNG loader tests */
{.name = "PNG Load 100x100 RGB",
- .tst_fn = test_load_PNG,
+ .tst_fn = test_load_PNG_check_color,
.res_path = "data/png/valid/100x100-red.png",
- .data = "100x100-red.png",
+ .data = &red,
.flags = TST_TMPDIR | TST_CHECK_MALLOC},
{.name = "PNG Load 100x100 RGB 50% alpha",
@@ -108,9 +174,9 @@ const struct tst_suite tst_suite = {
.flags = TST_TMPDIR | TST_CHECK_MALLOC},
{.name = "PNG Load 100x100 8 bit Grayscale",
- .tst_fn = test_load_PNG,
+ .tst_fn = test_load_PNG_check_color,
.res_path = "data/png/valid/100x100-black-grayscale.png",
- .data = "100x100-black-grayscale.png",
+ .data = &black_grayscale,
.flags = TST_TMPDIR | TST_CHECK_MALLOC},
{.name = "PNG Load 100x100 8 bit Grayscale + alpha",
@@ -131,6 +197,12 @@ const struct tst_suite tst_suite = {
.data = "100x100-red-palette.png",
.flags = TST_TMPDIR | TST_CHECK_MALLOC},
+ {.name = "PNG Load 100x100 RGB Adam7",
+ .tst_fn = test_load_PNG_check_color,
+ .res_path = "data/png/valid/100x100-white-adam7.png",
+ .data = &white_adam7,
+ .flags = TST_TMPDIR | TST_CHECK_MALLOC},
+
{.name = "PNG Save 100x100 G1",
.tst_fn = test_save_PNG,
.data = (void*)GP_PIXEL_G1,
diff --git a/tests/loaders/data/png/valid/100x100-white-adam7.png b/tests/loaders/data/png/valid/100x100-white-adam7.png
new file mode 100644
index 0000000..c08b015
Binary files /dev/null and b/tests/loaders/data/png/valid/100x100-white-adam7.png differ
http://repo.or.cz/w/gfxprim.git/commit/b0c52fdb07844102bc97b887672b2bf9ff4d…
commit b0c52fdb07844102bc97b887672b2bf9ff4d1d1f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 12:23:01 2013 +0200
tests: gfx: Fix Line testsuite.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/tests/gfx/Line.c b/tests/gfx/Line.c
index 5314a90..5fcc4a3 100644
--- a/tests/gfx/Line.c
+++ b/tests/gfx/Line.c
@@ -163,10 +163,10 @@ static struct testcase testcase_line_15 = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}
};
http://repo.or.cz/w/gfxprim.git/commit/a8071e4ec58be0465c9235ee50e0bf8f136a…
commit a8071e4ec58be0465c9235ee50e0bf8f136aa5c9
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 12:18:16 2013 +0200
gfx: Move FillEllipse to template, fix special case.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/gfx/GP_Ellipse.c b/libs/gfx/GP_Ellipse.c
index a41ca5f..bd7d31b 100644
--- a/libs/gfx/GP_Ellipse.c
+++ b/libs/gfx/GP_Ellipse.c
@@ -54,28 +54,3 @@ void GP_Ellipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
GP_Ellipse_Raw(context, xcenter, ycenter, a, b, pixel);
}
-
-#include "algo/FillEllipse.algo.h"
-
-/* Generate drawing functions for various bit depths. */
-GP_DEF_FILL_FN_PER_BPP(GP_FillEllipse_Raw, DEF_FILLELLIPSE_FN)
-
-void GP_FillEllipse_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, GP_Pixel pixel)
-{
- GP_CHECK_CONTEXT(context);
-
- GP_FN_PER_BPP_CONTEXT(GP_FillEllipse_Raw, context, context,
- xcenter, ycenter, a, b, pixel);
-}
-
-void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
- GP_Size a, GP_Size b, GP_Pixel pixel)
-{
- GP_CHECK_CONTEXT(context);
-
- GP_TRANSFORM_POINT(context, xcenter, ycenter);
- GP_TRANSFORM_SWAP(context, a, b);
-
- GP_FillEllipse_Raw(context, xcenter, ycenter, a, b, pixel);
-}
diff --git a/libs/gfx/algo/FillEllipse.algo.h b/libs/gfx/GP_FillEllipse.gen.c.t
similarity index 56%
rename from libs/gfx/algo/FillEllipse.algo.h
rename to libs/gfx/GP_FillEllipse.gen.c.t
index 76da4bd..aed7d1f 100644
--- a/libs/gfx/algo/FillEllipse.algo.h
+++ b/libs/gfx/GP_FillEllipse.gen.c.t
@@ -19,10 +19,22 @@
* Copyright (C) 2009-2010 Jiri "BlueBear" Dluhos *
* <jiri.bluebear.dluhos(a)gmail.com> *
* *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
+%% extends "base.c.t"
+
+{% block descr %}A filled ellipse drawing algorithm.{% endblock %}
+
+%% block body
+
+#include "core/GP_GetPutPixel.h"
+#include "core/GP_FnPerBpp.h"
+#include "gfx/GP_HLine.h"
+#include "gfx/GP_VLine.h"
+#include "gfx/GP_Ellipse.h"
+
/*
* A filled ellipse drawing algorithm.
*
@@ -32,32 +44,55 @@
* we just iterate X until Y reaches next line, and then draw the full line.
*/
-/*
- * This macro defines a filled ellipse drawing function.
- * Arguments:
- * CONTEXT_T - user-defined type of drawing context (passed to HLINE)
- * PIXVAL_T - user-defined pixel value type (passed to HLINE)
- * HLINE - horizontal line drawing function f(context, x0, x1, y, pixval)
- * FN_NAME - name of the function to be defined
- */
-#define DEF_FILLELLIPSE_FN(FN_NAME, CONTEXT_T, PIXVAL_T, HLINE) -static void FN_NAME(CONTEXT_T context, int xcenter, int ycenter, - unsigned int a, unsigned int b, PIXVAL_T pixval) -{ - /* Precompute quadratic terms. */ - int a2 = a*a; - int b2 = b*b; -- int x, y, error; - for (x = 0, error = -b2*a, y = b; y >= 0; y--) { - while (error < 0) { - error += b2 * (2*x + 1); - x++; - } - error += a2 * (-2*y + 1); -- /* Draw two horizontal lines reflected across Y. */ - HLINE(context, xcenter-x+1, xcenter+x-1, ycenter-y, pixval); - HLINE(context, xcenter-x+1, xcenter+x-1, ycenter+y, pixval); - } +%% for ps in pixelsizes
+
+static void GP_FillEllipse_Raw_{{ ps.suffix }}(GP_Context *context, GP_Coord xcenter,
+ GP_Coord ycenter, GP_Size a, GP_Size b, GP_Pixel pixel)
+{
+ /* Precompute quadratic terms. */
+ int a2 = a*a;
+ int b2 = b*b;
+
+ /* Handle special case */
+ if (a == 0) {
+ GP_VLine_Raw_{{ ps.suffix }}(context, xcenter, ycenter - b, ycenter + b, pixel);
+ return;
+ }
+
+ int x, y, error;
+ for (x = 0, error = -b2*a, y = b; y >= 0; y--) {
+ while (error < 0) {
+ error += b2 * (2*x + 1);
+ x++;
+ }
+ error += a2 * (-2*y + 1);
+
+ /* Draw two horizontal lines reflected across Y. */
+ GP_HLine_Raw_{{ ps.suffix }}(context, xcenter-x+1, xcenter+x-1, ycenter-y, pixel);
+ GP_HLine_Raw_{{ ps.suffix }}(context, xcenter-x+1, xcenter+x-1, ycenter+y, pixel);
+ }
}
+
+%% endfor
+
+void GP_FillEllipse_Raw(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size a, GP_Size b, GP_Pixel pixel)
+{
+ GP_CHECK_CONTEXT(context);
+
+ GP_FN_PER_BPP_CONTEXT(GP_FillEllipse_Raw, context, context,
+ xcenter, ycenter, a, b, pixel);
+}
+
+void GP_FillEllipse(GP_Context *context, GP_Coord xcenter, GP_Coord ycenter,
+ GP_Size a, GP_Size b, GP_Pixel pixel)
+{
+ GP_CHECK_CONTEXT(context);
+
+ GP_TRANSFORM_POINT(context, xcenter, ycenter);
+ GP_TRANSFORM_SWAP(context, a, b);
+
+ GP_FillEllipse_Raw(context, xcenter, ycenter, a, b, pixel);
+}
+
+%% endblock body
diff --git a/libs/gfx/Makefile b/libs/gfx/Makefile
index 4511495..8ffe38a 100644
--- a/libs/gfx/Makefile
+++ b/libs/gfx/Makefile
@@ -3,7 +3,8 @@ include $(TOPDIR)/pre.mk
CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
GENSOURCES=GP_Line.gen.c GP_HLine.gen.c GP_LineAA.gen.c GP_PutPixelAA.gen.c - GP_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c
+ GP_HLineAA.gen.c GP_VLineAA.gen.c GP_FillCircle.gen.c GP_VLine.gen.c + GP_FillEllipse.gen.c
LIBNAME=gfx
include $(TOPDIR)/gen.mk
http://repo.or.cz/w/gfxprim.git/commit/92a84bb8701fb5d421bac2b277debdb8056d…
commit 92a84bb8701fb5d421bac2b277debdb8056d68e4
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 12:13:18 2013 +0200
gfx: FillCircle: Add GPL header, sort out includes.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/gfx/GP_FillCircle.gen.c.t b/libs/gfx/GP_FillCircle.gen.c.t
index 90c18c7..ac4c6ce 100644
--- a/libs/gfx/GP_FillCircle.gen.c.t
+++ b/libs/gfx/GP_FillCircle.gen.c.t
@@ -1,13 +1,39 @@
+/*****************************************************************************
+ * 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-2012 Jiri "BlueBear" Dluhos *
+ * <jiri.bluebear.dluhos(a)gmail.com> *
+ * *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
%% extends "base.c.t"
-{% block descr %}Circle filling algorithm{% endblock %}
+{% block descr %}A filled circle drawing algorithm.{% endblock %}
%% block body
#include "core/GP_GetPutPixel.h"
+#include "core/GP_Transform.h"
#include "core/GP_FnPerBpp.h"
-#include "gfx/GP_Circle.h"
#include "gfx/GP_HLine.h"
+#include "gfx/GP_Circle.h"
/*
* A filled circle drawing algorithm.
http://repo.or.cz/w/gfxprim.git/commit/3b46f61b9b1698b2711c93e746464db13a48…
commit 3b46f61b9b1698b2711c93e746464db13a486e62
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 11:45:17 2013 +0200
tests: gfx: Add FillEllipse testsuite.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/tests/gfx/FillEllipse.c b/tests/gfx/FillEllipse.c
new file mode 100644
index 0000000..84bb7d7
--- /dev/null
+++ b/tests/gfx/FillEllipse.c
@@ -0,0 +1,367 @@
+/*****************************************************************************
+ * 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-2013 Cyril Hrubis <metan(a)ucw.cz> *
+ * *
+ *****************************************************************************/
+
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+
+#include <core/GP_Context.h>
+#include <gfx/GP_Ellipse.h>
+
+#include "tst_test.h"
+
+#include "common.h"
+
+struct testcase {
+ /* cicle description */
+ GP_Coord x;
+ GP_Coord y;
+ GP_Size a;
+ GP_Size b;
+
+ /* expected result */
+ GP_Size w, h;
+ const char pixmap[];
+};
+
+static int test_ellipse(const struct testcase *t)
+{
+ GP_Context *c;
+ int err;
+
+ c = GP_ContextAlloc(t->w, t->h, GP_PIXEL_G8);
+
+ if (c == NULL) {
+ tst_err("Failed to allocate context");
+ return TST_UNTESTED;
+ }
+
+ /* zero the pixels buffer */
+ memset(c->pixels, 0, c->w * c->h);
+
+ GP_FillEllipse(c, t->x, t->y, t->a, t->b, 1);
+
+ err = compare_buffers(t->pixmap, c);
+
+ if (err)
+ return TST_FAILED;
+
+ return TST_SUCCESS;
+}
+
+static struct testcase testcase_ellipse_a0_b0 = {
+ .x = 2,
+ .y = 2,
+ .a = 0,
+ .b = 0,
+
+ .w = 5,
+ .h = 5,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a1_b0 = {
+ .x = 2,
+ .y = 2,
+ .a = 1,
+ .b = 0,
+
+ .w = 5,
+ .h = 5,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a0_b1 = {
+ .x = 2,
+ .y = 2,
+ .a = 0,
+ .b = 1,
+
+ .w = 5,
+ .h = 5,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a1_b1 = {
+ .x = 2,
+ .y = 2,
+ .a = 1,
+ .b = 1,
+
+ .w = 5,
+ .h = 5,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0,
+ 0, 1, 1, 1, 0,
+ 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a2_b1 = {
+ .x = 3,
+ .y = 3,
+ .a = 2,
+ .b = 1,
+
+ .w = 7,
+ .h = 7,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 1, 1, 1, 1, 1, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a1_b2 = {
+ .x = 3,
+ .y = 3,
+ .a = 1,
+ .b = 2,
+
+ .w = 7,
+ .h = 7,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a2_b2 = {
+ .x = 3,
+ .y = 3,
+ .a = 2,
+ .b = 2,
+
+ .w = 7,
+ .h = 7,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 0,
+ 0, 0, 1, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a1_b3 = {
+ .x = 4,
+ .y = 4,
+ .a = 1,
+ .b = 3,
+
+ .w = 9,
+ .h = 9,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a3_b2 = {
+ .x = 4,
+ .y = 4,
+ .a = 3,
+ .b = 2,
+
+ .w = 9,
+ .h = 9,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a3_b3 = {
+ .x = 4,
+ .y = 4,
+ .a = 3,
+ .b = 3,
+
+ .w = 9,
+ .h = 9,
+
+ .pixmap = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 1, 1, 1, 1, 1, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a6_b6_clip = {
+ .x = 0,
+ .y = 0,
+ .a = 6,
+ .b = 6,
+
+ .w = 8,
+ .h = 8,
+
+ .pixmap = {
+ 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0,
+ 1, 1, 1, 1, 1, 0, 0, 0,
+ 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+static struct testcase testcase_ellipse_a5_b5_clip = {
+ .x = 0,
+ .y = 5,
+ .a = 5,
+ .b = 5,
+
+ .w = 11,
+ .h = 11,
+
+ .pixmap = {
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ }
+};
+
+const struct tst_suite tst_suite = {
+ .suite_name = "FillEllipse Testsuite",
+ .tests = {
+ {.name = "FillEllipse a=0 b=0",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a0_b0},
+
+ {.name = "FillEllipse a=1 b=0",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a1_b0},
+
+ {.name = "FillEllipse a=0 b=1",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a0_b1},
+
+ {.name = "FillEllipse a=1 b=1",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a1_b1},
+
+ {.name = "FillEllipse a=2 b=1",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a2_b1},
+
+ {.name = "FillEllipse a=1 b=2",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a1_b2},
+
+ {.name = "FillEllipse a=2 b=2",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a2_b2},
+
+ {.name = "FillEllipse a=1 b=3",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a1_b3},
+
+ {.name = "FillEllipse a=3 b=2",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a3_b2},
+
+ {.name = "FillEllipse a=3 b=3",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a3_b3},
+
+ {.name = "FillEllipse a=5 b=5 clipped",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a5_b5_clip},
+
+ {.name = "FillEllipse a=6 b=6 clipped",
+ .tst_fn = test_ellipse,
+ .data = &testcase_ellipse_a6_b6_clip},
+
+ {.name = NULL}
+ }
+};
diff --git a/tests/gfx/Makefile b/tests/gfx/Makefile
index cf845f6..2094107 100644
--- a/tests/gfx/Makefile
+++ b/tests/gfx/Makefile
@@ -5,11 +5,12 @@ CSOURCES=$(filter-out $(wildcard *.gen.c),$(wildcard *.c))
GENSOURCES=APICoverage.gen.c
APPS=gfx_benchmark Circle FillCircle Line CircleSeg Polygon Ellipse HLine- VLine PutPixelAA HLineAA LineAA APICoverage.gen
+ VLine PutPixelAA HLineAA LineAA APICoverage.gen FillEllipse
Circle: common.o
FillCircle: common.o
Ellipse: common.o
+FillEllipse: common.o
Line: common.o
CircleSeg: common.o
Polygon: common.o
diff --git a/tests/gfx/test_list.txt b/tests/gfx/test_list.txt
index 8070210..ff64600 100644
--- a/tests/gfx/test_list.txt
+++ b/tests/gfx/test_list.txt
@@ -8,6 +8,7 @@ Line
Circle
FillCircle
Ellipse
+FillEllipse
CircleSeg
Polygon
-----------------------------------------------------------------------
Summary of changes:
libs/gfx/GP_Circle.c | 7 +-
libs/gfx/GP_Ellipse.c | 25 -----
libs/gfx/GP_FillCircle.gen.c.t | 30 ++++++-
.../FillEllipse.algo.h => GP_FillEllipse.gen.c.t} | 93 ++++++++++++------
libs/gfx/GP_Line.gen.c.t | 4 +-
libs/gfx/Makefile | 3 +-
libs/gfx/algo/Line.algo.h | 81 ----------------
tests/gfx/{Ellipse.c => FillEllipse.c} | 102 ++++++++++----------
tests/gfx/Line.c | 8 +-
tests/gfx/Makefile | 3 +-
tests/gfx/test_list.txt | 1 +
tests/loaders/PNG.c | 82 +++++++++++++++-
.../loaders/data/png/valid/100x100-white-adam7.png | Bin 0 -> 346 bytes
13 files changed, 232 insertions(+), 207 deletions(-)
rename libs/gfx/{algo/FillEllipse.algo.h => GP_FillEllipse.gen.c.t} (56%)
delete mode 100644 libs/gfx/algo/Line.algo.h
copy tests/gfx/{Ellipse.c => FillEllipse.c} (78%)
create mode 100644 tests/loaders/data/png/valid/100x100-white-adam7.png
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
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 c7c32efcf6deac514ea58f8adef8185afc0a3788 (commit)
from 3966bfc09a6af79182519c6083f6beb085ef26e0 (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/c7c32efcf6deac514ea58f8adef8185afc0a…
commit c7c32efcf6deac514ea58f8adef8185afc0a3788
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri May 10 11:36:09 2013 +0200
loaders: PNG: Fix Adam7 interlacing handling.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index b1b725d..ce03c85 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
- * Copyright (C) 2009-2012 Cyril Hrubis <metan(a)ucw.cz> *
+ * Copyright (C) 2009-2013 Cyril Hrubis <metan(a)ucw.cz> *
* *
*****************************************************************************/
@@ -106,7 +106,7 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback)
int depth, color_type, interlace_type;
GP_PixelType pixel_type = GP_PIXEL_UNKNOWN;
GP_Context *res;
- int err;
+ int err, passes = 1;
double gamma;
png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -148,6 +148,9 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback)
color_type & PNG_COLOR_MASK_ALPHA ? " with alpha channel" : "",
(unsigned int)w, (unsigned int)h, depth, gamma);
+ if (interlace_type == PNG_INTERLACE_ADAM7)
+ passes = png_set_interlace_handling(png);
+
switch (color_type) {
case PNG_COLOR_TYPE_GRAY:
switch (depth) {
@@ -233,19 +236,26 @@ GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback)
png_set_packswap(png);
uint32_t y;
-
- /* start the actuall reading */
- for (y = 0; y < h; y++) {
- png_bytep row = GP_PIXEL_ADDR(res, 0, y);
- png_read_row(png, row, NULL);
-
- if (GP_ProgressCallbackReport(callback, y, h, w)) {
- GP_DEBUG(1, "Operation aborted");
- err = ECANCELED;
- goto err3;
+ int p;
+
+ /*
+ * Do the actuall reading.
+ *
+ * The passes are needed for adam7 interlacing.
+ */
+ for (p = 0; p < passes; p++) {
+ for (y = 0; y < h; y++) {
+ png_bytep row = GP_PIXEL_ADDR(res, 0, y);
+ png_read_row(png, row, NULL);
+
+ if (GP_ProgressCallbackReport(callback, y + h * p, h * passes, w)) {
+ GP_DEBUG(1, "Operation aborted");
+ err = ECANCELED;
+ goto err3;
+ }
}
}
-
+
png_destroy_read_struct(&png, &png_info, NULL);
GP_ProgressCallbackDone(callback);
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_PNG.c | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
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 3966bfc09a6af79182519c6083f6beb085ef26e0 (commit)
from f39dce582400e88f7b034f0612d2c4352dac43f2 (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/3966bfc09a6af79182519c6083f6beb085ef…
commit 3966bfc09a6af79182519c6083f6beb085ef26e0
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu May 9 23:36:58 2013 +0200
doc: Update index.html
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/index.html b/doc/index.html
index 034386f..905c1b7 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -28,10 +28,12 @@
</div>
<div id="menu">
<ul class="menu-tree">
- <li class="menu-tree-item"><a href="index.html">Home</a></li>
- <li class="menu-tree-item"><a href="api.html">API</a></li>
- <li class="menu-tree-item"><a href="examples.html">Code Examples</a></li>
- <li class="menu-tree-item"><a href="http://repo.or.cz/w/gfxprim.git">GIT</a></li>
+ <li class="menu-tree-item"><a href="general.html">C API</a></li>
+ <li class="menu-tree-item"><a href="core_python.html">Pyton API</a></li>
+ <li class="menu-tree-item"><a href="http://www.ucw.cz/mailman/listinfo/gfxprim">Mailing List</a></li>
+ <li class="menu-tree-item"><a href="https://github.com/gfxprim/gfxprim">GIT (GitHub)</a></li>
+ <li class="menu-tree-item"><a href="http://repo.or.cz/w/gfxprim.git">GIT (repo.or.cz)</a></li>
+ <li class="menu-tree-item"><a href="releases/gfxprim_1.0.0-rc0.tar.bz2">Download 1.0.0-rc0</a></li>
</ul>
</div>
<div id="content">
@@ -46,21 +48,26 @@
</p>
<h3>About</h3>
<p>
- Once upon the time <i>GFXprim</i> had started as an simple attempt to
- replace SDL_gfx which was unusable at the time we started. Soon it outgrew
- the initial purpose and yielded into library that could be used as
- replacement for SDL library. In contrast with SDL <i>GFXprim</i> is
+ Once upon the time <i>GFXprim</i> has started as a simple attempt to
+ replace SDL_gfx which was unusable then. Soon it outgrew the initial
+ purpose and yielded into a library that could be used as a replacement
+ for the family of SDL libraries. In contrast with SDL <i>GFXprim</i> is
not aiming for abstracting the operating system interface. Instead of
- that <i>GFXprim</i> provides means for keeping the system dependent
- parts in well defined and isolated parts.
+ that <i>GFXprim</i> provides means for keeping the system dependent parts
+ in well defined and isolated parts.
</p>
<p>
- One of the key points of the library is code generation. Most of the
+ One of the key points of the library are code generators. Most of the
graphics operations are written using <a href="http://jinja.pocoo.org/">jinja</a>
- templating engine which is used to generate specialized C code. So,
+ templating engine which is used to create specialized C code. So,
for an example, once you add pixel definition into configuration file,
creating specialized filters, loaders and conversions to other pixel
- formats is just a matter of typing "make && make clean".
+ formats is just a matter of typing "make rebuild".
+ </p>
+ <h3>Documentation</h3>
+ <p>
+ For more information about features and API look at the
+ <a href="general.html">documentation</a>.
</p>
<h3>News</h3>
<p>
@@ -73,21 +80,12 @@
We do have a <a href="http://www.ucw.cz/mailman/listinfo/gfxprim">mailing list</a>
and although there is not much of discussion now, we are there and listening.
</p>
- <h3>Documentation</h3>
- <p>
- For more information about internal structure and features look at the
- <a href="api.html">API Description</a>.
- </p>
- <p>
- There are also some nice C and Python
- <a href="examples.html">Code Examples</a>.
- </p>
</div>
<div id="cleaner"> </div>
<div id="footer">
- <a href="http://repo.or.cz/w/gfxprim.git">git</a> |
- <a href="http://atrey.karlin.mff.cuni.cz/~gavento/GfxPrimWiki/">wiki</a> |
- <a href="http://www.ucw.cz/mailman/listinfo/gfxprim">mailing list</a>
+ <a href="http://repo.or.cz/w/gfxprim.git">repo.or.cz</a> |
+ <a href="https://github.com/gfxprim/gfxprim">GitHub</a> |
+ <a href="http://www.ucw.cz/mailman/listinfo/gfxprim">Mailing List</a>
</div>
</div>
</body>
-----------------------------------------------------------------------
Summary of changes:
doc/index.html | 48 +++++++++++++++++++++++-------------------------
1 files changed, 23 insertions(+), 25 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
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 f39dce582400e88f7b034f0612d2c4352dac43f2 (commit)
from e791f1daa4c76016f0b45d3c827d253d4e1c7543 (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/f39dce582400e88f7b034f0612d2c4352dac…
commit f39dce582400e88f7b034f0612d2c4352dac43f2
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu May 9 23:35:50 2013 +0200
install: Fix make install for empty prefix.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/Makefile b/Makefile
index 1ffbe41..a2b327d 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,9 @@ LIB_LOC=/usr/lib/
install:
ifdef VERBOSE
- ./install.sh $(prefix) $(libdir) $(bindir) $(includedir)
+ ./install.sh "$(prefix)" $(libdir) $(bindir) $(includedir)
else
- @./install.sh $(prefix) $(libdir) $(bindir) $(includedir)
+ @./install.sh "$(prefix)" $(libdir) $(bindir) $(includedir)
endif
tar:
-----------------------------------------------------------------------
Summary of changes:
Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
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 e791f1daa4c76016f0b45d3c827d253d4e1c7543 (commit)
via bac2f525ff902e173977fda2a4c0faa7c907772f (commit)
from 844154a505d8a3b7dc68fdd8d7294bb202178d5f (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/e791f1daa4c76016f0b45d3c827d253d4e1c…
commit e791f1daa4c76016f0b45d3c827d253d4e1c7543
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu May 9 19:38:28 2013 +0200
build: pywrap: Reorder LDLIBS for pywrap too.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/pywrap.mk b/pywrap.mk
index 70bc835..0df0f10 100644
--- a/pywrap.mk
+++ b/pywrap.mk
@@ -32,10 +32,10 @@ endif # VERBOSE
$(SWIG_LIB): $(SWIG_C)
ifdef VERBOSE
- $(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared $(LDLIBS_GP) $(LDLIBS) -L$(TOPDIR)/build/ -o $@
+ $(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared $(LDLIBS) $(LDLIBS_GP) -L$(TOPDIR)/build/ -o $@
else # VERBOSE
@echo "LD $@"
- @$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared $(LDLIBS_GP) $(LDLIBS) -L$(TOPDIR)/build/ -o $@
+ @$(CC) $< $(CFLAGS) -D_GNU_SOURCE=1 $(LDFLAGS) $(PYTHON_INCLUDE) --shared $(LDLIBS) $(LDLIBS_GP) -L$(TOPDIR)/build/ -o $@
endif # VERBOSE
# Install python libraries into right places
http://repo.or.cz/w/gfxprim.git/commit/bac2f525ff902e173977fda2a4c0faa7c907…
commit bac2f525ff902e173977fda2a4c0faa7c907772f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu May 9 10:50:33 2013 +0200
doc: Update index.html (as we have release).
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/index.html b/doc/index.html
index 7dcc996..034386f 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -62,16 +62,16 @@
creating specialized filters, loaders and conversions to other pixel
formats is just a matter of typing "make && make clean".
</p>
+ <h3>News</h3>
<p>
- The code is stored in <a href="http://repo.or.cz/w/gfxprim.git">git</a>
- and although we haven't done release yet; first alpha release may be done
- later this year once rest of the API stabilizes (the core code has been
- stable for quite some time).
+ <h4>The GFXprim version 1.0.0-rc0 has been released!</h4>
+ Download <a href="http://gfxprim.ucw.cz/releases/gfxprim_1.0.0-rc0.tar.bz2">GFXprim 1.0.0-rc0</a> tarball (without docs).
+ Or get the code from directly from <a href="http://github.com/gfxprim/gfxprim/">github</a>.
</p>
<h3>Contact</h3>
<p>
We do have a <a href="http://www.ucw.cz/mailman/listinfo/gfxprim">mailing list</a>
- and although there not much of discussion there now, we are there and listening.
+ and although there is not much of discussion now, we are there and listening.
</p>
<h3>Documentation</h3>
<p>
-----------------------------------------------------------------------
Summary of changes:
doc/index.html | 10 +++++-----
pywrap.mk | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0
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 844154a505d8a3b7dc68fdd8d7294bb202178d5f (commit)
via 38ba95e6006053cac3c57afd7f76e4ffa6ac184b (commit)
via 6742058090751f838d9adf757d5e5a3e1e722345 (commit)
via ac86a572b0244636fbf7f2748a72059ae1b3b1eb (commit)
from 834cc1ebc413ddcae710eda665917661f2c7e71e (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/844154a505d8a3b7dc68fdd8d7294bb20217…
commit 844154a505d8a3b7dc68fdd8d7294bb202178d5f
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Thu May 9 10:39:31 2013 +0200
build: Update list of exported syms.
After input drivers were moved to backends
the symbols needs to be moved too.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/build/syms/Backend_symbols.txt b/build/syms/Backend_symbols.txt
index 322c627..74e2967 100644
--- a/build/syms/Backend_symbols.txt
+++ b/build/syms/Backend_symbols.txt
@@ -19,3 +19,6 @@ GP_BackendFlip
GP_BackendWaitEvent
GP_BackendPollEvent
+GP_InputDriverX11EventPut
+GP_InputDriverX11Init
+GP_InputDriverSDLEventPut
diff --git a/build/syms/Input_symbols.txt b/build/syms/Input_symbols.txt
index 0368dc2..de44378 100644
--- a/build/syms/Input_symbols.txt
+++ b/build/syms/Input_symbols.txt
@@ -2,10 +2,7 @@ GP_EventKeyName
GP_EventDump
GP_InputDriverLinuxRead
-GP_InputDriverSDLEventPut
GP_InputDriverLinuxOpen
-GP_InputDriverX11EventPut
-GP_InputDriverX11Init
GP_InputDriverLinuxClose
GP_InputDriverKBDEventPut
http://repo.or.cz/w/gfxprim.git/commit/38ba95e6006053cac3c57afd7f76e4ffa6ac…
commit 38ba95e6006053cac3c57afd7f76e4ffa6ac184b
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed May 8 23:35:28 2013 +0200
install: Fix symlink creation.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/install.sh b/install.sh
index 0213ab8..0b3020a 100755
--- a/install.sh
+++ b/install.sh
@@ -30,7 +30,7 @@ for i in build/*.so build/*.so.* build/*.a; do
if [ -L "$i" ]; then
TARGET=`basename "$i"`
SOURCE=`readlink "$i"`
- (cd "$LIB_LOC" && rm -f "$TARGET" && ln -s "$LIB_LOC$SOURCE" "$TARGET")
+ (cd "$LIB_LOC" && rm -f "$TARGET" && ln -s "$SOURCE" "$TARGET")
else
install "$i" "$LIB_LOC"
fi
http://repo.or.cz/w/gfxprim.git/commit/6742058090751f838d9adf757d5e5a3e1e72…
commit 6742058090751f838d9adf757d5e5a3e1e722345
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed May 8 22:29:50 2013 +0200
loaders: gif: Fix build with giflib > 5.0.0
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_GIF.c b/libs/loaders/GP_GIF.c
index 8eba747..b8554e8 100644
--- a/libs/loaders/GP_GIF.c
+++ b/libs/loaders/GP_GIF.c
@@ -67,7 +67,11 @@ int GP_OpenGIF(const char *src_path, void **f)
errno = 0;
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+ gf = DGifOpenFileName(src_path, NULL);
+#else
gf = DGifOpenFileName(src_path);
+#endif
if (gf == NULL) {
/*
@@ -138,6 +142,16 @@ static const char *gif_err_name(int err)
}
}
+static int gif_err(GifFileType *gf)
+{
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+ return gf->Error;
+#else
+ (void) gf;
+ return GifLastError();
+#endif
+}
+
static int read_extensions(GifFileType *gf)
{
uint8_t *gif_ext_ptr;
@@ -147,7 +161,7 @@ static int read_extensions(GifFileType *gf)
if (DGifGetExtension(gf, &gif_ext_type, &gif_ext_ptr) != GIF_OK) {
GP_DEBUG(1, "DGifGetExtension() error %s (%i)",
- gif_err_name(GifLastError()), GifLastError());
+ gif_err_name(gif_err(gf)), gif_err(gf));
return EIO;
}
@@ -156,7 +170,7 @@ static int read_extensions(GifFileType *gf)
do {
if (DGifGetExtensionNext(gf, &gif_ext_ptr) != GIF_OK) {
GP_DEBUG(1, "DGifGetExtension() error %s (%i)",
- gif_err_name(GifLastError()), GifLastError());
+ gif_err_name(gif_err(gf)), gif_err(gf));
return EIO;
}
@@ -254,7 +268,7 @@ GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback)
if (DGifGetRecordType(gf, &rec_type) != GIF_OK) {
//TODO: error handling
GP_DEBUG(1, "DGifGetRecordType() error %s (%i)",
- gif_err_name(GifLastError()), GifLastError());
+ gif_err_name(gif_err(gf)), gif_err(gf));
err = EIO;
goto err1;
}
@@ -276,7 +290,7 @@ GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback)
if (DGifGetImageDesc(gf) != GIF_OK) {
//TODO: error handling
GP_DEBUG(1, "DGifGetImageDesc() error %s (%i)",
- gif_err_name(GifLastError()), GifLastError());
+ gif_err_name(gif_err(gf)), gif_err(gf));
err = EIO;
goto err1;
}
http://repo.or.cz/w/gfxprim.git/commit/ac86a572b0244636fbf7f2748a72059ae1b3…
commit ac86a572b0244636fbf7f2748a72059ae1b3b1eb
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Wed May 8 18:27:55 2013 +0200
install: Add bindir, libdir and includedir configure opts.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/Makefile b/Makefile
index bfd39a6..1ffbe41 100644
--- a/Makefile
+++ b/Makefile
@@ -30,9 +30,9 @@ LIB_LOC=/usr/lib/
install:
ifdef VERBOSE
- ./install.sh ""
+ ./install.sh $(prefix) $(libdir) $(bindir) $(includedir)
else
- @./install.sh ""
+ @./install.sh $(prefix) $(libdir) $(bindir) $(includedir)
endif
tar:
diff --git a/configure b/configure
index 894664f..df8a74f 100755
--- a/configure
+++ b/configure
@@ -209,7 +209,17 @@ def basic_checks(cfg):
cfg['PYTHON_VER'][0] = python_version(cfg)
- sys.stderr.write("n")
+ if cfg['libdir'][0] == '':
+ sys.stderr.write("Checking for lib directory ... ")
+
+ if os.path.isdir(cfg['prefix'][0] + '/usr/lib64'):
+ cfg['libdir'][0] = '/usr/lib64'
+ else:
+ cfg['libdir'][0] = '/usr/lib'
+
+ sys.stderr.write(cfg['libdir'][0] + 'n');
+
+ sys.stderr.write('n')
#
# Write configuration files
@@ -284,7 +294,10 @@ if __name__ == '__main__':
'PYTHON_CONFIG' : ['python-config', 'Python config helper'],
'PYTHON_VER' : ['', 'Python version (derived from python config)'],
'include_path' : ['/usr/include', 'Path to the system headers'],
- 'prefix' : ['/usr', 'Installation prefix']}
+ 'prefix' : ['', 'Installation prefix'],
+ 'bindir' : ['/usr/bin', 'Where to install binaries'],
+ 'libdir' : ['', 'Where to install libraries'],
+ 'includedir' : ['/usr/include', 'Where to install headers']}
#
# Library detection/enable disable
diff --git a/install.sh b/install.sh
index fef3703..0213ab8 100755
--- a/install.sh
+++ b/install.sh
@@ -1,30 +1,24 @@
#!/bin/sh
-INSTALL_PREFIX="$1"
+PREFIX="$1"
+LIBDIR="$2"
+BINDIR="$3"
+INCLUDEDIR="$4"
-if test -z "$INSTALL_PREFIX"; then
- INSTALL_PREFIX="/usr"
-fi
-
-HEADER_LOC="$INSTALL_PREFIX/include/"
-if [ -d $INSTALL_PREFIX/lib64 ]; then
- LIB_LOC="$INSTALL_PREFIX/lib64/"
-else
- LIB_LOC="$INSTALL_PREFIX/lib/"
-fi
-
-BIN_LOC="$INSTALL_PREFIX/bin/"
+HEADER_LOC="$PREFIX/$INCLUDEDIR"
+LIB_LOC="$PREFIX/$LIBDIR"
+BIN_LOC="$PREFIX/$BINDIR"
# Headers
echo "INSTALL headers ($HEADER_LOC)"
-install -m 775 -d "${HEADER_LOC}GP"
+install -m 775 -d "${HEADER_LOC}/GP"
for i in `ls include/`; do
if [ -d "include/$i" ]; then
echo " $i"
- install -m 775 -d "${HEADER_LOC}GP/$i"
- install -m 664 "include/$i/"*.h "${HEADER_LOC}GP/$i"
+ install -m 775 -d "${HEADER_LOC}/GP/$i"
+ install -m 664 "include/$i/"*.h "${HEADER_LOC}/GP/$i"
else
- install -m 664 "include/$i" "${HEADER_LOC}GP/$i"
+ install -m 664 "include/$i" "${HEADER_LOC}/GP/$i"
fi
done
@@ -44,5 +38,6 @@ done
# Binaries
echo "INSTALL binaries"
+install -m 775 -d "$BIN_LOC"
install -m 755 gfxprim-config "$BIN_LOC"
install -m 755 demos/spiv/spiv "$BIN_LOC"
diff --git a/pyinst.mk b/pyinst.mk
index 38d08ef..f1323b6 100644
--- a/pyinst.mk
+++ b/pyinst.mk
@@ -6,13 +6,7 @@
ifdef SWIG
ifdef PYTHON_CONFIG
-# Detect /usr/lib64 vs /usr/lib
-LIBDIR=$(findstring lib64,$(wildcard $(prefix)/*))
-ifeq ($(LIBDIR),)
-LIBDIR=lib
-endif
-
-PY_INSTALL_PREFIX=$(prefix)/$(LIBDIR)/python$(PYTHON_VER)/gfxprim/$(LIBNAME)
+PY_INSTALL_PREFIX=$(prefix)/$(libdir)/python$(PYTHON_VER)/gfxprim/$(LIBNAME)
ifdef DESTDIR
PY_INSTALL_PREFIX:=$(DESTDIR)$(PY_INSTALL_PREFIX)
-----------------------------------------------------------------------
Summary of changes:
Makefile | 4 ++--
build/syms/Backend_symbols.txt | 3 +++
build/syms/Input_symbols.txt | 3 ---
configure | 17 +++++++++++++++--
install.sh | 31 +++++++++++++------------------
libs/loaders/GP_GIF.c | 22 ++++++++++++++++++----
pyinst.mk | 8 +-------
7 files changed, 52 insertions(+), 36 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
1
0