return calloc (buf_size, 1);
}
+static void
+reset_clip_region (pixman_image_t *image)
+{
+ pixman_region_fini (&image->common.clip_region);
+
+ if (image->type == BITS)
+ {
+ pixman_region_init_rect (&image->common.clip_region, 0, 0,
+ image->bits.width, image->bits.height);
+
+ }
+ else
+ {
+ pixman_region_init (&image->common.clip_region);
+ }
+}
+
pixman_image_t *
pixman_image_create_bits (pixman_format_code_t format,
int width,
*/
image->bits.indexed = NULL;
- pixman_region_fini (&image->common.clip_region);
- pixman_region_init_rect (&image->common.clip_region, 0, 0, width, height);
+ reset_clip_region (image);
return image;
}
}
else
{
- pixman_region_fini (&common->clip_region);
- pixman_region_init (&common->clip_region);
-
+ reset_clip_region (image);
+
return TRUE;
}
}
fbFinishAccess (pPicture->pDrawable);
}
+static void
+dump_image (pixman_image_t *image,
+ const char *title)
+{
+ int i, j;
+
+ if (!image->type == BITS)
+ {
+ printf ("%s is not a regular image\n", title);
+ }
+
+ if (!image->bits.format == PIXMAN_a8)
+ {
+ printf ("%s is not an alpha mask\n", title);
+ }
+
+ printf ("\n\n\n%s: \n", title);
+
+ for (i = 0; i < image->bits.height; ++i)
+ {
+ uint8_t *line =
+ (uint8_t *)&(image->bits.bits[i * image->bits.rowstride]);
+
+ for (j = 0; j < image->bits.width; ++j)
+ printf ("%c", line[j]? '#' : ' ');
+
+ printf ("\n");
+ }
+}
+
void
pixman_add_trapezoids (pixman_image_t *image,
int16_t x_off,
{
int i;
+#if 0
+ dump_image (image, "before");
+#endif
+
for (i = 0; i < ntraps; ++i)
{
const pixman_trapezoid_t *trap = &(traps[i]);
pixman_rasterize_trapezoid (image, trap, x_off, y_off);
}
+
+#if 0
+ dump_image (image, "after");
+#endif
}
void