[cairo] Using Cairo GL surface as the main surface and supply cairo_image_surface as pattern won't work

Chunlin Ye pepsin at me.com
Fri Aug 14 08:20:26 PDT 2015

I am tweaking an Cairo app on Android, and using the https://github.com/SRA-SiliconValley/cairogles as the GL based cairo.

For now I use cairo_gl_surface_create_for_egl to create an gl surface, call it Prime Surface, and my app create multiple layer of cairo_image_surface which created by cairo_image_surface_create_for_data and using them as pattern to draw onto the Prime Surface.

The drawing code are something like: 

cairo_pattern_t *pattern = cairo_pattern_create_for_surface(r->surface);
int surfaceWidth = cairo_image_surface_get_width(r->surface);
int surfaceHeight = cairo_image_surface_get_height(r->surface);
cairo_rectangle(cr, 0, 0, surfaceWidth, surfaceHeight);
cairo_set_source(cr, pattern);

but this do not work. I also tried:

cairo_set_source_surface(cr, image_surface, 0, 0);  

don’t work too.

Do anybody know what causing this problem?

More information about the cairo mailing list