From 8e6cf1e1d40f3f6ae4cebb8d101fc10b6a8abc71 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 2 Oct 2017 09:35:16 +0100 Subject: Framebuffer: Don't create 0x0 bitmaps if content width is 0. --- frontends/framebuffer/bitmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontends/framebuffer/bitmap.c b/frontends/framebuffer/bitmap.c index 59f68bba5..1fc9f46a2 100644 --- a/frontends/framebuffer/bitmap.c +++ b/frontends/framebuffer/bitmap.c @@ -286,11 +286,11 @@ bitmap_render(struct bitmap *bitmap, NSLOG(netsurf, INFO, "width %d, height %d", width, height); /* Calculate size of buffer to render the content into */ - /* We get the width from the content width, unless it exceeds 1024, - * in which case we use 1024. This means we never create excessively - * large render buffers for huge contents, which would eat memory and - * cripple performance. */ - cwidth = min(content_get_width(content), 1024); + /* We get the width from the largest of the bitmap width and the content + * width, unless it exceeds 1024, in which case we use 1024. This means + * we never create excessively large render buffers for huge contents, + * which would eat memory and cripple performance. */ + cwidth = max(width, min(content_get_width(content), 1024)); /* The height is set in proportion with the width, according to the * aspect ratio of the required thumbnail. */ cheight = ((cwidth * height) + (width / 2)) / width; -- cgit v1.2.3