summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-01-24 09:25:04 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-01-24 09:25:04 -0500
commit9c4d3281a55040cb811ecd5978c1c6f20456ea9c (patch)
treec9b4bc125ceee9d00506d460862c64e76ea4ac57
parent7ccb0c45e5f6a0ac23f585e2eda412034c2abe61 (diff)
Print debug spew when given invalid trapezoids.trapdebug
-rw-r--r--pixman/pixman-trap.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c
index c99f03ec..1ed75b82 100644
--- a/pixman/pixman-trap.c
+++ b/pixman/pixman-trap.c
@@ -314,6 +314,33 @@ dump_image (pixman_image_t *image,
}
#endif
+void __attribute__((__noinline__))
+print_trap (const pixman_trapezoid_t *trap)
+{
+ fprintf (stderr, " top: %x\n", trap->top);
+ fprintf (stderr, " bottom: %x\n", trap->bottom);
+ fprintf (stderr, " left.p1: %x, %x\n", trap->left.p1.x, trap->left.p1.y);
+ fprintf (stderr, " left.p2: %x, %x\n", trap->left.p2.x, trap->left.p2.y);
+ fprintf (stderr, " right.p1: %x, %x\n", trap->right.p1.x, trap->right.p1.y);
+ fprintf (stderr, " right.p2: %x, %x\n", trap->right.p2.x, trap->right.p2.y);
+}
+
+static void
+check_trapezoids (const pixman_trapezoid_t *traps, int n_traps)
+{
+ int i;
+
+ for (i = 0; i < n_traps; ++i)
+ {
+ const pixman_trapezoid_t *trap = &(traps[i]);
+ if (!(pixman_trapezoid_valid (trap)))
+ {
+ fprintf (stderr, "Invalid trapezoid detected\n");
+ print_trap (trap);
+ }
+ }
+}
+
PIXMAN_EXPORT void
pixman_add_trapezoids (pixman_image_t * image,
int16_t x_off,
@@ -323,6 +350,7 @@ pixman_add_trapezoids (pixman_image_t * image,
{
int i;
+ check_trapezoids (traps, ntraps);
#if 0
dump_image (image, "before");
#endif
@@ -357,6 +385,8 @@ pixman_rasterize_trapezoid (pixman_image_t * image,
return_if_fail (image->type == BITS);
+ check_trapezoids (trap, 1);
+
_pixman_image_validate (image);
if (!pixman_trapezoid_valid (trap))
@@ -417,6 +447,8 @@ pixman_composite_trapezoids (pixman_op_t op,
if (n_traps <= 0)
return;
+ check_trapezoids (traps, n_traps);
+
_pixman_image_validate (src);
_pixman_image_validate (dst);