diff options
author | George Matsumura <gmmatsumura01@bvsd.org> | 2020-06-21 03:32:44 -0600 |
---|---|---|
committer | George Matsumura <gmmatsumura01@bvsd.org> | 2020-08-25 02:30:57 -0600 |
commit | ceffa65fb0411b569690f56788285970ae275c25 (patch) | |
tree | 9daf1736d1bb44a753e1f8ab2995a72a5da86940 /boilerplate | |
parent | 1ada7c9aa6adc70dc58b6678df5d95268f9ecc29 (diff) | |
download | cairo-ceffa65fb0411b569690f56788285970ae275c25.tar.gz |
cogl: Account for new representations of framebuffer types
With the new cogl API, casting the framebuffer into offscreen
and onscreen types with the provided macros is a deprecated
behavior.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate-cogl.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/boilerplate/cairo-boilerplate-cogl.c b/boilerplate/cairo-boilerplate-cogl.c index 540df19d2..e11a8b8de 100644 --- a/boilerplate/cairo-boilerplate-cogl.c +++ b/boilerplate/cairo-boilerplate-cogl.c @@ -38,8 +38,6 @@ typedef struct _cogl_closure { cairo_device_t *device; CoglFramebuffer *fb; - CoglOnscreen *onscreen; - CoglOffscreen *offscreen; cairo_surface_t *surface; } cogl_closure_t; @@ -96,7 +94,6 @@ _cairo_boilerplate_cogl_create_offscreen_color_surface (const char *name, *abstract_closure = closure; closure->device = device; closure->fb = fb; - closure->offscreen = offscreen; closure->surface = cairo_cogl_surface_create (device, fb); status = cairo_surface_set_user_data (closure->surface, @@ -142,7 +139,6 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name, *abstract_closure = closure; closure->device = device; closure->fb = fb; - closure->onscreen = onscreen; closure->surface = cairo_cogl_surface_create (device, fb); status = cairo_surface_set_user_data (closure->surface, @@ -155,35 +151,14 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name, } static cairo_status_t -_cairo_boilerplate_cogl_finish_onscreen (cairo_surface_t *surface) +_cairo_boilerplate_cogl_finish (cairo_surface_t *surface) { cogl_closure_t *closure = cairo_surface_get_user_data (surface, &cogl_closure_key); - if (!closure->onscreen) { - fprintf(stderr, "Attempted to close an offscreen surface " - "using onscreen closure function\n"); - return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; - } - cairo_cogl_surface_end_frame (surface); - cogl_onscreen_swap_buffers (closure->onscreen); - - return CAIRO_STATUS_SUCCESS; -} - -static cairo_status_t -_cairo_boilerplate_cogl_finish_offscreen (cairo_surface_t *surface) -{ - cogl_closure_t *closure = cairo_surface_get_user_data (surface, &cogl_closure_key); - - if (!closure->offscreen) { - fprintf(stderr, "Attempted to close an onscreen surface " - "using offscreen closure function\n"); - return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; - } - - cairo_cogl_surface_end_frame (surface); + if (cogl_is_onscreen (closure->fb)) + cogl_onscreen_swap_buffers (closure->fb); return CAIRO_STATUS_SUCCESS; } @@ -203,7 +178,7 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_cogl_create_offscreen_color_surface, cairo_surface_create_similar, NULL, - _cairo_boilerplate_cogl_finish_offscreen, + _cairo_boilerplate_cogl_finish, _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png, _cairo_boilerplate_cogl_cleanup, @@ -218,7 +193,7 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_cogl_create_onscreen_color_surface, cairo_surface_create_similar, NULL, - _cairo_boilerplate_cogl_finish_onscreen, + _cairo_boilerplate_cogl_finish, _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png, _cairo_boilerplate_cogl_cleanup, |