From f3d2623046b934eb2322af45feec3f6ff37e52d4 Mon Sep 17 00:00:00 2001 From: George Matsumura Date: Fri, 10 Jul 2020 03:26:03 -0600 Subject: cogl: Fix very small surfaces in boilerplate Prior to this change, the boilerplate code crashed when given surface dimensions less than 1. This fixes such behaviour by rounding the dimensions up to 1, which is also done by the boilerplate code for several other backends. Signed-off-by: George Matsumura --- boilerplate/cairo-boilerplate-cogl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'boilerplate') diff --git a/boilerplate/cairo-boilerplate-cogl.c b/boilerplate/cairo-boilerplate-cogl.c index 037a34147..364654feb 100644 --- a/boilerplate/cairo-boilerplate-cogl.c +++ b/boilerplate/cairo-boilerplate-cogl.c @@ -74,6 +74,11 @@ _cairo_boilerplate_cogl_create_offscreen_color_surface (const char *name, cogl_closure_t *closure; cairo_status_t status; + if (width < 1) + width = 1; + if (height < 1) + height = 1; + if (!context) context = cogl_context_new (NULL, NULL); @@ -118,6 +123,11 @@ _cairo_boilerplate_cogl_create_onscreen_color_surface (const char *name, cogl_closure_t *closure; cairo_status_t status; + if (width < 1) + width = 1; + if (height < 1) + height = 1; + if (!context) context = cogl_context_new (NULL, NULL); -- cgit v1.2.1