summaryrefslogtreecommitdiff
path: root/frontends/framebuffer/bitmap.c
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2017-10-02 09:35:16 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2017-10-13 10:28:42 +0100
commit8e6cf1e1d40f3f6ae4cebb8d101fc10b6a8abc71 (patch)
treed1984656b674b8496ab68fd9497e76e2303e03bd /frontends/framebuffer/bitmap.c
parent2f466751ca15ee334bc8fbb694dacc2ed33e9bd2 (diff)
downloadnetsurf-8e6cf1e1d40f3f6ae4cebb8d101fc10b6a8abc71.tar.gz
netsurf-8e6cf1e1d40f3f6ae4cebb8d101fc10b6a8abc71.tar.bz2
Framebuffer: Don't create 0x0 bitmaps if content width is 0.
Diffstat (limited to 'frontends/framebuffer/bitmap.c')
-rw-r--r--frontends/framebuffer/bitmap.c10
1 files 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;