summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorGeorge Matsumura <gmmatsumura01@bvsd.org>2020-07-25 02:14:13 -0600
committerGeorge Matsumura <gmmatsumura01@bvsd.org>2020-08-25 02:30:58 -0600
commitbb84bb650ddc1724bc3abb0ee8da8fa9ae34c9a4 (patch)
tree5fc8191b798caf64dac9d7c7e6d49ef88f0a1cda /boilerplate
parent02371a714e3fe7500b7cfca5d9ba824aeb3f4695 (diff)
downloadcairo-bb84bb650ddc1724bc3abb0ee8da8fa9ae34c9a4.tar.gz
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>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-cogl.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/boilerplate/cairo-boilerplate-cogl.c b/boilerplate/cairo-boilerplate-cogl.c
index ae42578fd..68ee5bd5d 100644
--- a/boilerplate/cairo-boilerplate-cogl.c
+++ b/boilerplate/cairo-boilerplate-cogl.c
@@ -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);