#include "cairo-test.h" #include "../src/cairoint.h" #define SIZE 8 cairo_test_t test = { "clip-tor", "Test clipping failure", SIZE, SIZE }; static unsigned char mask_rgba[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }; static cairo_test_status_t draw (cairo_t *cr, int width, int height) { cairo_surface_t *surface; cairo_pattern_t *pattern; cairo_set_source_rgb (cr, 0, 0, 1); cairo_paint (cr); surface = cairo_image_surface_create_for_data (mask_rgba, CAIRO_FORMAT_ARGB32, 3, 4, 12); /* ugh... - needed to trigger use of fbCombineAddC (versus ...AddU) */ pixman_image_set_component_alpha (((cairo_image_surface_t *)surface)->pixman_image, TRUE); pattern = cairo_pattern_create_for_surface (surface); cairo_set_source_rgb (cr, 1, 0, 0); cairo_set_operator (cr, CAIRO_OPERATOR_ADD); cairo_mask (cr, pattern); cairo_pattern_destroy (pattern); // cairo_surface_destroy (surface); return CAIRO_TEST_SUCCESS; } int main (void) { return cairo_test (&test, draw); }