mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 14:31:20 +03:00
Framebuffer: Don't create 0x0 bitmaps if content width is 0.
This commit is contained in:
parent
2f466751ca
commit
8e6cf1e1d4
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user