pixman: Branch 'master' - 3 commits
Søren Sandmann Pedersen
sandmann at kemper.freedesktop.org
Wed Jun 24 09:31:35 PDT 2009
pixman/pixman-utils.c | 14 ++++-----
test/oob-test.c | 74 +++++++++++++++++++++++++++++++++++++-------------
2 files changed, 62 insertions(+), 26 deletions(-)
New commits:
commit 53ada03119d44984775877f2a2fee5ce442ac1c8
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed Jun 24 12:10:48 2009 -0400
Add a table to oob-test so that it can test more than one setup.
diff --git a/test/oob-test.c b/test/oob-test.c
index fc93156..921ffb6 100644
--- a/test/oob-test.c
+++ b/test/oob-test.c
@@ -3,34 +3,70 @@
#include "pixman.h"
#include "utils.h"
-int
-main (int argc, char **argv)
+typedef struct
{
-#define DWIDTH 3
-#define DHEIGHT 6
-#define DSTRIDE 16
+ int width;
+ int height;
+ int stride;
+ pixman_format_code_t format;
+
+} image_info_t;
-#define SWIDTH 5
-#define SHEIGHT 7
-#define SSTRIDE 20
+typedef struct
+{
+ pixman_op_t op;
- uint32_t *src = malloc (SHEIGHT * SSTRIDE);
- uint32_t *dest = malloc (DHEIGHT * DSTRIDE);
- pixman_image_t *simg, *dimg;
+ image_info_t src;
+ image_info_t dest;
+
+ int src_x;
+ int src_y;
+ int dest_x;
+ int dest_y;
+ int width;
+ int height;
+} composite_info_t;
+const composite_info_t info[] =
+{
+ { PIXMAN_OP_SRC, { 3, 6, 16, PIXMAN_a8r8g8b8 }, { 5, 7, 20, PIXMAN_x8r8g8b8 }, 1, 8, 1, -1, 1, 8 },
+ { PIXMAN_OP_SRC, { 7, 5, 36, PIXMAN_a8r8g8b8 }, { 6, 5, 28, PIXMAN_x8r8g8b8 }, 8, 5, 5, 3, 1, 2 },
+};
+
+static pixman_image_t *
+make_image (const image_info_t *info)
+{
+ char *data = malloc (info->stride * info->height);
int i;
- for (i = 0; i < (SHEIGHT * SSTRIDE) / 4; ++i)
- src[i] = 0x7f007f00;
+ for (i = 0; i < info->height * info->stride; ++i)
+ data[i] = (i % 255) ^ (((i % 16) << 4) | (i & 0xf0));
- for (i = 0; i < (DHEIGHT * DSTRIDE) / 4; ++i)
- dest[i] = 0;
+ return pixman_image_create_bits (info->format, info->width, info->height, (uint32_t *)data, info->stride);
+}
+
+static void
+test_composite (const composite_info_t *info)
+{
+ pixman_image_t *src = make_image (&info->src);
+ pixman_image_t *dest = make_image (&info->dest);
+
+ pixman_image_composite (PIXMAN_OP_SRC, src, NULL, dest,
+ info->src_x, info->src_y,
+ 0, 0,
+ info->dest_x, info->dest_y,
+ info->width, info->height);
+}
- simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, SWIDTH, SHEIGHT, src, SSTRIDE);
- dimg = pixman_image_create_bits (PIXMAN_x8r8g8b8, DWIDTH, DHEIGHT, dest, DSTRIDE);
- pixman_image_composite (PIXMAN_OP_SRC, simg, NULL, dimg,
- 1, 8, 0, 0, 1, -1, 1, 8);
+int
+main (int argc, char **argv)
+{
+ int i;
+
+ for (i = 0; i < sizeof (info) / sizeof (info[0]); ++i)
+ test_composite (&info[i]);
+
return 0;
}
commit 895a8da63370635b05ffb91d3d670c6627d8b2ab
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed Jun 24 11:28:03 2009 -0400
Fix offset bug in pixman_run_fast_path().
Fast paths should only run when the source images complete cover the
composite region, because otherwise they would be required to sample
the border, and fast paths generally don't know how to do that.
The check for this did not work right because it didn't take the
offset generated by the composite coordinates into account. This
commits fixes that by adding (x, y) coordinates to image cover
indicating the new position of the source in destination coordinates.
Based on this we now compare against the region extents which are
already in destination coordinates.
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 497e8c9..188cde8 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -567,13 +567,13 @@ get_fast_path (const pixman_fast_path_t *fast_paths,
}
static inline pixman_bool_t
-image_covers (pixman_image_t *image, pixman_box32_t *extents)
+image_covers (pixman_image_t *image, pixman_box32_t *extents, int x, int y)
{
if (image->common.type == BITS && image->common.repeat == PIXMAN_REPEAT_NONE)
{
- if (extents->x1 < 0 || extents->y1 < 0 ||
- extents->x2 >= image->bits.width ||
- extents->y2 >= image->bits.height)
+ if (x > extents->x1 || y > extents->y1 ||
+ x + image->bits.width < extents->x2 ||
+ y + image->bits.height < extents->y2)
{
return FALSE;
}
@@ -674,9 +674,9 @@ _pixman_run_fast_path (const pixman_fast_path_t *paths,
®ion, src, mask, dest, src_x, src_y, mask_x, mask_y, dest_x, dest_y, width, height))
{
pixman_box32_t *extents = pixman_region32_extents (®ion);
-
- if (image_covers (src, extents) &&
- (!mask || image_covers (mask, extents)))
+
+ if (image_covers (src, extents, dest_x - src_x, dest_y - src_y) &&
+ (!mask || image_covers (mask, extents, dest_x - mask_x, dest_y - mask_y)))
{
walk_region_internal (imp, op,
src, mask, dest,
commit fd90429a32927d8aa516a3d26cc309ca7043e4d3
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date: Wed Jun 24 11:23:04 2009 -0400
Fix typo in oob-test.c
diff --git a/test/oob-test.c b/test/oob-test.c
index fbcb537..fc93156 100644
--- a/test/oob-test.c
+++ b/test/oob-test.c
@@ -14,7 +14,7 @@ main (int argc, char **argv)
#define SHEIGHT 7
#define SSTRIDE 20
- uint32_t *src = malloc (DHEIGHT * SSTRIDE);
+ uint32_t *src = malloc (SHEIGHT * SSTRIDE);
uint32_t *dest = malloc (DHEIGHT * DSTRIDE);
pixman_image_t *simg, *dimg;
More information about the xorg-commit
mailing list