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 d54f2201630102b15e262536d2b99330962102a8 (commit) via c2c66545b615cbaf86e22d1ab7fc1dc9c0099d4e (commit) via aa1a11a33f69d31af0e13a5d16c46dc0edda6f53 (commit) from 62ad65536ccbc9b75e09fd80591572ebdbe509a4 (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/d54f2201630102b15e262536d2b9933096210...
commit d54f2201630102b15e262536d2b99330962102a8 Author: Cyril Hrubis metan@ucw.cz Date: Fri Nov 15 18:02:16 2013 +0100
loaders: TIFF: Fix warnings.
Fix unused warnings when compiling without the TIFF library.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_TIFF.c b/libs/loaders/GP_TIFF.c index 4443127..f9d32c8 100644 --- a/libs/loaders/GP_TIFF.c +++ b/libs/loaders/GP_TIFF.c @@ -702,8 +702,9 @@ GP_Context *GP_LoadTIFF(const char GP_UNUSED(*src_path), return NULL; }
-int GP_SaveTIFF(const GP_Context *src, const char *dst_path, - GP_ProgressCallback *callback) +int GP_SaveTIFF(const GP_Context GP_UNUSED(*src), + const char GP_UNUSED(*dst_path), + GP_ProgressCallback GP_UNUSED(*callback)) { errno = ENOSYS; return 1;
http://repo.or.cz/w/gfxprim.git/commit/c2c66545b615cbaf86e22d1ab7fc1dc9c0099...
commit c2c66545b615cbaf86e22d1ab7fc1dc9c0099d4e Author: Cyril Hrubis metan@ucw.cz Date: Fri Nov 15 17:57:53 2013 +0100
core: BlitClipped: Fix two special cases.
* When dest coordinates (x2, y2) are negative we need to clip source rectangle and not move it
* Fix off by one bugs when checking that source rectangle fits into destination context
Fixes segfaults in spiv when moving image to the bottom right corner.
Reported-by: Milan Vancura milan@ucw.cz Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/core/GP_Blit.c b/libs/core/GP_Blit.c index cb8223e..8becf61 100644 --- a/libs/core/GP_Blit.c +++ b/libs/core/GP_Blit.c @@ -72,21 +72,29 @@ void GP_BlitXYXY_Clipped(const GP_Context *src, if (y1 < y0) GP_SWAP(y0, y1);
- /* Noting to blit return now */ + /* + * Handle all cases where at least one of dest coordinates are out of + * the dest in positive direction -> src is out of dst completly. + */ if (x2 >= (GP_Coord)GP_ContextW(dst) || y2 >= (GP_Coord)GP_ContextH(dst)) return;
- /* We need to shift source rectangle */ + /* + * The coordinates in dest are negative. + * + * We need to clip the source upper left corner accordingly. + * + * Notice that x2 and y2 are inside the dst rectangle now. + * (>= 0 and < w, < h) + */ if (x2 < 0) { x0 -= x2; - x1 -= x2; x2 = 0; }
if (y2 < 0) { y0 -= y2; - y1 -= y2; y2 = 0; }
@@ -97,8 +105,8 @@ void GP_BlitXYXY_Clipped(const GP_Context *src, y1 = GP_MIN(y1, (GP_Coord)GP_ContextH(src) - 1);
/* And source rectangle fits inside of the destination */ - GP_Coord src_w = x1 - x0; - GP_Coord src_h = y1 - y0; + GP_Coord src_w = x1 - x0 + 1; + GP_Coord src_h = y1 - y0 + 1;
GP_Coord dst_w = GP_ContextW(dst) - x2; GP_Coord dst_h = GP_ContextH(dst) - y2; @@ -107,10 +115,10 @@ void GP_BlitXYXY_Clipped(const GP_Context *src, src_w, src_h, dst_w, dst_h);
if (src_w > dst_w) - x1 -= src_w - dst_w + 1; + x1 -= src_w - dst_w;
if (src_h > dst_h) - y1 -= src_h - dst_h + 1; + y1 -= src_h - dst_h;
GP_DEBUG(2, "Blitting %ix%i->%ix%i in %ux%u to %ix%i in %ux%u", x0, y0, x1, y1, GP_ContextW(src), GP_ContextH(src),
http://repo.or.cz/w/gfxprim.git/commit/aa1a11a33f69d31af0e13a5d16c46dc0edda6...
commit aa1a11a33f69d31af0e13a5d16c46dc0edda6f53 Author: Cyril Hrubis metan@ucw.cz Date: Fri Nov 15 16:53:34 2013 +0100
tests: core: A few more Blit Clipped tests.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/tests/core/BlitClipped.c b/tests/core/BlitClipped.c index 3f0ba65..1fd7bdd 100644 --- a/tests/core/BlitClipped.c +++ b/tests/core/BlitClipped.c @@ -29,10 +29,13 @@
#include <core/GP_Context.h> #include <core/GP_Blit.h> +#include <core/GP_Fill.h>
#include "tst_test.h" #include "tst_preload.h"
+#include "../filters/common.c" + struct clipped_test { /* size of the contexes */ GP_Size src_w, src_h; @@ -44,14 +47,21 @@ struct clipped_test {
/* Destination offset */ GP_Coord x1, y1; + + /* If set, is used to check assert correct result */ + const char *dst; };
static int clipped_test(struct clipped_test *test) { + int ret = TST_SUCCESS; GP_Context *src, *dst;
- src = GP_ContextAlloc(test->src_w, test->src_h, GP_PIXEL_RGB888); - dst = GP_ContextAlloc(test->dst_w, test->dst_h, GP_PIXEL_RGB888); + src = GP_ContextAlloc(test->src_w, test->src_h, GP_PIXEL_G8); + dst = GP_ContextAlloc(test->dst_w, test->dst_h, GP_PIXEL_G8); + + GP_Fill(src, 1); + GP_Fill(dst, 0);
if (!src || !dst) { tst_msg("GP_ContextAlloc() failed"); @@ -61,10 +71,15 @@ static int clipped_test(struct clipped_test *test) GP_BlitXYWH_Clipped(src, test->x0, test->y0, test->w0, test->h0, dst, test->x1, test->y1);
+ if (test->dst) { + if (compare_buffers(test->dst, dst)) + ret = TST_FAILED; + } + GP_ContextFree(src); GP_ContextFree(dst);
- return TST_SUCCESS; + return ret; }
static int clipped_test_canaries(struct clipped_test *test) @@ -130,12 +145,14 @@ static struct clipped_test off_by_one_3 = { .y1 = 1, };
+static const char empty[400] = {0}; + static struct clipped_test empty_src = { - .src_w = 100, - .src_h = 100, + .src_w = 10, + .src_h = 10,
- .dst_w = 200, - .dst_h = 200, + .dst_w = 20, + .dst_h = 20,
.x0 = 0, .y0 = 0, @@ -144,54 +161,178 @@ static struct clipped_test empty_src = {
.x1 = 0, .y1 = 0, + + .dst = empty, };
static struct clipped_test out_of_dst_1 = { - .src_w = 100, - .src_h = 100, + .src_w = 10, + .src_h = 10,
- .dst_w = 200, - .dst_h = 200, + .dst_w = 20, + .dst_h = 20,
.x0 = 0, .y0 = 0, - .w0 = 100, - .h0 = 100, + .w0 = 10, + .h0 = 10,
- .x1 = 200, + .x1 = 20, .y1 = 0, + + .dst = empty, };
static struct clipped_test out_of_dst_2 = { - .src_w = 100, - .src_h = 100, + .src_w = 10, + .src_h = 10,
- .dst_w = 200, - .dst_h = 200, + .dst_w = 20, + .dst_h = 20,
.x0 = 0, .y0 = 0, - .w0 = 100, - .h0 = 100, + .w0 = 10, + .h0 = 10,
.x1 = 0, - .y1 = 200, + .y1 = 20, + + .dst = empty, };
static struct clipped_test src_rect_out_of_src = { - .src_w = 100, - .src_h = 100, + .src_w = 10, + .src_h = 10,
- .dst_w = 200, - .dst_h = 200, + .dst_w = 20, + .dst_h = 20,
- .x0 = -100, - .y0 = -100, - .w0 = 200, - .h0 = 200, + .x0 = -10, + .y0 = -10, + .w0 = 10, + .h0 = 10,
.x1 = 0, .y1 = 0, + + .dst = empty, +}; + +static struct clipped_test dst_neg_coords1 = { + .src_w = 5, + .src_h = 5, + + .dst_w = 5, + .dst_h = 5, + + .x0 = 2, + .y0 = 2, + .w0 = 5, + .h0 = 5, + + .x1 = -2, + .y1 = -2, + + .dst = (const char []) { + 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + } +}; + +static struct clipped_test dst_big_coords = { + .src_w = 5, + .src_h = 5, + + .dst_w = 5, + .dst_h = 5, + + .x0 = 2, + .y0 = 2, + .w0 = 5, + .h0 = 5, + + .x1 = 4, + .y1 = 4, + + .dst = (const char []) { + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, + } +}; + +static struct clipped_test dst_neg_coords2 = { + .src_w = 10, + .src_h = 10, + + .dst_w = 3, + .dst_h = 3, + + .x0 = 0, + .y0 = 0, + .w0 = 8, + .h0 = 8, + + .x1 = -5, + .y1 = -5, + + .dst = (const char []) { + 1, 1, 1, + 1, 1, 1, + 1, 1, 1, + } +}; + +static struct clipped_test dst_neg_coords3 = { + .src_w = 12, + .src_h = 12, + + .dst_w = 3, + .dst_h = 3, + + .x0 = 0, + .y0 = 0, + .w0 = 10, + .h0 = 10, + + .x1 = -8, + .y1 = -8, + + .dst = (const char []) { + 1, 1, 0, + 1, 1, 0, + 0, 0, 0, + } +}; + +static struct clipped_test src_inside = { + .src_w = 3, + .src_h = 3, + + .dst_w = 5, + .dst_h = 5, + + .x0 = 0, + .y0 = 0, + .w0 = 3, + .h0 = 3, + + .x1 = 1, + .y1 = 1, + + .dst = (const char []) { + 0, 0, 0, 0, 0, + 0, 1, 1, 1, 0, + 0, 1, 1, 1, 0, + 0, 1, 1, 1, 0, + 0, 0, 0, 0, 0, + } };
const struct tst_suite tst_suite = { @@ -217,6 +358,31 @@ const struct tst_suite tst_suite = { .data = &src_rect_out_of_src, .flags = TST_CHECK_MALLOC},
+ {.name = "Dst negative coords 1", + .tst_fn = clipped_test_canaries, + .data = &dst_neg_coords1, + .flags = TST_CHECK_MALLOC}, + + {.name = "Dst negative coords 2", + .tst_fn = clipped_test_canaries, + .data = &dst_neg_coords2, + .flags = TST_CHECK_MALLOC}, + + {.name = "Dst negative coords 3", + .tst_fn = clipped_test_canaries, + .data = &dst_neg_coords3, + .flags = TST_CHECK_MALLOC}, + + {.name = "Dst big coords", + .tst_fn = clipped_test_canaries, + .data = &dst_big_coords, + .flags = TST_CHECK_MALLOC}, + + {.name = "Src inside dst", + .tst_fn = clipped_test_canaries, + .data = &src_inside, + .flags = TST_CHECK_MALLOC}, + {.name = "Regression off by one 1", .tst_fn = clipped_test_canaries, .data = &off_by_one_1,
-----------------------------------------------------------------------
Summary of changes: libs/core/GP_Blit.c | 24 ++++-- libs/loaders/GP_TIFF.c | 5 +- tests/core/BlitClipped.c | 224 ++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 214 insertions(+), 39 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.