summaryrefslogtreecommitdiff
path: root/boilerplate
diff options
context:
space:
mode:
authorGeorge Matsumura <gmmatsumura01@bvsd.org>2020-06-18 18:13:37 -0600
committerGeorge Matsumura <gmmatsumura01@bvsd.org>2020-08-25 02:30:57 -0600
commitbda0f90d6e1368e2414235ef84da2dc5390d89cd (patch)
tree978a9622104bcd63b45a7edd63fe60595ad88975 /boilerplate
parent78b00a32132a113cb8d72c4b5d2d4f9f935867d4 (diff)
downloadcairo-bda0f90d6e1368e2414235ef84da2dc5390d89cd.tar.gz
cogl: Correct behavior of boilerplate surface finishing functions
Without this, a buffer-swapping function only usable on onscreen framebuffers would have been used on offscreen framebuffers. Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Diffstat (limited to 'boilerplate')
-rw-r--r--boilerplate/cairo-boilerplate-cogl.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/boilerplate/cairo-boilerplate-cogl.c b/boilerplate/cairo-boilerplate-cogl.c
index 77bdb7972..540df19d2 100644
--- a/boilerplate/cairo-boilerplate-cogl.c
+++ b/boilerplate/cairo-boilerplate-cogl.c
@@ -159,11 +159,11 @@ _cairo_boilerplate_cogl_finish_onscreen (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;
- }
+ 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);
@@ -172,6 +172,22 @@ _cairo_boilerplate_cogl_finish_onscreen (cairo_surface_t *surface)
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);
+
+ return CAIRO_STATUS_SUCCESS;
+}
+
static void
_cairo_boilerplate_cogl_synchronize (void *abstract_closure)
{
@@ -186,7 +202,8 @@ static const cairo_boilerplate_target_t targets[] = {
"cairo_cogl_device_create",
_cairo_boilerplate_cogl_create_offscreen_color_surface,
cairo_surface_create_similar,
- NULL, NULL,
+ NULL,
+ _cairo_boilerplate_cogl_finish_offscreen,
_cairo_boilerplate_get_image_surface,
cairo_surface_write_to_png,
_cairo_boilerplate_cogl_cleanup,