예제 #1
0
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    /* Paint background white, then draw in black. */
    cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
    cairo_paint (cr);
    cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */

    draw_rectangles (cr);

    /* and check using cw winding */
    cairo_translate (cr, SIZE, SIZE);
    cairo_scale (cr, -1, 1);

    draw_rectangles (cr);

    return CAIRO_TEST_SUCCESS;
}
int main(int argc, char *argv[]) {
    char fb_node[16] = "/dev/fb0";
    char *tsdevice = NULL;
    struct tsdev *ts;
    struct sigaction action;
    cairo_linuxfb_device_t *device;
    cairo_surface_t *fbsurface;
    cairo_t *fbcr;

    if (argc > 1) {
        strcpy(fb_node, argv[1]);
    }

    printf("Frame buffer node is: %s\n", fb_node);

    if( (tsdevice = getenv("TSLIB_TSDEVICE")) != NULL )
        ts = ts_open(tsdevice, 1);
    else
        ts = ts_open("/dev/input/event0", 1);

    if (ts_config(ts)) {
        perror("ts_config");
        exit(1);
    }

    device = malloc(sizeof(*device));
    if (!device) {
        perror("Error: cannot allocate memory\n");
        exit(1);
    }

    memset(&action, 0, sizeof(struct sigaction));
    action.sa_handler = signal_handler;
    sigaction(SIGTERM, &action, NULL);
    sigaction(SIGINT, &action, NULL);

    fbsurface = cairo_linuxfb_surface_create(device, fb_node);
    fbcr = cairo_create(fbsurface);

    draw_rectangles(fbcr, ts, device);

    cairo_destroy(fbcr);
    cairo_surface_destroy(fbsurface);

    return 0;
}
예제 #3
0
파일: main.c 프로젝트: Godzil/osXdk
void main()
{
    hires();
    draw_rectangles();
    draw_circles();
}