From 75d843208cf33b8ba0273745582bcaabf900ea24 Mon Sep 17 00:00:00 2001 From: George Matsumura Date: Mon, 29 Jun 2020 13:37:20 -0600 Subject: cogl: Move context, device, and surface members to most fitting places The buffer stack was moved from the surface to the device, as mapped buffers are shared across all surfaces using the device and more than one surface may be doing so. Stemming from this, if a surface tries to map a buffer without first unmapping one that has been mapped by another surface, it will trigger an error. The parent backend functions were moved from the device to the context, as it is possible that the context creation function could be passed a non-cogl device. Prior to this change, many of the subsurface tests segfaulted. Signed-off-by: George Matsumura --- boilerplate/cairo-boilerplate-cogl.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'boilerplate') diff --git a/boilerplate/cairo-boilerplate-cogl.c b/boilerplate/cairo-boilerplate-cogl.c index e11a8b8de..037a34147 100644 --- a/boilerplate/cairo-boilerplate-cogl.c +++ b/boilerplate/cairo-boilerplate-cogl.c @@ -70,7 +70,6 @@ _cairo_boilerplate_cogl_create_offscreen_color_surface (const char *name, { cairo_device_t *device; CoglTexture *tex; - CoglHandle offscreen; CoglFramebuffer *fb; cogl_closure_t *closure; cairo_status_t status; @@ -81,8 +80,7 @@ _cairo_boilerplate_cogl_create_offscreen_color_surface (const char *name, device = cairo_cogl_device_create (context); tex = cogl_texture_2d_new_with_size (context, width, height); cogl_texture_set_components (tex, COGL_TEXTURE_COMPONENTS_RGBA); - offscreen = cogl_offscreen_new_with_texture (tex); - fb = COGL_FRAMEBUFFER (offscreen); + fb = cogl_offscreen_new_with_texture (tex); cogl_framebuffer_allocate (fb, NULL); cogl_framebuffer_orthographic (fb, 0, 0, @@ -116,7 +114,6 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name, void **abstract_closure) { cairo_device_t *device; - CoglOnscreen *onscreen; CoglFramebuffer *fb; cogl_closure_t *closure; cairo_status_t status; @@ -125,10 +122,9 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name, context = cogl_context_new (NULL, NULL); device = cairo_cogl_device_create (context); - onscreen = cogl_onscreen_new (context, width, height); - fb = COGL_FRAMEBUFFER (onscreen); + fb = cogl_onscreen_new (context, width, height); - cogl_onscreen_show (onscreen); + cogl_onscreen_show (fb); cogl_framebuffer_orthographic (fb, 0, 0, cogl_framebuffer_get_width (fb), -- cgit v1.2.1