#include "cairo-test.h"
#ifdef WORDS_BIGENDIAN
#define RED_MASK 0xA0
#define GREEN_MASK 0xA
#else
#define RED_MASK 0x5
#define GREEN_MASK 0x50
#endif
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_surface_t *surface;
unsigned char *data;
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_paint (cr);
surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 32000, 20);
data = cairo_image_surface_get_data (surface);
if (data != NULL) {
int stride = cairo_image_surface_get_stride (surface);
int width = cairo_image_surface_get_width (surface);
int height = cairo_image_surface_get_height (surface);
int x, y;
for (y = 0; y < height; y++) {
for (x = 0; x < (width + 7) / 8; x++)
data[x] = RED_MASK;
data += stride;
}
cairo_surface_mark_dirty (surface);
}
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_mask_surface (cr, surface, 0, 0);
cairo_surface_destroy (surface);
surface = cairo_image_surface_create (CAIRO_FORMAT_A1, 20, 32000);
data = cairo_image_surface_get_data (surface);
if (data != NULL) {
int stride = cairo_image_surface_get_stride (surface);
int width = cairo_image_surface_get_width (surface);
int height = cairo_image_surface_get_height (surface);
int x, y;
for (y = 0; y < height; y++) {
for (x = 0; x < (width + 7) / 8; x++)
data[x] = GREEN_MASK;
data += stride;
}
cairo_surface_mark_dirty (surface);
}
cairo_set_source_rgb (cr, 0, 1, 0);
cairo_mask_surface (cr, surface, 0, 0);
cairo_surface_destroy (surface);
return CAIRO_TEST_SUCCESS;
}
CAIRO_TEST (large_source,
"Exercises mozilla bug 424333 - handling of massive images",
"stress, source",
NULL,
20, 20,
NULL, draw)