diff options
author | Matthias Clasen <mclasen@redhat.com> | 2020-05-16 11:27:21 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2020-05-16 11:27:21 -0400 |
commit | 5851415fcab06390ee6e04ac5416ea0e7d03ae2b (patch) | |
tree | 8f458d350662546f8bcfa2f0272049e7935e3fbe /gsk | |
parent | 13f85839345b378594c54ede0e5da56f0ef820a4 (diff) | |
download | gtk+-5851415fcab06390ee6e04ac5416ea0e7d03ae2b.tar.gz |
broadway: Don't create overlarge images
Respect that cairo won't create image surfaces larger
than 32767 x 32767.
This makes the one reftest pass that specifically checks
this condition, treeview-crash-too-wide.
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/broadway/gskbroadwayrenderer.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gsk/broadway/gskbroadwayrenderer.c b/gsk/broadway/gskbroadwayrenderer.c index 2144a4b63d..df5028169e 100644 --- a/gsk/broadway/gskbroadwayrenderer.c +++ b/gsk/broadway/gskbroadwayrenderer.c @@ -756,7 +756,14 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer, int height = ceil (node->bounds.origin.y + node->bounds.size.height) - y; int scale = broadway_display->scale_factor; - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale); +#define MAX_IMAGE_SIZE 32767 + + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + MIN (width * scale, MAX_IMAGE_SIZE), + MIN (height * scale, MAX_IMAGE_SIZE)); + +#undef MAX_IMAGE_SIZE + cr = cairo_create (surface); cairo_scale (cr, scale, scale); cairo_translate (cr, -x, -y); |