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 <gmmatsumura01@bvsd.org>
This commit is contained in:
George Matsumura 2020-07-10 03:26:03 -06:00
parent 8f0f371b87
commit f3d2623046

View file

@ -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);