diff options
author | George Matsumura <gmmatsumura01@bvsd.org> | 2020-07-10 03:26:03 -0600 |
---|---|---|
committer | George Matsumura <gmmatsumura01@bvsd.org> | 2020-08-25 02:30:58 -0600 |
commit | f3d2623046b934eb2322af45feec3f6ff37e52d4 (patch) | |
tree | 60df4170f1d9cf9695181a80f5c9d1dcf027dadf /boilerplate | |
parent | 8f0f371b873ed491ba9492fd0a6bad2695de24a6 (diff) | |
download | cairo-f3d2623046b934eb2322af45feec3f6ff37e52d4.tar.gz |
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>
Diffstat (limited to 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate-cogl.c | 10 |
1 files changed, 10 insertions, 0 deletions
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); |