cogl: Ensure onscreen framebuffers have an alpha component if required

Prior to this change, cogl often queried GLX so that it returned
a framebuffer that could not support an alpha component.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This commit is contained in:
George Matsumura 2020-07-25 02:14:13 -06:00
parent 02371a714e
commit bb84bb650d

View file

@ -115,7 +115,25 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name,
if (height < 1)
height = 1;
context = cogl_context_new (NULL, NULL);
if (content & CAIRO_CONTENT_ALPHA) {
/* A hackish way to ensure that we get a framebuffer with
* an alpha component */
CoglSwapChain *swap_chain;
CoglOnscreenTemplate *onscreen_template;
CoglRenderer *renderer;
CoglDisplay *display;
swap_chain = cogl_swap_chain_new ();
cogl_swap_chain_set_has_alpha (swap_chain, TRUE);
onscreen_template = cogl_onscreen_template_new (swap_chain);
renderer = cogl_renderer_new ();
display = cogl_display_new (renderer, onscreen_template);
context = cogl_context_new (display, NULL);
} else {
context = cogl_context_new (NULL, NULL);
}
device = cairo_cogl_device_create (context);