Hello SDL Community!
am working on a software that renders WebKitGtk snapshots on top of VLC video using SDL (full source code here: https://github.com/jankammerath/iptvx). I am using WebKitGtk to create a cairo_surface out of which a PNG is generated. That PNG then is rendered as an SDL surface.
cairo_surface_t *surface = webkit_web_view_get_snapshot_finish(WEBKIT_WEB_VIEW(webview),res,&err);
old_png_byte_data = png_byte_data;
png_byte_data = g_byte_array_new();
cairo_surface_write_to_png_stream(surface,iptvx_webkit_snapshot_write_png,png_byte_data);
overlay_data.data = png_byte_data->data;
overlay_data.length = png_byte_data->len;
g_byte_array_free(old_png_byte_data,true);
Afterwards it is rendered in a window on top of VLC-generated video with the following lines.
SDL_RWops *overlay_rwops = SDL_RWFromMem(overlay_png_ref->data,overlay_png_ref->length);
overlay = IMG_LoadPNG_RW(overlay_rwops);
SDL_BlitSurface(overlay, NULL, screen, NULL);
SDL_FreeRW(overlay_rwops);
SDL_FreeSurface(overlay);
Is it possible to render the cairo_surface_t directly without making a PNG out of it and are there any performance advantages with it?
Many thanks and best regards,
Jan