Esempio n. 1
0
static cairo_test_status_t
preamble (cairo_test_context_t *ctx)
{
    cairo_surface_t *surface;

    /* get the error surface */
    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, INT_MAX, INT_MAX);

#if CAIRO_HAS_GL_SURFACE
    cairo_gl_surface_set_size (surface, 0, 0);
    cairo_gl_surface_swapbuffers (surface);
#endif

#if CAIRO_HAS_OS2_SURFACE
    cairo_os2_surface_set_hwnd (surface, 0);
    cairo_os2_surface_set_size (surface, 0, 0);
    cairo_os2_surface_set_manual_window_refresh (surface, FALSE);
#endif

#if CAIRO_HAS_PDF_SURFACE
    cairo_pdf_surface_restrict_to_version (surface, CAIRO_PDF_VERSION_1_4);
    cairo_pdf_surface_set_size (surface, 0, 0);
#endif

#if CAIRO_HAS_PS_SURFACE
    cairo_ps_surface_set_eps (surface, FALSE);
    cairo_ps_surface_set_size (surface, 0, 0);
    cairo_ps_surface_restrict_to_level (surface, CAIRO_PS_LEVEL_2);
    cairo_ps_surface_dsc_comment (surface, NULL);
    cairo_ps_surface_dsc_begin_setup (surface);
    cairo_ps_surface_dsc_begin_page_setup (surface);
#endif

#if CAIRO_HAS_XCB_SURFACE
    cairo_xcb_surface_set_size (surface, 0, 0);
#endif

#if CAIRO_HAS_XLIB_SURFACE
    cairo_xlib_surface_set_size (surface, 0, 0);
    cairo_xlib_surface_set_drawable (surface, 0, 0, 0);
#endif

    cairo_surface_set_mime_data (surface, NULL, NULL, 0, NULL, 0);
    cairo_surface_set_device_offset (surface, 0, 0);
    cairo_surface_set_fallback_resolution (surface, 0, 0);

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
static void
allocate_pixmap (cairo_5c_surface_t *c5s)
{
    Pixmap  pixmap;
    cairo_5c_gui_t *gui = c5s->u.window.gui;
    Display	    *dpy = gui->global->dpy;
    GC		    gc = gui->gc;
    int		    width = gui->new_width;
    int		    height = gui->new_height;
    int		    depth = gui->depth;

    c5s->width = width;
    c5s->height = height;

    if (!width) width = 1;
    if (!height) height = 1;

    pixmap = XCreatePixmap (dpy, gui->root, width, height, depth);
    XFillRectangle (dpy, pixmap, gc, 0, 0, width, height);
    if (gui->pixmap)
    {
	XCopyArea (dpy, gui->pixmap, pixmap, gc, 0, 0,
		   width, height, 0, 0);
	XFreePixmap (dpy, gui->pixmap);
    }
    gui->pixmap = pixmap;
    if (c5s->surface)
    {
	cairo_xlib_surface_set_drawable (c5s->surface,
					 pixmap,
					 width,
					 height);
    }
    else
    {
	c5s->surface = cairo_xlib_surface_create (dpy,
						  pixmap,
						  DefaultVisual (dpy, DefaultScreen (dpy)),
						  width,
						  height);
    }
}
Esempio n. 3
0
static cairo_test_status_t
test_cairo_xlib_surface_set_drawable (cairo_surface_t *surface)
{
    cairo_xlib_surface_set_drawable (surface, 0, 5, 5);
    return CAIRO_TEST_SUCCESS;
}